juju: github.com/juju/juju/worker/credentialvalidator Index | Files

package credentialvalidator

import "github.com/juju/juju/worker/credentialvalidator"

Index

Package Files

manifold.go shim.go worker.go

Variables

var ErrModelCredentialChanged = errors.New("model cloud credential has changed")

ErrModelCredentialChanged indicates that a Worker has bounced because its model's cloud credential has changed.

var ErrValidityChanged = errors.New("cloud credential validity has changed")

ErrValidityChanged indicates that a Worker has bounced because its credential validity has changed: either a valid credential became invalid or invalid credential became valid.

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold packages a Worker for use in a dependency.Engine.

func NewWorker Uses

func NewWorker(config Config) (worker.Worker, error)

NewWorker returns a Worker that tracks the validity of the Model's cloud credential, as exposed by the Facade.

type Config Uses

type Config struct {
    Facade Facade
    Logger Logger
}

Config holds the dependencies and configuration for a Worker.

func (Config) Validate Uses

func (config Config) Validate() error

Validate returns an error if the config cannot be expected to drive a functional Worker.

type Facade Uses

type Facade interface {
    // ModelCredential gets model's cloud credential.
    // Models that are on the clouds that do not require auth will return
    // false to signify that credential was not set.
    ModelCredential() (base.StoredCredential, bool, error)

    // WatchCredential gets cloud credential watcher.
    WatchCredential(string) (watcher.NotifyWatcher, error)

    // WatchModelCredential gets model's cloud credential watcher.
    WatchModelCredential() (watcher.NotifyWatcher, error)
}

Facade exposes functionality required by a Worker to access and watch a cloud credential that a model uses.

func NewFacade Uses

func NewFacade(apiCaller base.APICaller) (Facade, error)

NewFacade creates a *credentialvalidator.Facade and returns it as a Facade.

type Logger Uses

type Logger interface {
    Debugf(string, ...interface{})
    Infof(string, ...interface{})
}

Logger represents the methods used by the worker to log details.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string

    NewFacade func(base.APICaller) (Facade, error)
    NewWorker func(Config) (worker.Worker, error)
    Logger    Logger
}

ManifoldConfig holds the dependencies and configuration for a Worker manifold.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

Package credentialvalidator imports 8 packages (graph) and is imported by 6 packages. Updated 2019-10-19. Refresh now. Tools for package owners.