machineactions

package
v0.0.0-...-0a271de Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package machineactions implements the API side of running actions on machines.

Index

Constants

This section is empty.

Variables

View Source
var WithTracer = base.WithTracer

WithTracer returns an Option that configures the Client to use the supplied tracer.

Functions

This section is empty.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action represents a single instance of an Action call, by name and params. TODO(bogdantelega): This is currently copied from uniter.Actions, but until the implementations converge, it's saner to duplicate the code since the "correct" abstraction over both is not obvious.

func NewAction

func NewAction(id, name string, params map[string]interface{}, parallel bool, executionGroup string) *Action

NewAction makes a new Action with specified id, name and params map.

func (*Action) ExecutionGroup

func (a *Action) ExecutionGroup() string

ExecutionGroup is the group of actions which cannot execute in parallel with each other.

func (*Action) ID

func (a *Action) ID() string

func (*Action) Name

func (a *Action) Name() string

Name retrieves the name of the Action.

func (*Action) Parallel

func (a *Action) Parallel() bool

Parallel returns true if the action can run without needed to acquire the machine lock.

func (*Action) Params

func (a *Action) Params() map[string]interface{}

Params retrieves the params map of the Action.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(caller base.APICaller, options ...Option) *Client

func (*Client) Action

func (c *Client) Action(ctx context.Context, tag names.ActionTag) (*Action, error)

Action returns the Action with the given tag.

func (*Client) ActionBegin

func (c *Client) ActionBegin(ctx context.Context, tag names.ActionTag) error

ActionBegin marks an action as running.

func (*Client) ActionFinish

func (c *Client) ActionFinish(ctx context.Context, tag names.ActionTag, status string, actionResults map[string]interface{}, message string) error

ActionFinish captures the structured output of an action.

func (*Client) RunningActions

func (c *Client) RunningActions(ctx context.Context, agent names.MachineTag) ([]params.ActionResult, error)

RunningActions returns a list of actions running for the given machine tag.

func (*Client) WatchActionNotifications

func (c *Client) WatchActionNotifications(ctx context.Context, agent names.MachineTag) (watcher.StringsWatcher, error)

WatchActionNotifications returns a StringsWatcher for observing the IDs of Actions added to the Machine. The initial event will contain the IDs of any Actions pending at the time the Watcher is made.

type Option

type Option = base.Option

Option is a function that can be used to configure a Client.

Jump to

Keyboard shortcuts

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