Documentation ¶
Index ¶
- Variables
- func FormatActionResult(result params.ActionResult) map[string]interface{}
- func GetActionResult(api APIClient, requestedId string, wait *time.Timer) (params.ActionResult, error)
- func GetActionsByName(api APIClient, name string) ([]params.ActionResult, error)
- func NewListCommand() cmd.Command
- func NewRunCommand() cmd.Command
- func NewShowOutputCommand() cmd.Command
- func NewStatusCommand() cmd.Command
- type APIClient
- type ActionCommandBase
Constants ¶
This section is empty.
Variables ¶
var ActionNameRule = regexp.MustCompile("^[a-z](?:[a-z-]*[a-z])?$")
ActionNameRule describes the format an action name must match to be valid.
Functions ¶
func FormatActionResult ¶
func FormatActionResult(result params.ActionResult) map[string]interface{}
FormatActionResult removes empty values from the given ActionResult and inserts the remaining ones in a map[string]interface{} for cmd.Output to write in an easy-to-read format.
func GetActionResult ¶
func GetActionResult(api APIClient, requestedId string, wait *time.Timer) (params.ActionResult, error)
GetActionResult tries to repeatedly fetch an action until it is in a completed state and then it returns it. It waits for a maximum of "wait" before returning with the latest action status.
func GetActionsByName ¶
func GetActionsByName(api APIClient, name string) ([]params.ActionResult, error)
GetActionsByName takes an action APIClient and a name and returns a list of ActionResults.
func NewListCommand ¶
func NewRunCommand ¶
func NewShowOutputCommand ¶
func NewStatusCommand ¶
Types ¶
type APIClient ¶
type APIClient interface { io.Closer // Enqueue takes a list of Actions and queues them up to be executed by // the designated ActionReceiver, returning the params.Action for each // queued Action, or an error if there was a problem queueing up the // Action. Enqueue(params.Actions) (params.ActionResults, error) // ListAll takes a list of Tags representing ActionReceivers and returns // all of the Actions that have been queued or run by each of those // Entities. ListAll(params.Entities) (params.ActionsByReceivers, error) // ListPending takes a list of Tags representing ActionReceivers // and returns all of the Actions that are queued for each of those // Entities. ListPending(params.Entities) (params.ActionsByReceivers, error) // ListCompleted takes a list of Tags representing ActionReceivers // and returns all of the Actions that have been run on each of those // Entities. ListCompleted(params.Entities) (params.ActionsByReceivers, error) // Cancel attempts to cancel a queued up Action from running. Cancel(params.Actions) (params.ActionResults, error) // ApplicationCharmActions is a single query which uses ApplicationsCharmsActions to // get the charm.Actions for a single Service by tag. ApplicationCharmActions(params.Entity) (map[string]params.ActionSpec, error) // Actions fetches actions by tag. These Actions can be used to get // the ActionReceiver if necessary. Actions(params.Entities) (params.ActionResults, error) // FindActionTagsByPrefix takes a list of string prefixes and finds // corresponding ActionTags that match that prefix. FindActionTagsByPrefix(params.FindTags) (params.FindTagsResults, error) // FindActionsByNames takes a list of names and finds a corresponding list of // Actions for every name. FindActionsByNames(params.FindActionsByNames) (params.ActionsByNames, error) }
type APIClient represents the action API functionality.
type ActionCommandBase ¶
type ActionCommandBase struct {
modelcmd.ModelCommandBase
}
ActionCommandBase is the base type for action sub-commands.
func (*ActionCommandBase) NewActionAPIClient ¶
func (c *ActionCommandBase) NewActionAPIClient() (APIClient, error)
NewActionAPIClient returns a client for the action api endpoint.