credentialcommon

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateExistingModelCredential

func ValidateExistingModelCredential(backend PersistentBackend, callCtx context.ProviderCallContext, checkCloudInstances bool) (params.ErrorResults, error)

ValidateExistingModelCredential checks if the cloud credential that a given model uses is valid for it.

func ValidateNewModelCredential

func ValidateNewModelCredential(backend PersistentBackend, callCtx context.ProviderCallContext, credentialTag names.CloudCredentialTag, credential *cloud.Credential, checkCloudInstances bool) (params.ErrorResults, error)

ValidateNewModelCredential checks if a new cloud credential could be valid for a given model.

Types

type CloudProvider

type CloudProvider interface {
	// AllInstances returns all instances currently known to the cloud provider.
	AllInstances(ctx context.ProviderCallContext) ([]instances.Instance, error)
}

CloudProvider defines methods needed from the cloud provider to perform the check.

type ControllerConfig

type ControllerConfig interface {
	ControllerUUID() string
}

ControllerConfig defines methods needed from the cloud provider to perform the check.

type CredentialManagerAPI

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

func NewCredentialManagerAPI

func NewCredentialManagerAPI(backend StateBackend) *CredentialManagerAPI

NewCredentialManagerAPI creates new model credential manager api endpoint.

func (*CredentialManagerAPI) InvalidateModelCredential

func (api *CredentialManagerAPI) InvalidateModelCredential(args params.InvalidateCredentialArg) (params.ErrorResult, error)

InvalidateModelCredential marks the cloud credential for this model as invalid.

type Machine

type Machine interface {
	// IsManual returns true if the machine was manually provisioned.
	IsManual() (bool, error)

	// IsContainer returns true if the machine is a container.
	IsContainer() bool

	// InstanceId returns the provider specific instance id for this
	// machine, or a NotProvisionedError, if not set.
	InstanceId() (instance.Id, error)

	// Id returns the machine id.
	Id() string
}

Machine defines machine methods needed for the check.

type Model

type Model interface {
	// CloudName returns the name of the cloud to which the model is deployed.
	CloudName() string

	// CloudRegion returns the name of the cloud region to which the model is deployed.
	CloudRegion() string

	// Config returns the config for the model.
	Config() (*config.Config, error)

	// ValidateCloudCredential validates new cloud credential for this model.
	ValidateCloudCredential(tag names.CloudCredentialTag, credential cloud.Credential) error

	// Type returns the type of the model.
	Type() state.ModelType

	// CloudCredentialTag returns the tag of the cloud credential used for managing the
	// model's cloud resources, and a boolean indicating whether a credential is set.
	CloudCredentialTag() (names.CloudCredentialTag, bool)
}

Model defines model methods needed for the check.

type PersistentBackend

type PersistentBackend interface {
	// Model returns the model entity.
	Model() (Model, error)

	// Cloud returns the controller's cloud definition.
	Cloud(name string) (cloud.Cloud, error)

	// CloudCredential returns the cloud credential for the given tag.
	CloudCredential(tag names.CloudCredentialTag) (state.Credential, error)

	// AllMachines returns all machines in the model.
	AllMachines() ([]Machine, error)

	// ControllerConfig returns controller config.
	ControllerConfig() (ControllerConfig, error)
}

PersistentBackend defines persisted entities that are accessed during credential validity check.

func NewPersistentBackend

func NewPersistentBackend(p *state.State) PersistentBackend

NewPersistentBackend creates a credential validity backend to use, based on state.State.

type StateBackend

type StateBackend interface {
	InvalidateModelCredential(reason string) error
}

StateBackend exposes State methods needed by credential manager.

Jump to

Keyboard shortcuts

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