// ModelInfo returns information about the current model. func (c *Client) ModelInfo() (params.ModelInfo, error) { if err := c.checkCanWrite(); err != nil { return params.ModelInfo{}, err } state := c.api.stateAccessor conf, err := state.ModelConfig() if err != nil { return params.ModelInfo{}, err } model, err := state.Model() if err != nil { return params.ModelInfo{}, err } info := params.ModelInfo{ DefaultSeries: config.PreferredSeries(conf), CloudTag: names.NewCloudTag(model.Cloud()).String(), CloudRegion: model.CloudRegion(), ProviderType: conf.Type(), Name: conf.Name(), UUID: model.UUID(), OwnerTag: model.Owner().String(), Life: params.Life(model.Life().String()), } if tag, ok := model.CloudCredential(); ok { info.CloudCredentialTag = tag.String() } return info, nil }
// ModelInfo returns information about the current model (default // series and type). func (c *Client) ModelInfo() (params.ModelInfo, error) { state := c.api.stateAccessor conf, err := state.ModelConfig() if err != nil { return params.ModelInfo{}, err } env, err := state.Model() if err != nil { return params.ModelInfo{}, err } info := params.ModelInfo{ DefaultSeries: config.PreferredSeries(conf), ProviderType: conf.Type(), Name: conf.Name(), UUID: env.UUID(), ControllerUUID: env.ControllerUUID(), } return info, nil }