Documentation ¶
Index ¶
- Constants
- type APIClient
- type Component
- type Context
- func (c *Context) Flush() error
- func (c *Context) Get(class, id string) (*payload.Payload, error)
- func (c *Context) List() ([]string, error)
- func (c *Context) Payloads() ([]payload.Payload, error)
- func (c *Context) SetStatus(class, id, status string) error
- func (c *Context) Track(pl payload.Payload) error
- func (c *Context) Untrack(class, id string) error
- type HookContext
- type RegisterCmd
- type StatusSetCmd
- type UnregisterCmd
Constants ¶
const RegisterCmdName = "payload-register"
RegisterCmdName is the name of the payload register command.
const StatusSetCmdName = "payload-status-set"
StatusSetCmdName is the name of the payload status-set command.
const UnregisterCmdName = "payload-unregister"
UnregisterCmdName is the name of the payload unregister command.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface { // List requests the payload info for the given IDs. List(fullIDs ...string) ([]payload.Result, error) // Track sends a request to update state with the provided payloads. Track(payloads ...payload.Payload) ([]payload.Result, error) // Untrack removes the payloads from our list track. Untrack(fullIDs ...string) ([]payload.Result, error) // SetStatus sets the status for the given IDs. SetStatus(status string, fullIDs ...string) ([]payload.Result, error) }
APIClient represents the API needs of a Context.
type Component ¶
type Component interface { // Get returns the payload info corresponding to the given ID. Get(class, id string) (*payload.Payload, error) // Track records the payload info in the hook context. Track(payload payload.Payload) error // Untrack removes the payload from our list of payloads to track. Untrack(class, id string) error // SetStatus sets the status of the payload. SetStatus(class, id, status string) error // List returns the list of registered payload IDs. List() ([]string, error) // Flush pushes the hook context data out to state. Flush() error }
Component provides the hook context data specific to payloads.
func ContextComponent ¶
func ContextComponent(ctx HookContext) (Component, error)
ContextComponent returns the hook context for the payload payload component.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is the payload portion of the hook context.
func NewContext ¶
NewContext returns a new jujuc.ContextComponent for payloads.
func NewContextAPI ¶
NewContextAPI returns a new jujuc.ContextComponent for payloads.
func (*Context) Flush ¶
Flush implements jujuc.ContextComponent. In this case that means all added and updated payload.Payload in the hook context are pushed to Juju state via the API.
type HookContext ¶
type HookContext interface { // Component implements jujuc.Context. Component(string) (Component, error) }
HookContext is the portion of jujuc.Context used in this package.
type RegisterCmd ¶
type RegisterCmd struct { cmd.CommandBase // contains filtered or unexported fields }
RegisterCmd is a command that registers a payload with juju.
func NewRegisterCmd ¶
func NewRegisterCmd(ctx HookContext) (*RegisterCmd, error)
NewRegisterCmd returns a new RegisterCmd that wraps the given context.
func (*RegisterCmd) Init ¶
func (c *RegisterCmd) Init(args []string) error
Init implements cmd.Command.
type StatusSetCmd ¶
type StatusSetCmd struct { cmd.CommandBase // contains filtered or unexported fields }
StatusSetCmd is a command that registers a payload with juju.
func NewStatusSetCmd ¶
func NewStatusSetCmd(ctx HookContext) (*StatusSetCmd, error)
NewStatusSetCmd returns a new StatusSetCmd that wraps the given context.
func (*StatusSetCmd) Init ¶
func (c *StatusSetCmd) Init(args []string) error
Init implements cmd.Command.
type UnregisterCmd ¶
type UnregisterCmd struct { cmd.CommandBase // contains filtered or unexported fields }
UnregisterCmd implements the untrack command.
func NewUnregisterCmd ¶
func NewUnregisterCmd(ctx HookContext) (*UnregisterCmd, error)
NewUnregisterCmd returns a new UnregisterCmd that wraps the given context.
func (*UnregisterCmd) Init ¶
func (c *UnregisterCmd) Init(args []string) error
Init implements cmd.Command.