juju: github.com/juju/juju/payload Index | Files | Directories

package payload

import "github.com/juju/juju/payload"

The payload package (and subpackages) contain the implementation of the charm payload feature component. The various pieces are connected to the Juju machinery in component/all/payload.go.

Index

Package Files

component.go errors.go filter.go id.go payload.go status.go

Constants

const (
    StateUndefined = ""
    //TODO(wwitzel3) remove defined throughout
    StateDefined  = "defined"
    StateStarting = "starting"
    StateRunning  = "running"
    StateStopping = "stopping"
    StateStopped  = "stopped"
)

The Juju-recognized states in which a payload might be.

const ComponentName = "payloads"

ComponentName is the name of the Juju component for payload management.

Variables

var (
    // ErrAlreadyExists indicates that a payload could not be added
    // because it was already added.
    ErrAlreadyExists = errors.AlreadyExistsf("payload")

    // ErrNotFound indicates that a requested payload has not been
    // added yet.
    ErrNotFound = errors.NotFoundf("payload")
)

func BuildID Uses

func BuildID(class, id string) string

BuildID composes an ID from a class and an ID.

func Match Uses

func Match(payload FullPayloadInfo, pattern string) bool

Match determines if the given payload matches the pattern.

func ParseID Uses

func ParseID(id string) (name, pluginID string)

ParseID extracts the payload name and details ID from the provided string. The format is expected to be name/pluginID. If no separator is found, the whole string is assumed to be the name.

func ValidateState Uses

func ValidateState(state string) error

ValidateState verifies the state passed in is a valid okayState.

type FullPayloadInfo Uses

type FullPayloadInfo struct {
    Payload

    // Machine identifies the Juju machine associated with the payload.
    Machine string
}

FullPayloadInfo completely describes a charm payload, including some information that may be implied from the minimal Payload data.

func Filter Uses

func Filter(payloads []FullPayloadInfo, predicates ...PayloadPredicate) []FullPayloadInfo

Filter applies the provided predicates to the payloads and returns only those that matched.

type Payload Uses

type Payload struct {
    charm.PayloadClass

    // ID is a unique string identifying the payload to
    // the underlying technology.
    ID  string

    // Status is the Juju-level status of the payload.
    Status string

    // Labels are labels associated with the payload.
    Labels []string

    // Unit identifies the Juju unit associated with the payload.
    Unit string
}

Payload holds information about a charm payload.

func (Payload) FullID Uses

func (p Payload) FullID() string

FullID composes a unique ID for the payload (relative to the unit/charm).

func (Payload) Validate Uses

func (p Payload) Validate() error

Validate checks the payload info to ensure it is correct.

type PayloadPredicate Uses

type PayloadPredicate func(FullPayloadInfo) bool

A PayloadPredicate determines if the given payload matches the condition the predicate represents.

func BuildPredicatesFor Uses

func BuildPredicatesFor(patterns []string) ([]PayloadPredicate, error)

BuildPredicatesFor converts the provided patterns into predicates that may be passed to Filter.

type Result Uses

type Result struct {
    // ID is the ID of the payload that this result applies to.
    ID  string
    // Payload holds the info about the payload, if available.
    Payload *FullPayloadInfo
    // NotFound indicates that the payload was not found in Juju.
    NotFound bool
    // Error is the error associated with this result (if any).
    Error error
}

Result is a struct that ties an error to a payload ID.

Directories

PathSynopsis
api
api/client
api/private
api/private/client
context
status

Package payload imports 6 packages (graph) and is imported by 219 packages. Updated 2019-08-24. Refresh now. Tools for package owners.