cloudspec

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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCloudSpecCredentialContentWatcherForModel

func MakeCloudSpecCredentialContentWatcherForModel(st *state.State, credentialService CredentialService) func(context.Context, names.ModelTag) (watcher.NotifyWatcher, error)

MakeCloudSpecCredentialContentWatcherForModel returns a function which returns a NotifyWatcher for credential content changes for a single model. Attempts to request a watcher for any other model other than the one associated with the given state.State results in an error.

func MakeCloudSpecCredentialWatcherForModel

func MakeCloudSpecCredentialWatcherForModel(st *state.State) func(names.ModelTag) (state.NotifyWatcher, error)

MakeCloudSpecCredentialWatcherForModel returns a function which returns a NotifyWatcher for changes to a model's credential reference. This watch will detect when model's credential is replaced with another credential. Attempts to request a watcher for any other model other than the one associated with the given state.State results in an error.

func MakeCloudSpecGetter

func MakeCloudSpecGetter(pool Pool, cloudService common.CloudService, credentialService CredentialService, modelConfigServiceGetter ModelConfigServiceGetter) func(context.Context, names.ModelTag) (environscloudspec.CloudSpec, error)

MakeCloudSpecGetter returns a function which returns a CloudSpec for a given model, using the given Pool.

func MakeCloudSpecGetterForModel

func MakeCloudSpecGetterForModel(st *state.State, cloudService CloudService, credentialService CredentialService, modelConfigService ModelConfigService) func(context.Context, names.ModelTag) (environscloudspec.CloudSpec, error)

MakeCloudSpecGetterForModel returns a function which returns a CloudSpec for a single model. Attempts to request a CloudSpec for any other model other than the one associated with the given state.State results in an error.

func MakeCloudSpecWatcherForModel

func MakeCloudSpecWatcherForModel(st *state.State, cloudService CloudService) func(context.Context, names.ModelTag) (watcher.NotifyWatcher, error)

MakeCloudSpecWatcherForModel returns a function which returns a NotifyWatcher for cloud spec changes for a single model. Attempts to request a watcher for any other model other than the one associated with the given state.State results in an error.

Types

type CloudService

type CloudService interface {
	// Cloud returns the named cloud.
	Cloud(ctx context.Context, name string) (*cloud.Cloud, error)
	// WatchCloud returns a watcher that observes changes to the specified cloud.
	WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error)
}

CloudService provides access to clouds.

type CloudSpecAPI

type CloudSpecAPI struct {
	// contains filtered or unexported fields
}

func NewCloudSpec

func NewCloudSpec(
	resources facade.Resources,
	getCloudSpec func(context.Context, names.ModelTag) (environscloudspec.CloudSpec, error),
	watchCloudSpec func(ctx context.Context, tag names.ModelTag) (corewatcher.NotifyWatcher, error),
	watchCloudSpecModelCredentialReference func(tag names.ModelTag) (state.NotifyWatcher, error),
	watchCloudSpecCredentialContent func(ctx context.Context, tag names.ModelTag) (corewatcher.NotifyWatcher, error),
	getAuthFunc common.GetAuthFunc,
) CloudSpecAPI

NewCloudSpec returns a new CloudSpecAPI.

func (CloudSpecAPI) CloudSpec

CloudSpec returns the model's cloud spec.

func (CloudSpecAPI) GetCloudSpec

func (s CloudSpecAPI) GetCloudSpec(ctx context.Context, tag names.ModelTag) params.CloudSpecResult

GetCloudSpec constructs the CloudSpec for a validated and authorized model.

func (CloudSpecAPI) WatchCloudSpecsChanges

func (s CloudSpecAPI) WatchCloudSpecsChanges(ctx context.Context, args params.Entities) (params.NotifyWatchResults, error)

WatchCloudSpecsChanges returns a watcher for cloud spec changes.

type CloudSpecAPIV2

type CloudSpecAPIV2 struct {
	CloudSpecAPI
}

func NewCloudSpecV2

func NewCloudSpecV2(
	resources facade.Resources,
	getCloudSpec func(context.Context, names.ModelTag) (environscloudspec.CloudSpec, error),
	watchCloudSpec func(ctx context.Context, tag names.ModelTag) (corewatcher.NotifyWatcher, error),
	watchCloudSpecModelCredentialReference func(tag names.ModelTag) (state.NotifyWatcher, error),
	watchCloudSpecCredentialContent func(ctx context.Context, tag names.ModelTag) (corewatcher.NotifyWatcher, error),
	getAuthFunc common.GetAuthFunc,
) CloudSpecAPIV2

type CloudSpecer

type CloudSpecer interface {
	// WatchCloudSpecsChanges returns a watcher for cloud spec changes.
	WatchCloudSpecsChanges(context.Context, params.Entities) (params.NotifyWatchResults, error)

	// CloudSpec returns the model's cloud spec.
	CloudSpec(context.Context, params.Entities) (params.CloudSpecResults, error)

	// GetCloudSpec constructs the CloudSpec for a validated and authorized model.
	GetCloudSpec(context.Context, names.ModelTag) params.CloudSpecResult
}

CloudSpecer defines the CloudSpec api interface

type CredentialService

type CredentialService interface {
	// CloudCredential returns the cloud credential for the given tag.
	CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error)

	// WatchCredential returns a watcher that observes changes to the specified
	// credential.
	WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error)
}

CredentialService provides access to credentials.

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 ModelConfigServiceGetter

type ModelConfigServiceGetter func(coremodel.UUID) ModelConfigService

ModelConfigServiceGetter is a factory for ModelConfigService. It takes a model UUID and returns a ModelConfigService for that model.

type Pool

type Pool interface {
	Get(string) (*state.PooledState, error)
}

Pool describes an interface for retrieving State instances from a collection.

Jump to

Keyboard shortcuts

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