stateenvirons

package
v0.0.0-...-56cb166 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package stateenvirons provides types and functions that interface the state and environs packages.

Index

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

type CloudService interface {
	Cloud(ctx context.Context, name string) (*cloud.Cloud, error)
}

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

CloudSpec implements environs.EnvironConfigGetter.

func (EnvironConfigGetter) ModelConfig

func (g EnvironConfigGetter) ModelConfig(ctx context.Context) (*config.Config, error)

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL