credentialvalidator

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// ModelUsesCredential determines if the model uses given cloud credential.
	ModelUsesCredential(tag names.CloudCredentialTag) (bool, error)

	// ModelCredential retrieves the cloud credential that a model uses.
	ModelCredential() (*ModelCredential, error)

	// WatchCredential returns a watcher that is keeping an eye on all changes to
	// a given cloud credential.
	WatchCredential(names.CloudCredentialTag) state.NotifyWatcher

	// InvalidateModelCredential marks the cloud credential that a current model
	// uses as invalid.
	InvalidateModelCredential(reason string) error

	// WatchModelCredential returns a watcher that is keeping an eye on what cloud credential a model uses.
	WatchModelCredential() (state.NotifyWatcher, error)
}

Backend defines behavior that credential validator needs.

func NewBackend

func NewBackend(st StateAccessor) Backend

type CredentialValidatorAPI

type CredentialValidatorAPI struct {
	*credentialcommon.CredentialManagerAPI
	// contains filtered or unexported fields
}

func NewCredentialValidatorAPI

func NewCredentialValidatorAPI(ctx facade.Context) (*CredentialValidatorAPI, error)

NewCredentialValidatorAPI creates a new CredentialValidator API endpoint on server-side.

func (*CredentialValidatorAPI) ModelCredential

func (api *CredentialValidatorAPI) ModelCredential() (params.ModelCredential, error)

ModelCredential returns cloud credential information for a model.

func (*CredentialValidatorAPI) WatchCredential

func (api *CredentialValidatorAPI) WatchCredential(tag params.Entity) (params.NotifyWatchResult, error)

WatchCredential returns a NotifyWatcher that observes changes to a given cloud credential.

func (*CredentialValidatorAPI) WatchModelCredential

func (api *CredentialValidatorAPI) WatchModelCredential() (params.NotifyWatchResult, error)

WatchModelCredential returns a NotifyWatcher that watches what cloud credential a model uses.

type CredentialValidatorAPIV1

type CredentialValidatorAPIV1 struct {
	*CredentialValidatorAPI
}

func NewCredentialValidatorAPIv1

func NewCredentialValidatorAPIv1(ctx facade.Context) (*CredentialValidatorAPIV1, error)

NewCredentialValidatorAPIv1 creates a new CredentialValidator API endpoint on server-side.

func (*CredentialValidatorAPIV1) WatchModelCredential

func (*CredentialValidatorAPIV1) WatchModelCredential(_, _ struct{})

Mask out new methods from the old API versions. The API reflection code in rpc/rpcreflect/type.go:newMethod skips 2-argument methods, so this removes the method as far as the RPC machinery is concerned.

WatchModelCredential did not exist prior to v2.

type CredentialValidatorV1

type CredentialValidatorV1 interface {
	InvalidateModelCredential(params.InvalidateCredentialArg) (params.ErrorResult, error)
	ModelCredential() (params.ModelCredential, error)
	WatchCredential(params.Entity) (params.NotifyWatchResult, error)
}

CredentialValidatorV1 defines the methods on version 1 facade for the credentialvalidator API endpoint.

type CredentialValidatorV2

type CredentialValidatorV2 interface {
	InvalidateModelCredential(params.InvalidateCredentialArg) (params.ErrorResult, error)
	ModelCredential() (params.ModelCredential, error)
	WatchCredential(params.Entity) (params.NotifyWatchResult, error)
	WatchModelCredential() (params.NotifyWatchResult, error)
}

CredentialValidatorV2 defines the methods on version 2 facade for the credentialvalidator API endpoint.

type ModelAccessor

type ModelAccessor interface {
	CloudCredential() (names.CloudCredentialTag, bool)
	ModelTag() names.ModelTag
	Cloud() string
	WatchModelCredential() state.NotifyWatcher
}

ModelAccessor exposes Model methods needed by credential validator.

type ModelCredential

type ModelCredential struct {
	// Model is a model tag.
	Model names.ModelTag

	// Exists indicates whether the model has  a cloud credential.
	// On some clouds, that only require "empty" auth, cloud credential
	// is not needed for the models to function properly.
	Exists bool

	// Credential is a cloud credential tag.
	Credential names.CloudCredentialTag

	// Valid indicates that this model's cloud authentication is valid.
	//
	// If this model has a cloud credential setup,
	// then this property indicates that this credential itself is valid.
	//
	// If this model has no cloud credential, then this property indicates
	// whether or not it is valid for this model to have no credential.
	// There are some clouds that do not require auth and, hence,
	// models on these clouds do not require credentials.
	//
	// If a model is on the cloud that does require credential and
	// the model's credential is not set, this property will be set to 'false'.
	Valid bool
}

ModelCredential stores model's cloud credential information.

type StateAccessor

type StateAccessor interface {
	Model() (ModelAccessor, error)
	CloudCredential(tag names.CloudCredentialTag) (state.Credential, error)
	WatchCredential(names.CloudCredentialTag) state.NotifyWatcher
	InvalidateModelCredential(reason string) error
	Cloud(name string) (cloud.Cloud, error)
}

StateAccessor exposes State methods needed by credential validator.

func NewStateShim

func NewStateShim(st *state.State) StateAccessor

NewStateShim creates new state shim to be used by credential validator Facade.

Jump to

Keyboard shortcuts

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