objectaction

package
v0.0.0-...-dea5896 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalFirst

func LocalFirst() funcopt.O

LocalFirst makes actions not explicitely Local nor remoted via NodeSelector be treated as local (CRM level).

func WithAsyncTarget

func WithAsyncTarget(s string) funcopt.O

WithAsyncTarget is the node or object state the daemons should orchestrate to reach.

func WithAsyncTargetOptions

func WithAsyncTargetOptions(o any) funcopt.O

WithAsyncTargetOptions is the options of the target defined by WithAsyncTarget.

func WithAsyncTime

func WithAsyncTime(d time.Duration) funcopt.O

WithAsyncTime is the maximum duration to wait for an async action It needs WithAsyncWait(true)

func WithAsyncWait

func WithAsyncWait(v bool) funcopt.O

WithAsyncWait runs an event-watcher waiting for target state, global expect return to none

func WithAsyncWatch

func WithAsyncWatch(v bool) funcopt.O

WithAsyncWatch runs a event-driven monitor on the selected objects after setting a new target. So the operator can see the orchestration unfolding.

func WithColor

func WithColor(s string) funcopt.O

WithColor activates the colorization of outputs auto => yes if os.Stdout is a tty yes no

func WithDefaultOutput

func WithDefaultOutput(s string) funcopt.O

func WithLocal

func WithLocal(v bool) funcopt.O

WithLocal routes the action to the CRM instead of remoting it via orchestration or remote execution.

func WithLocalFunc

func WithLocalFunc(f func(context.Context, naming.Path) (any, error)) funcopt.O

WithLocalFunc sets a function to run if the action is local

func WithObjectSelector

func WithObjectSelector(s string) funcopt.O

WithObjectSelector expands into a selection of objects to execute the action on.

func WithOutput

func WithOutput(s string) funcopt.O

WithOutput controls the output data format. <empty> => human readable format json => json machine readable format flat => flattened json (<k>=<v>) machine readable format flat_json => same as flat (backward compat)

func WithRID

func WithRID(s string) funcopt.O

WithRID expands into a selection of resources to execute the action on.

func WithRemoteFunc

func WithRemoteFunc(f func(context.Context, naming.Path, string) (any, error)) funcopt.O

WithRemoteFunc sets a function to run if the action is local

func WithRemoteNodes

func WithRemoteNodes(s string) funcopt.O

WithRemoteNodes expands into a selection of nodes to execute the action on.

func WithSubset

func WithSubset(s string) funcopt.O

WithSubset expands into a selection of resources to execute the action on.

func WithTag

func WithTag(s string) funcopt.O

WithTag expands into a selection of resources to execute the action on.

Types

type T

type T struct {
	actionrouter.T
	LocalFunc  func(context.Context, naming.Path) (any, error)
	RemoteFunc func(context.Context, naming.Path, string) (any, error)
}

T has the same attributes as Action, but the interface method implementation differ.

func New

func New(opts ...funcopt.O) *T

New allocates a new client configuration and returns the reference so users are not tempted to use client.Config{} dereferenced, which would make loadContext useless.

func (T) Do

func (t T) Do() error

func (T) DoAsync

func (t T) DoAsync() error

DoAsync uses the agent API to submit a target state to reach via an orchestration.

func (T) DoLocal

func (t T) DoLocal() error

func (T) DoRemote

func (t T) DoRemote() error

DoRemote posts the action to a peer node agent API, for synchronous execution.

func (T) HasLocal

func (t T) HasLocal() bool

func (T) Options

func (t T) Options() actionrouter.T

Options returns the base Action struct

Jump to

Keyboard shortcuts

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