Documentation ¶
Overview ¶
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 ¶
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") )
Functions ¶
func Match ¶
func Match(payload FullPayloadInfo, pattern string) bool
Match determines if the given payload matches the pattern.
func ParseID ¶
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 ¶
ValidateState verifies the state passed in is a valid okayState.
Types ¶
type FullPayloadInfo ¶
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 ¶
func Filter(payloads []FullPayloadInfo, predicates ...PayloadPredicate) []FullPayloadInfo
Filter applies the provided predicates to the payloads and returns only those that matched.
type Payload ¶
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.
type PayloadPredicate ¶
type PayloadPredicate func(FullPayloadInfo) bool
A PayloadPredicate determines if the given payload matches the condition the predicate represents.
func BuildPredicatesFor ¶
func BuildPredicatesFor(patterns []string) ([]PayloadPredicate, error)
BuildPredicatesFor converts the provided patterns into predicates that may be passed to Filter.
type Result ¶
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.