func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error {
	var storageConstraints map[string]params.StorageConstraints
	if len(cfg.StorageConstraints) > 0 {
		storageConstraints = make(map[string]params.StorageConstraints)
		for name, cons := range cfg.StorageConstraints {
			size, count := cons.Size, cons.Count
			var sizePtr, countPtr *uint64
			if size > 0 {
				sizePtr = &size
			}
			if count > 0 {
				countPtr = &count
			}
			storageConstraints[name] = params.StorageConstraints{
				Pool:  cons.Pool,
				Size:  sizePtr,
				Count: countPtr,
			}
		}
	}

	origin := cfg.CharmID.Origin
	paramsCharmOrigin := origin.ParamsCharmOrigin()

	args := params.ApplicationSetCharm{
		ApplicationName:    cfg.ApplicationName,
		CharmURL:           cfg.CharmID.URL.String(),
		CharmOrigin:        &paramsCharmOrigin,
		Channel:            origin.Risk,
		ConfigSettings:     cfg.ConfigSettings,
		ConfigSettingsYAML: cfg.ConfigSettingsYAML,
		Force:              cfg.Force,
		ForceSeries:        cfg.ForceSeries,
		ForceUnits:         cfg.ForceUnits,
		ResourceIDs:        cfg.ResourceIDs,
		StorageConstraints: storageConstraints,
		EndpointBindings:   cfg.EndpointBindings,
		Generation:         branchName,
	}
	return c.facade.FacadeCall("SetCharm", args, nil)
}
// SetCharm sets the charm for a given application.
SetCharm sets the charm for a given application.
// SetCharm sets the charm for a given application .
func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error {
	var storageConstraints map[string]params.StorageConstraints
	if len(cfg.StorageConstraints) > 0 {
		storageConstraints = make(map[string]params.StorageConstraints)
		for name, cons := range cfg.StorageConstraints {
			size, count := cons.Size, cons.Count
			var sizePtr, countPtr *uint64
			if size > 0 {
				sizePtr = &size
			}
			if count > 0 {
				countPtr = &count
			}
			storageConstraints[name] = params.StorageConstraints{
				Pool:  cons.Pool,
				Size:  sizePtr,
				Count: countPtr,
			}
		}
	}
	origin := cfg.CharmID.Origin
	paramsCharmOrigin := origin.ParamsCharmOrigin()
	args := params.ApplicationSetCharm{
		ApplicationName:    cfg.ApplicationName,
		CharmURL:           cfg.CharmID.URL.String(),
		CharmOrigin:        &paramsCharmOrigin,
		Channel:            origin.Risk,
		ConfigSettings:     cfg.ConfigSettings,
		ConfigSettingsYAML: cfg.ConfigSettingsYAML,
		Force:              cfg.Force,
		ForceSeries:        cfg.ForceSeries,
		ForceUnits:         cfg.ForceUnits,
		ResourceIDs:        cfg.ResourceIDs,
		StorageConstraints: storageConstraints,
		EndpointBindings:   cfg.EndpointBindings,
		Generation:         branchName,
	}
	return c.facade.FacadeCall("SetCharm", args, nil)
}
func ( c * Client ) SetCharm ( branchName string , cfg SetCharmConfig ) error { var storageConstraints map [ string ] params . StorageConstraints if len ( cfg . StorageConstraints ) > 0 { storageConstraints = make ( map [ string ] params . StorageConstraints ) for name , cons := range cfg . StorageConstraints { size , count := cons . Size , cons . Count var sizePtr , countPtr * uint64 if size > 0 { sizePtr = & size } if count > 0 { countPtr = & count } storageConstraints [ name ] = params . StorageConstraints { Pool : cons . Pool , Size : sizePtr , Count : countPtr , } } } origin := cfg . CharmID . Origin paramsCharmOrigin := origin . ParamsCharmOrigin ( ) args := params . ApplicationSetCharm { ApplicationName : cfg . ApplicationName , CharmURL : cfg . CharmID . URL . String ( ) , CharmOrigin : & paramsCharmOrigin , Channel : origin . Risk , ConfigSettings : cfg . ConfigSettings , ConfigSettingsYAML : cfg . ConfigSettingsYAML , Force : cfg . Force , ForceSeries : cfg . ForceSeries , ForceUnits : cfg . ForceUnits , ResourceIDs : cfg . ResourceIDs , StorageConstraints : storageConstraints , EndpointBindings : cfg . EndpointBindings , Generation : branchName , } return c . facade . FacadeCall ( " " , args , nil ) }
SetCharm sets the charm for a given application.
SetCharm sets the charm for a given application .