Documentation ¶
Overview ¶
Package stateenvirons provides types and functions that interface the state and environs packages.
Index ¶
- func CloudSpec(modelCloud cloud.Cloud, regionName string, credential *state.Credential) (environscloudspec.CloudSpec, error)
- func CloudSpecForModel(m baseModel) (environscloudspec.CloudSpec, error)
- func GetNewPolicyFunc() state.NewPolicyFunc
- func NewStorageProviderRegistry(reg storage.ProviderRegistry) storage.ProviderRegistry
- func NewStorageProviderRegistryForModel(model *state.Model, newEnv NewEnvironFunc, newBroker NewCAASBrokerFunc) (_ storage.ProviderRegistry, err error)
- func SupportedFeatures(model Model, newEnviron environs.NewEnvironFunc) (assumes.FeatureSet, error)
- type EnvironConfigGetter
- type Model
- type NewCAASBrokerFunc
- type NewEnvironFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloudSpec ¶
func CloudSpec( modelCloud cloud.Cloud, regionName string, credential *state.Credential, ) (environscloudspec.CloudSpec, error)
CloudSpec returns an environscloudspec.CloudSpec from a *state.State, given the cloud, region and credential names.
func CloudSpecForModel ¶
func CloudSpecForModel(m baseModel) (environscloudspec.CloudSpec, error)
CloudSpecForModel returns a CloudSpec for the specified model.
func GetNewPolicyFunc ¶
func GetNewPolicyFunc() state.NewPolicyFunc
GetNewPolicyFunc returns a state.NewPolicyFunc that will return a state.Policy implemented in terms of either environs.Environ or caas.Broker and related types.
func NewStorageProviderRegistry ¶
func NewStorageProviderRegistry(reg storage.ProviderRegistry) storage.ProviderRegistry
NewStorageProviderRegistry returns a storage.ProviderRegistry that chains the provided registry with the common storage providers.
func NewStorageProviderRegistryForModel ¶
func NewStorageProviderRegistryForModel( model *state.Model, newEnv NewEnvironFunc, newBroker NewCAASBrokerFunc, ) (_ storage.ProviderRegistry, err error)
NewStorageProviderRegistryForModel returns a storage provider registry for the specified model.
func SupportedFeatures ¶
func SupportedFeatures(model Model, newEnviron environs.NewEnvironFunc) (assumes.FeatureSet, error)
SupportedFeatures returns the set of features that the model makes available for charms to use.
Types ¶
type EnvironConfigGetter ¶
type EnvironConfigGetter struct { Model // NewContainerBroker is a func that returns a caas container broker // for the relevant model. NewContainerBroker caas.NewContainerBrokerFunc }
EnvironConfigGetter implements environs.EnvironConfigGetter in terms of a Model.
func (EnvironConfigGetter) CloudAPIVersion ¶
func (g EnvironConfigGetter) CloudAPIVersion(spec environscloudspec.CloudSpec) (string, error)
CloudAPIVersion returns the cloud API version for the cloud with the given spec.
func (EnvironConfigGetter) CloudSpec ¶
func (g EnvironConfigGetter) CloudSpec() (environscloudspec.CloudSpec, error)
CloudSpec implements environs.EnvironConfigGetter.
func (EnvironConfigGetter) ModelConfig ¶
func (g EnvironConfigGetter) ModelConfig() (*config.Config, error)
ModelConfig implements environs.EnvironConfigGetter.
type Model ¶
type Model interface { ModelTag() names.ModelTag ControllerUUID() string Type() state.ModelType Config() (*config.Config, error) // contains filtered or unexported methods }
Model exposes the methods needed for an EnvironConfigGetter.
type NewCAASBrokerFunc ¶
NewCAASBrokerFunc aliases a function that, given a state.State, returns a new CAAS broker.
func GetNewCAASBrokerFunc ¶
func GetNewCAASBrokerFunc(newBroker caas.NewContainerBrokerFunc) NewCAASBrokerFunc
GetNewCAASBrokerFunc returns a NewCAASBrokerFunc, that constructs CAAS brokers using the given caas.NewContainerBrokerFunc.
type NewEnvironFunc ¶
NewEnvironFunc aliases a function that, given a Model, returns a new Environ.
func GetNewEnvironFunc ¶
func GetNewEnvironFunc(newEnviron environs.NewEnvironFunc) NewEnvironFunc
GetNewEnvironFunc returns a NewEnvironFunc, that constructs Environs using the given environs.NewEnvironFunc.