本文整理汇总了Golang中github.com/juju/juju/apiserver/params.ModelConfigResults类的典型用法代码示例。如果您正苦于以下问题:Golang ModelConfigResults类的具体用法?Golang ModelConfigResults怎么用?Golang ModelConfigResults使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelConfigResults类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ModelGet
// ModelGet implements the server-side part of the
// model-config CLI command.
func (c *ModelConfigAPI) ModelGet() (params.ModelConfigResults, error) {
result := params.ModelConfigResults{}
if err := c.checkCanWrite(); err != nil {
return result, errors.Trace(err)
}
values, err := c.backend.ModelConfigValues()
if err != nil {
return result, errors.Trace(err)
}
result.Config = make(map[string]params.ConfigValue)
for attr, val := range values {
// Authorized keys are able to be listed using
// juju ssh-keys and including them here just
// clutters everything.
if attr == config.AuthorizedKeysKey {
continue
}
result.Config[attr] = params.ConfigValue{
Value: val.Value,
Source: val.Source,
}
}
return result, nil
}
示例2: ModelGet
// ModelGet implements the server-side part of the
// get-model-config CLI command.
func (c *Client) ModelGet() (params.ModelConfigResults, error) {
result := params.ModelConfigResults{}
// Get the existing environment config from the state.
config, err := c.api.stateAccessor.ModelConfig()
if err != nil {
return result, err
}
result.Config = config.AllAttrs()
return result, nil
}
示例3: ModelConfig
// ModelConfig returns the environment config for the controller
// environment. For information on the current environment, use
// client.ModelGet
func (s *ControllerAPI) ModelConfig() (params.ModelConfigResults, error) {
result := params.ModelConfigResults{}
controllerEnv, err := s.state.ControllerModel()
if err != nil {
return result, errors.Trace(err)
}
config, err := controllerEnv.Config()
if err != nil {
return result, errors.Trace(err)
}
result.Config = config.AllAttrs()
return result, nil
}
示例4: ModelConfig
// ModelConfig returns the environment config for the controller
// environment. For information on the current environment, use
// client.ModelGet
func (s *ControllerAPI) ModelConfig() (params.ModelConfigResults, error) {
result := params.ModelConfigResults{}
if err := s.checkHasAdmin(); err != nil {
return result, errors.Trace(err)
}
controllerModel, err := s.state.ControllerModel()
if err != nil {
return result, errors.Trace(err)
}
cfg, err := controllerModel.Config()
if err != nil {
return result, errors.Trace(err)
}
result.Config = make(map[string]params.ConfigValue)
for name, val := range cfg.AllAttrs() {
result.Config[name] = params.ConfigValue{
Value: val,
}
}
return result, nil
}