juju: github.com/wallyworld/juju/environs/context Index | Files

package context

import "github.com/wallyworld/juju/environs/context"

Index

Package Files

callcontext.go cloud.go distribution.go provider.go

type CloudCallContext Uses

type CloudCallContext struct {
    // InvalidateCredentialFunc is the actual callback function
    // that invalidates the credential used in the context of this call.
    InvalidateCredentialFunc func(string) error

    // DyingFunc returns the dying chan.
    DyingFunc Dying
}

CloudCallContext is a context intended to provide behaviors that are necessary to make a valid and lean call to an underlying substrate, for example cloud API.

For instance, when Juju makes a call to cloud API with an expired credential, we might not yet know that it is expired until cloud API rejects it. However, we do know in advance, before making the call, that we want to mark this credential as invalid if the cloud API rejects it. How credential will be found, where it is stored in Juju data model, what calls need to be done to mark it so, will be the responsibility of internal functions that are passed in to this context as this knowledge is specific to where the call was made *from* not on what object it was made.

func CallContext Uses

func CallContext(ctx ModelCredentialInvalidator) *CloudCallContext

CallContext creates a CloudCallContext for use when calling environ methods that may require invalidate a cloud credential.

func NewCloudCallContext Uses

func NewCloudCallContext() *CloudCallContext

NewCloudCallContext creates a new CloudCallContext to be used a ProviderCallContext.

func (*CloudCallContext) Dying Uses

func (c *CloudCallContext) Dying() <-chan struct{}

Dying returns the dying chan.

func (*CloudCallContext) InvalidateCredential Uses

func (c *CloudCallContext) InvalidateCredential(reason string) error

InvalidateCredential implements context.InvalidateCredentialCallback.

type Distributor Uses

type Distributor interface {
    // DistributeInstances takes a set of clean, empty instances,
    // a distribution group, and list of zones to limit the consideration to.
    // If the input zone collection has no elements, then all availability
    // zones are considered when attempting distribution.
    // It returns the subset of candidates that the policy will allow to enter
    // the distribution group.
    //
    // The AssignClean and AssignCleanEmpty unit assignment policies will
    // attempt to assign a unit to each of the resulting instances until one is
    // successful. If no instances can be assigned to (e.g. because of
    // concurrent deployments), then a new machine will be allocated.
    DistributeInstances(
        ctx ProviderCallContext, candidates, distributionGroup []instance.Id, limitZones []string,
    ) ([]instance.Id, error)
}

Distributor is an interface that may be used to distribute application units across instances for high availability.

type Dying Uses

type Dying func() <-chan struct{}

Dying returns the dying chan.

type ModelCredentialInvalidator Uses

type ModelCredentialInvalidator interface {

    // InvalidateModelCredential invalidate cloud credential for the model.
    InvalidateModelCredential(string) error
}

ModelCredentialInvalidator defines a point of use interface for invalidating a model credential.

type ProviderCallContext Uses

type ProviderCallContext interface {

    // InvalidateCredential provides means to invalidate a credential
    // that is used to make a call.
    InvalidateCredential(string) error

    // Dying returns the dying chan.
    Dying() <-chan struct{}
}

ProviderCallContext exposes useful capabilities when making calls to an underlying cloud substrate.

Package context imports 2 packages (graph). Updated 2020-08-11. Refresh now. Tools for package owners.