stateenvirons

package
v0.0.0-...-2f78cd6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 15 Imported by: 69

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 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

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

type NewCAASBrokerFunc = func(Model) (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) (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.

Jump to

Keyboard shortcuts

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