Documentation
¶
Overview ¶
Package stateenvirons provides types and functions that interface the state and environs packages.
Index ¶
- func CloudSpecForModel(ctx context.Context, m baseModel, cloudService CloudService, ...) (environscloudspec.CloudSpec, error)
- func GetNewPolicyFunc(cloudService CloudService, credentialService CredentialService, ...) state.NewPolicyFunc
- type CloudService
- type CredentialService
- type EnvironConfigGetter
- type Model
- type ModelConfigService
- type NewCAASBrokerFunc
- type NewEnvironFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloudSpecForModel ¶
func CloudSpecForModel( ctx context.Context, m baseModel, cloudService CloudService, credentialService CredentialService, ) (environscloudspec.CloudSpec, error)
CloudSpecForModel returns a CloudSpec for the specified model.
func GetNewPolicyFunc ¶
func GetNewPolicyFunc( cloudService CloudService, credentialService CredentialService, modelConfigServiceGetter modelConfigServiceGetter, storageServiceGetter storageServiceGetter, ) 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.
Types ¶
type CloudService ¶
CloudService provides access to clouds.
type CredentialService ¶
type CredentialService interface {
CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error)
}
CredentialService provides access to credentials.
type EnvironConfigGetter ¶
type EnvironConfigGetter struct { Model // NewContainerBroker is a func that returns a caas container broker // for the relevant model. NewContainerBroker caas.NewContainerBrokerFunc ModelConfigService ModelConfigService // CredentialService provides access to credentials. CredentialService CredentialService // CloudService provides access to clouds. CloudService CloudService }
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(ctx context.Context) (environscloudspec.CloudSpec, error)
CloudSpec implements environs.EnvironConfigGetter.
func (EnvironConfigGetter) ModelConfig ¶
ModelConfig implements environs.EnvironConfigGetter.
type Model ¶
type Model interface { ModelTag() names.ModelTag ControllerUUID() string Type() state.ModelType // contains filtered or unexported methods }
Model exposes the methods needed for an EnvironConfigGetter.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(ctx context.Context) (*config.Config, error) }
ModelConfigService is an interface that provides access to the model configuration.
type NewCAASBrokerFunc ¶
type NewCAASBrokerFunc = func(Model, CloudService, CredentialService, ModelConfigService) (caas.Broker, error)
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 ¶
type NewEnvironFunc = func(Model, CloudService, CredentialService, ModelConfigService) (environs.Environ, error)
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.