payload

package
v0.0.0-...-4bd6544 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: AGPL-3.0 Imports: 6 Imported by: 0

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

View Source
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.

View Source
const ComponentName = "payloads"

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

View Source
const FacadeName = "Payloads"

FacadeName is the name of the api server facade.

Variables

View Source
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 BuildID

func BuildID(class, id string) string

BuildID composes an ID from a class and an ID.

func Match

func Match(payload FullPayloadInfo, pattern string) bool

Match determines if the given payload matches the pattern.

func ParseID

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

func ValidateState(state string) error

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.

func (Payload) FullID

func (p Payload) FullID() string

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

func (Payload) Validate

func (p Payload) Validate() error

Validate checks the payload info to ensure it is correct.

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.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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