当前位置: 首页>>代码示例>>Golang>>正文


Golang params.ModelConfigResult类代码示例

本文整理汇总了Golang中github.com/juju/juju/apiserver/params.ModelConfigResult的典型用法代码示例。如果您正苦于以下问题:Golang ModelConfigResult类的具体用法?Golang ModelConfigResult怎么用?Golang ModelConfigResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModelConfigResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ModelConfig

// ModelConfig returns the current environment's configuration.
func (e *ModelWatcher) ModelConfig() (params.ModelConfigResult, error) {
	result := params.ModelConfigResult{}

	config, err := e.st.ModelConfig()
	if err != nil {
		return result, err
	}
	allAttrs := config.AllAttrs()

	if !e.authorizer.AuthModelManager() {
		// Mask out any secrets in the environment configuration
		// with values of the same type, so it'll pass validation.
		//
		// TODO(dimitern) 201309-26 bug #1231384
		// Delete the code below and mark the bug as fixed,
		// once it's live tested on MAAS and 1.16 compatibility
		// is dropped.
		provider, err := environs.Provider(config.Type())
		if err != nil {
			return result, err
		}
		secretAttrs, err := provider.SecretAttrs(config)
		for k := range secretAttrs {
			allAttrs[k] = "not available"
		}
	}
	result.Config = allAttrs
	return result, nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:30,代码来源:modelwatcher.go

示例2: ModelConfig

// ModelConfig returns the model's configuration.
func (u *UndertakerAPI) ModelConfig() (params.ModelConfigResult, error) {
	result := params.ModelConfigResult{}

	config, err := u.st.ModelConfig()
	if err != nil {
		return result, err
	}
	allAttrs := config.AllAttrs()
	result.Config = allAttrs
	return result, nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:12,代码来源:undertaker.go

示例3: ModelConfig

// ModelConfig returns the current model's configuration.
func (api *DiscoverSpacesAPI) ModelConfig() (params.ModelConfigResult, error) {
	result := params.ModelConfigResult{}

	config, err := api.st.ModelConfig()
	if err != nil {
		return result, err
	}
	allAttrs := config.AllAttrs()
	// No need to obscure any secrets as caller needs to be a ModelManager to
	// call any api methods.
	result.Config = allAttrs
	return result, nil
}
开发者ID:bac,项目名称:juju,代码行数:14,代码来源:discoverspaces.go

示例4: ConfigSkeleton

// ConfigSkeleton returns config values to be used as a starting point for the
// API caller to construct a valid model specific config.  The provider
// and region params are there for future use, and current behaviour expects
// both of these to be empty.
func (mm *ModelManagerAPI) ConfigSkeleton(args params.ModelSkeletonConfigArgs) (params.ModelConfigResult, error) {
	var result params.ModelConfigResult
	if args.Region != "" {
		return result, errors.NotValidf("region value %q", args.Region)
	}

	controllerEnv, err := mm.state.ControllerModel()
	if err != nil {
		return result, errors.Trace(err)
	}
	config, err := mm.configSkeleton(controllerEnv, args.Provider)
	if err != nil {
		return result, errors.Trace(err)
	}

	result.Config = config
	return result, nil
}
开发者ID:makyo,项目名称:juju,代码行数:22,代码来源:modelmanager.go


注:本文中的github.com/juju/juju/apiserver/params.ModelConfigResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。