// modelConfigSources returns a slice of named model config
// sources, in hierarchical order. Starting from the first source,
// config is retrieved and each subsequent source adds to the
// overall config values, later values override earlier ones.
7623
func modelConfigSources(st *State, regionSpec *environs.CloudRegionSpec) []modelConfigSource {
	return []modelConfigSource{
		{config.JujuDefaultSource, st.defaultInheritedConfig(regionSpec.Cloud)},
		{config.JujuControllerSource, st.controllerInheritedConfig(regionSpec.Cloud)},
		{config.JujuRegionSource, st.regionInheritedConfig(regionSpec)},
	}
}
158233
func NewSources(cfgs []Config) Sources {
	srcs := Sources{}
	for _, c := range cfgs {
		if _, ok := srcs[c.Service]; !ok {
			srcs[c.Service] = Sessions{}
		}
		srcs[c.Service][c.User] = Session{config: c}
	}
	return srcs
}
502491
func Convert_v1_ConfigMapNodeConfigSource_To_core_ConfigMapNodeConfigSource(in *v1.ConfigMapNodeConfigSource, out *core.ConfigMapNodeConfigSource, s conversion.Scope) error {
	return autoConvert_v1_ConfigMapNodeConfigSource_To_core_ConfigMapNodeConfigSource(in, out, s)
}
1159709
func Convert_config_SerializedNodeConfigSource_To_v1beta1_SerializedNodeConfigSource(in *config.SerializedNodeConfigSource, out *v1beta1.SerializedNodeConfigSource, s conversion.Scope) error {
	return autoConvert_config_SerializedNodeConfigSource_To_v1beta1_SerializedNodeConfigSource(in, out, s)
}
1135979
func (s *RemoteApplication) SourceModel() names.ModelTag {
	return names.NewModelTag(s.doc.SourceModelUUID)
}
247433
func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
	source := &tokenSource{
		ctx:  ctx,
		conf: c,
	}
	return oauth2.ReuseTokenSource(nil, source)
}
932596
func Convert_core_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in *core.ConfigMapVolumeSource, out *v1.ConfigMapVolumeSource, s conversion.Scope) error {
	return autoConvert_core_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in, out, s)
}
1183619
func (configMgr *ConfigurationManager) GetConfigurationsByKey(key string) interface{} {
	configMgr.configMapMux.Lock()
	sourceName, ok := configMgr.ConfigurationMap[key]
	configMgr.configMapMux.Unlock()
	if !ok {
		return nil
	}

	return configMgr.configValueBySource(key, sourceName)
}
514295
func (configMgr *ConfigurationManager) GetConfigurations() map[string]interface{} {
	config := make(map[string]interface{}, 0)

	configMgr.configMapMux.Lock()
	defer configMgr.configMapMux.Unlock()

	for key, sourceName := range configMgr.ConfigurationMap {
		sValue := configMgr.configValueBySource(key, sourceName)
		if sValue == nil {
			continue
		}
		config[key] = sValue
	}

	return config
}
393914
func (s *SeesawECU) ConfigSource(args *ipc.ConfigSource, oldSource *string) error {
	if args == nil {
		return errors.New("args is nil")
	}
	ctx := args.Ctx
	s.trace("ConfigSource", ctx)

	authConn, err := s.ecu.authConnect(ctx)
	if err != nil {
		return err
	}
	defer authConn.Close()

	source, err := authConn.ConfigSource(args.Source)
	if err != nil {
		return err
	}

	if oldSource != nil {
		*oldSource = source
	}
	return nil
}
1154340
func (model *Model) ModelConfigValues() (config.ConfigValues, error) {
	cfg, err := model.ModelConfig()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return model.modelConfigValues(cfg.AllAttrs())
}
1143552
func Convert_config_StringSource_To_v1_StringSource(in *config.StringSource, out *v1.StringSource, s conversion.Scope) error {
	return autoConvert_config_StringSource_To_v1_StringSource(in, out, s)
}
989090
func (u *UniterAPI) ConfigSettings(args params.Entities) (params.ConfigSettingsResults, error) {
	result := params.ConfigSettingsResults{
		Results: make([]params.ConfigSettingsResult, len(args.Entities)),
	}
	canAccess, err := u.accessUnit()
	if err != nil {
		return params.ConfigSettingsResults{}, err
	}
	for i, entity := range args.Entities {
		tag, err := names.ParseUnitTag(entity.Tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}
		err = common.ErrPerm
		if canAccess(tag) {
			var unit *state.Unit
			unit, err = u.getUnit(tag)
			if err == nil {
				var settings charm.Settings
				settings, err = unit.ConfigSettings()
				if err == nil {
					result.Results[i].Settings = params.ConfigSettings(settings)
				}
			}
		}
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}
1261779
func (st *State) ComposeNewModelConfig(modelAttr map[string]interface{}, regionSpec *environs.CloudRegionSpec) (map[string]interface{}, error) {
	configSources := modelConfigSources(st, regionSpec)
	return composeModelConfigAttributes(modelAttr, configSources...)
}
755997
func (cfg *centOSCloudConfig) PackageSources() []packaging.PackageSource {
	sources, _ := cfg.attrs["package_sources"].([]packaging.PackageSource)
	return sources
}
315000
func (cfg *ubuntuCloudConfig) AddPackageSource(src packaging.PackageSource) {
	cfg.attrs["apt_sources"] = append(cfg.PackageSources(), src)
}
1321534
func (p environStatePolicy) ProviderConfigSchemaSource(cloudName string) (config.ConfigSchemaSource, error) {
	cloud, err := p.st.Cloud(cloudName)
	if err != nil {
		return nil, errors.Trace(err)
	}
	provider, err := environProvider(cloud.Type)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if cs, ok := provider.(config.ConfigSchemaSource); ok {
		return cs, nil
	}
	return nil, errors.NotImplementedf("config.ConfigSource")
}