Documentation ¶
Overview ¶
Package choria_utilclient is an API client to the Choria Choria_util agent Version 0.29.1.
Actions:
- Info - Choria related information from the running Daemon and Middleware
- MachineState - Retrieves the current state of a specific Choria Autonomous Agent
- MachineStates - States of the hosted Choria Autonomous Agents
- MachineTransition - Attempts to force a transition in a hosted Choria Autonomous Agent
Index ¶
- Constants
- func DDL() (*agent.DDL, error)
- func DDLBytes() ([]byte, error)
- type BroadcastNS
- type ChoriaUtilClient
- func (p *ChoriaUtilClient) AgentMetadata() *Metadata
- func (p *ChoriaUtilClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
- func (p *ChoriaUtilClient) Info() *InfoRequester
- func (p *ChoriaUtilClient) MachineState() *MachineStateRequester
- func (p *ChoriaUtilClient) MachineStates() *MachineStatesRequester
- func (p *ChoriaUtilClient) MachineTransition(inputTransition string) *MachineTransitionRequester
- func (p *ChoriaUtilClient) OptionAgentFilter(a ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionClassFilter(f ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionCollective(c string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionCombinedFilter(f ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionCompoundFilter(f ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionDiscoveryTimeout(t time.Duration) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionExprFilter(f string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionFactFilter(f ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionIdentityFilter(f ...string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionInBatches(size int, sleep int) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionLimitMethod(m string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionLimitSeed(s int64) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionLimitSize(s string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionReplyTo(t string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionReset() *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionTargets(t []string) *ChoriaUtilClient
- func (p *ChoriaUtilClient) OptionWorkers(w int) *ChoriaUtilClient
- type DisplayMode
- type ExternalNS
- type FilterFunc
- type InfoOutput
- func (d *InfoOutput) ChoriaVersion() string
- func (d *InfoOutput) ClientFlavour() string
- func (d *InfoOutput) ClientOptions() map[string]any
- func (d *InfoOutput) ClientStats() map[string]any
- func (d *InfoOutput) ClientVersion() string
- func (d *InfoOutput) ConnectedServer() string
- func (d *InfoOutput) Connector() string
- func (d *InfoOutput) ConnectorTls() bool
- func (d *InfoOutput) FacterCommand() string
- func (d *InfoOutput) FacterDomain() string
- func (d *InfoOutput) HashMap() map[string]any
- func (d *InfoOutput) JSON() ([]byte, error)
- func (d *InfoOutput) MiddlewareServers() []any
- func (d *InfoOutput) ParseInfoOutput(target any) error
- func (d *InfoOutput) Path() string
- func (d *InfoOutput) ResultDetails() *ResultDetails
- func (d *InfoOutput) SecureProtocol() bool
- func (d *InfoOutput) Security() string
- func (d *InfoOutput) SrvDomain() string
- func (d *InfoOutput) UsingSrv() bool
- type InfoRequester
- type InfoResult
- type InitializationOption
- type Log
- type MachineStateOutput
- func (d *MachineStateOutput) AvailableTransitions() []any
- func (d *MachineStateOutput) CurrentState() any
- func (d *MachineStateOutput) HashMap() map[string]any
- func (d *MachineStateOutput) Id() string
- func (d *MachineStateOutput) JSON() ([]byte, error)
- func (d *MachineStateOutput) Name() string
- func (d *MachineStateOutput) ParseMachineStateOutput(target any) error
- func (d *MachineStateOutput) Path() string
- func (d *MachineStateOutput) ResultDetails() *ResultDetails
- func (d *MachineStateOutput) Scout() bool
- func (d *MachineStateOutput) StartTime() string
- func (d *MachineStateOutput) State() string
- func (d *MachineStateOutput) Version() string
- type MachineStateRequester
- type MachineStateResult
- func (d *MachineStateResult) AllOutputs() []*MachineStateOutput
- func (d *MachineStateResult) EachOutput(h func(r *MachineStateOutput))
- func (d *MachineStateResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, ...) error
- func (d *MachineStateResult) Stats() Stats
- type MachineStatesOutput
- func (d *MachineStatesOutput) HashMap() map[string]any
- func (d *MachineStatesOutput) JSON() ([]byte, error)
- func (d *MachineStatesOutput) MachineIds() []any
- func (d *MachineStatesOutput) MachineNames() []any
- func (d *MachineStatesOutput) ParseMachineStatesOutput(target any) error
- func (d *MachineStatesOutput) ResultDetails() *ResultDetails
- func (d *MachineStatesOutput) States() map[string]any
- type MachineStatesRequester
- type MachineStatesResult
- func (d *MachineStatesResult) AllOutputs() []*MachineStatesOutput
- func (d *MachineStatesResult) EachOutput(h func(r *MachineStatesOutput))
- func (d *MachineStatesResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, ...) error
- func (d *MachineStatesResult) Stats() Stats
- type MachineTransitionOutput
- func (d *MachineTransitionOutput) HashMap() map[string]any
- func (d *MachineTransitionOutput) JSON() ([]byte, error)
- func (d *MachineTransitionOutput) ParseMachineTransitionOutput(target any) error
- func (d *MachineTransitionOutput) ResultDetails() *ResultDetails
- func (d *MachineTransitionOutput) Success() bool
- type MachineTransitionRequester
- func (d *MachineTransitionRequester) Do(ctx context.Context) (*MachineTransitionResult, error)
- func (d *MachineTransitionRequester) Instance(v string) *MachineTransitionRequester
- func (d *MachineTransitionRequester) Name(v string) *MachineTransitionRequester
- func (d *MachineTransitionRequester) Path(v string) *MachineTransitionRequester
- func (d *MachineTransitionRequester) Version(v string) *MachineTransitionRequester
- type MachineTransitionResult
- func (d *MachineTransitionResult) AllOutputs() []*MachineTransitionOutput
- func (d *MachineTransitionResult) EachOutput(h func(r *MachineTransitionOutput))
- func (d *MachineTransitionResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, ...) error
- func (d *MachineTransitionResult) Stats() Stats
- type MetaNS
- type Metadata
- type NodeSource
- type PuppetDBNS
- type RenderFormat
- type ResultDetails
- type Stats
- type StatusCode
Constants ¶
const ( // DisplayDDL shows results based on the configuration in the DDL file DisplayDDL = DisplayMode(iota) // DisplayOK shows only passing results DisplayOK // DisplayFailed shows only failed results DisplayFailed // DisplayAll shows all results DisplayAll // DisplayNone shows no results DisplayNone )
const ( // OK is the reply status when all worked OK = StatusCode(iota) // Aborted is status for when the action could not run, most failures in an action should set this Aborted // UnknownAction is the status for unknown actions requested UnknownAction // MissingData is the status for missing input data MissingData // InvalidData is the status for invalid input data InvalidData // UnknownError is the status general failures in agents should set when things go bad UnknownError )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BroadcastNS ¶
BroadcastNS is a NodeSource that uses the Choria network broadcast method to discover nodes
func (*BroadcastNS) Discover ¶
func (b *BroadcastNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type ChoriaUtilClient ¶
ChoriaUtilClient to the choria_util agent
func Must ¶
func Must(fw inter.Framework, opts ...InitializationOption) (client *ChoriaUtilClient)
Must create a new client and panics on error
func New ¶
func New(fw inter.Framework, opts ...InitializationOption) (client *ChoriaUtilClient, err error)
New creates a new client to the choria_util agent
func (*ChoriaUtilClient) AgentMetadata ¶
func (p *ChoriaUtilClient) AgentMetadata() *Metadata
AgentMetadata is the agent metadata this client supports
func (*ChoriaUtilClient) DiscoverNodes ¶
func (p *ChoriaUtilClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
DiscoverNodes performs a discovery using the configured filter and node source
func (*ChoriaUtilClient) Info ¶
func (p *ChoriaUtilClient) Info() *InfoRequester
Info performs the info action
Description: Choria related information from the running Daemon and Middleware
func (*ChoriaUtilClient) MachineState ¶ added in v0.21.0
func (p *ChoriaUtilClient) MachineState() *MachineStateRequester
MachineState performs the machine_state action
Description: Retrieves the current state of a specific Choria Autonomous Agent
Optional Inputs:
- instance (string) - Machine Instance ID
- name (string) - Machine Name
- path (string) - Machine Path
func (*ChoriaUtilClient) MachineStates ¶
func (p *ChoriaUtilClient) MachineStates() *MachineStatesRequester
MachineStates performs the machine_states action
Description: States of the hosted Choria Autonomous Agents
func (*ChoriaUtilClient) MachineTransition ¶
func (p *ChoriaUtilClient) MachineTransition(inputTransition string) *MachineTransitionRequester
MachineTransition performs the machine_transition action
Description: Attempts to force a transition in a hosted Choria Autonomous Agent
Required Inputs:
- transition (string) - The transition event to send to the machine
Optional Inputs:
- instance (string) - Machine Instance ID
- name (string) - Machine Name
- path (string) - Machine Path
- version (string) - Machine Version
func (*ChoriaUtilClient) OptionAgentFilter ¶
func (p *ChoriaUtilClient) OptionAgentFilter(a ...string) *ChoriaUtilClient
OptionAgentFilter adds an agent filter
func (*ChoriaUtilClient) OptionClassFilter ¶
func (p *ChoriaUtilClient) OptionClassFilter(f ...string) *ChoriaUtilClient
OptionClassFilter adds a class filter
func (*ChoriaUtilClient) OptionCollective ¶
func (p *ChoriaUtilClient) OptionCollective(c string) *ChoriaUtilClient
OptionCollective sets the collective to target
func (*ChoriaUtilClient) OptionCombinedFilter ¶
func (p *ChoriaUtilClient) OptionCombinedFilter(f ...string) *ChoriaUtilClient
OptionCombinedFilter adds a combined filter
func (*ChoriaUtilClient) OptionCompoundFilter ¶
func (p *ChoriaUtilClient) OptionCompoundFilter(f ...string) *ChoriaUtilClient
OptionCompoundFilter adds a compound filter
func (*ChoriaUtilClient) OptionDiscoveryTimeout ¶
func (p *ChoriaUtilClient) OptionDiscoveryTimeout(t time.Duration) *ChoriaUtilClient
OptionDiscoveryTimeout configures the request discovery timeout, defaults to configured discovery timeout
func (*ChoriaUtilClient) OptionExprFilter ¶
func (p *ChoriaUtilClient) OptionExprFilter(f string) *ChoriaUtilClient
OptionExprFilter sets a filter expression that will remove results from the result set
func (*ChoriaUtilClient) OptionFactFilter ¶
func (p *ChoriaUtilClient) OptionFactFilter(f ...string) *ChoriaUtilClient
OptionFactFilter adds a fact filter
func (*ChoriaUtilClient) OptionIdentityFilter ¶
func (p *ChoriaUtilClient) OptionIdentityFilter(f ...string) *ChoriaUtilClient
OptionIdentityFilter adds an identity filter
func (*ChoriaUtilClient) OptionInBatches ¶
func (p *ChoriaUtilClient) OptionInBatches(size int, sleep int) *ChoriaUtilClient
OptionInBatches performs requests in batches
func (*ChoriaUtilClient) OptionLimitMethod ¶
func (p *ChoriaUtilClient) OptionLimitMethod(m string) *ChoriaUtilClient
OptionLimitMethod configures the method to use when limiting targets - "random" or "first"
func (*ChoriaUtilClient) OptionLimitSeed ¶
func (p *ChoriaUtilClient) OptionLimitSeed(s int64) *ChoriaUtilClient
OptionLimitSeed sets the random seed used to select targets when limiting and limit method is "random"
func (*ChoriaUtilClient) OptionLimitSize ¶
func (p *ChoriaUtilClient) OptionLimitSize(s string) *ChoriaUtilClient
OptionLimitSize sets limits on the targets, either a number of a percentage like "10%"
func (*ChoriaUtilClient) OptionReplyTo ¶ added in v0.23.0
func (p *ChoriaUtilClient) OptionReplyTo(t string) *ChoriaUtilClient
OptionReplyTo sets a custom reply target
func (*ChoriaUtilClient) OptionReset ¶
func (p *ChoriaUtilClient) OptionReset() *ChoriaUtilClient
OptionReset resets the client options to use across requests to an empty list
func (*ChoriaUtilClient) OptionTargets ¶
func (p *ChoriaUtilClient) OptionTargets(t []string) *ChoriaUtilClient
OptionTargets sets specific node targets which would avoid discovery for all action calls until reset
func (*ChoriaUtilClient) OptionWorkers ¶
func (p *ChoriaUtilClient) OptionWorkers(w int) *ChoriaUtilClient
OptionWorkers sets how many worker connections should be started to the broker
type ExternalNS ¶ added in v0.20.0
ExternalNS is a NodeSource that calls an external command for discovery
func (*ExternalNS) Discover ¶ added in v0.20.0
func (p *ExternalNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
func (*ExternalNS) Reset ¶ added in v0.20.0
func (p *ExternalNS) Reset()
Reset resets the internal node cache
type FilterFunc ¶
FilterFunc can generate a Choria filter
type InfoOutput ¶
type InfoOutput struct {
// contains filtered or unexported fields
}
InfoOutput is the output from the info action
func (*InfoOutput) ChoriaVersion ¶
func (d *InfoOutput) ChoriaVersion() string
ChoriaVersion is the value of the choria_version output
Description: Choria version
func (*InfoOutput) ClientFlavour ¶
func (d *InfoOutput) ClientFlavour() string
ClientFlavour is the value of the client_flavour output
Description: Middleware client library flavour
func (*InfoOutput) ClientOptions ¶
func (d *InfoOutput) ClientOptions() map[string]any
ClientOptions is the value of the client_options output
Description: Active Middleware client options
func (*InfoOutput) ClientStats ¶
func (d *InfoOutput) ClientStats() map[string]any
ClientStats is the value of the client_stats output
Description: Middleware client statistics
func (*InfoOutput) ClientVersion ¶
func (d *InfoOutput) ClientVersion() string
ClientVersion is the value of the client_version output
Description: Middleware client library version
func (*InfoOutput) ConnectedServer ¶
func (d *InfoOutput) ConnectedServer() string
ConnectedServer is the value of the connected_server output
Description: Connected middleware server
func (*InfoOutput) Connector ¶
func (d *InfoOutput) Connector() string
Connector is the value of the connector output
Description: Connector plugin
func (*InfoOutput) ConnectorTls ¶
func (d *InfoOutput) ConnectorTls() bool
ConnectorTls is the value of the connector_tls output
Description: If the connector is running with TLS security enabled
func (*InfoOutput) FacterCommand ¶
func (d *InfoOutput) FacterCommand() string
FacterCommand is the value of the facter_command output
Description: Command used for Facter
func (*InfoOutput) FacterDomain ¶
func (d *InfoOutput) FacterDomain() string
FacterDomain is the value of the facter_domain output
Description: Facter domain
func (*InfoOutput) HashMap ¶
func (d *InfoOutput) HashMap() map[string]any
HashMap is the raw output data
func (*InfoOutput) JSON ¶
func (d *InfoOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*InfoOutput) MiddlewareServers ¶
func (d *InfoOutput) MiddlewareServers() []any
MiddlewareServers is the value of the middleware_servers output
Description: Middleware Servers configured or discovered
func (*InfoOutput) ParseInfoOutput ¶
func (d *InfoOutput) ParseInfoOutput(target any) error
ParseInfoOutput parses the result value from the Info action into target
func (*InfoOutput) Path ¶
func (d *InfoOutput) Path() string
Path is the value of the path output
Description: Active OS PATH
func (*InfoOutput) ResultDetails ¶
func (d *InfoOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*InfoOutput) SecureProtocol ¶
func (d *InfoOutput) SecureProtocol() bool
SecureProtocol is the value of the secure_protocol output
Description: If the protocol is running with PKI security enabled
func (*InfoOutput) Security ¶
func (d *InfoOutput) Security() string
Security is the value of the security output
Description: Security Provider plugin
func (*InfoOutput) SrvDomain ¶
func (d *InfoOutput) SrvDomain() string
SrvDomain is the value of the srv_domain output
Description: Configured SRV domain
func (*InfoOutput) UsingSrv ¶
func (d *InfoOutput) UsingSrv() bool
UsingSrv is the value of the using_srv output
Description: Indicates if SRV records are considered
type InfoRequester ¶
type InfoRequester struct {
// contains filtered or unexported fields
}
InfoRequester performs a RPC request to choria_util#info
func (*InfoRequester) Do ¶
func (d *InfoRequester) Do(ctx context.Context) (*InfoResult, error)
Do performs the request
type InfoResult ¶
type InfoResult struct {
// contains filtered or unexported fields
}
InfoResult is the result from a info action
func (*InfoResult) AllOutputs ¶ added in v0.26.0
func (d *InfoResult) AllOutputs() []*InfoOutput
AllOutputs provide access to all outputs
func (*InfoResult) EachOutput ¶
func (d *InfoResult) EachOutput(h func(r *InfoOutput))
EachOutput iterates over all results received
func (*InfoResult) RenderResults ¶
func (d *InfoResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
type InitializationOption ¶
type InitializationOption func(opts *initOptions)
InitializationOption is an optional setting used to initialize the client
func Discovery ¶
func Discovery(ns NodeSource) InitializationOption
Discovery sets the NodeSource to use when finding nodes to manage
func DiscoveryMethod ¶
func DiscoveryMethod(m string) InitializationOption
DiscoveryMethod accepts a discovery method name as supplied from the CLI and configures the correct NodeSource reverts to broadcast method if an unsupported method is supplied, custom node sources can be set using Discovery()
func DiscoveryTimeout ¶
func DiscoveryTimeout(t time.Duration) InitializationOption
DiscoveryTimeout sets a timeout for discovery for those methods that support it
func Logger ¶
func Logger(l *logrus.Entry) InitializationOption
Logger sets the logger to use else one is made via the Choria framework
type MachineStateOutput ¶ added in v0.21.0
type MachineStateOutput struct {
// contains filtered or unexported fields
}
MachineStateOutput is the output from the machine_state action
func (*MachineStateOutput) AvailableTransitions ¶ added in v0.21.0
func (d *MachineStateOutput) AvailableTransitions() []any
AvailableTransitions is the value of the available_transitions output
Description: The list of available transitions this autonomous agent can make
func (*MachineStateOutput) CurrentState ¶ added in v0.21.0
func (d *MachineStateOutput) CurrentState() any
CurrentState is the value of the current_state output
Description: The Choria Scout specific state for Scout checks
func (*MachineStateOutput) HashMap ¶ added in v0.21.0
func (d *MachineStateOutput) HashMap() map[string]any
HashMap is the raw output data
func (*MachineStateOutput) Id ¶ added in v0.21.0
func (d *MachineStateOutput) Id() string
Id is the value of the id output
Description: The unique running ID of the autonomous agent
func (*MachineStateOutput) JSON ¶ added in v0.21.0
func (d *MachineStateOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*MachineStateOutput) Name ¶ added in v0.21.0
func (d *MachineStateOutput) Name() string
Name is the value of the name output
Description: The name of the autonomous agent
func (*MachineStateOutput) ParseMachineStateOutput ¶ added in v0.21.0
func (d *MachineStateOutput) ParseMachineStateOutput(target any) error
ParseMachineStateOutput parses the result value from the MachineState action into target
func (*MachineStateOutput) Path ¶ added in v0.21.0
func (d *MachineStateOutput) Path() string
Path is the value of the path output
Description: The location on disk where the autonomous agent is stored
func (*MachineStateOutput) ResultDetails ¶ added in v0.21.0
func (d *MachineStateOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*MachineStateOutput) Scout ¶ added in v0.21.0
func (d *MachineStateOutput) Scout() bool
Scout is the value of the scout output
Description: True when this autonomous agent represents a Choria Scout Check
func (*MachineStateOutput) StartTime ¶ added in v0.21.0
func (d *MachineStateOutput) StartTime() string
StartTime is the value of the start_time output
Description: The time the autonomous agent was started in unix seconds
func (*MachineStateOutput) State ¶ added in v0.21.0
func (d *MachineStateOutput) State() string
State is the value of the state output
Description: The current state the agent is in
func (*MachineStateOutput) Version ¶ added in v0.21.0
func (d *MachineStateOutput) Version() string
Version is the value of the version output
Description: The version of the autonomous agent
type MachineStateRequester ¶ added in v0.21.0
type MachineStateRequester struct {
// contains filtered or unexported fields
}
MachineStateRequester performs a RPC request to choria_util#machine_state
func (*MachineStateRequester) Do ¶ added in v0.21.0
func (d *MachineStateRequester) Do(ctx context.Context) (*MachineStateResult, error)
Do performs the request
func (*MachineStateRequester) Instance ¶ added in v0.21.0
func (d *MachineStateRequester) Instance(v string) *MachineStateRequester
Instance is an optional input to the machine_state action
Description: Machine Instance ID
func (*MachineStateRequester) Name ¶ added in v0.21.0
func (d *MachineStateRequester) Name(v string) *MachineStateRequester
Name is an optional input to the machine_state action
Description: Machine Name
func (*MachineStateRequester) Path ¶ added in v0.21.0
func (d *MachineStateRequester) Path(v string) *MachineStateRequester
Path is an optional input to the machine_state action
Description: Machine Path
type MachineStateResult ¶ added in v0.21.0
type MachineStateResult struct {
// contains filtered or unexported fields
}
MachineStateResult is the result from a machine_state action
func (*MachineStateResult) AllOutputs ¶ added in v0.26.0
func (d *MachineStateResult) AllOutputs() []*MachineStateOutput
AllOutputs provide access to all outputs
func (*MachineStateResult) EachOutput ¶ added in v0.21.0
func (d *MachineStateResult) EachOutput(h func(r *MachineStateOutput))
EachOutput iterates over all results received
func (*MachineStateResult) RenderResults ¶ added in v0.21.0
func (d *MachineStateResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*MachineStateResult) Stats ¶ added in v0.21.0
func (d *MachineStateResult) Stats() Stats
Stats is the rpc request stats
type MachineStatesOutput ¶
type MachineStatesOutput struct {
// contains filtered or unexported fields
}
MachineStatesOutput is the output from the machine_states action
func (*MachineStatesOutput) HashMap ¶
func (d *MachineStatesOutput) HashMap() map[string]any
HashMap is the raw output data
func (*MachineStatesOutput) JSON ¶
func (d *MachineStatesOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*MachineStatesOutput) MachineIds ¶
func (d *MachineStatesOutput) MachineIds() []any
MachineIds is the value of the machine_ids output
Description: List of running machine IDs
func (*MachineStatesOutput) MachineNames ¶
func (d *MachineStatesOutput) MachineNames() []any
MachineNames is the value of the machine_names output
Description: List of running machine names
func (*MachineStatesOutput) ParseMachineStatesOutput ¶
func (d *MachineStatesOutput) ParseMachineStatesOutput(target any) error
ParseMachineStatesOutput parses the result value from the MachineStates action into target
func (*MachineStatesOutput) ResultDetails ¶
func (d *MachineStatesOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*MachineStatesOutput) States ¶
func (d *MachineStatesOutput) States() map[string]any
States is the value of the states output
Description: Hash map of machine statusses indexed by machine ID
type MachineStatesRequester ¶
type MachineStatesRequester struct {
// contains filtered or unexported fields
}
MachineStatesRequester performs a RPC request to choria_util#machine_states
func (*MachineStatesRequester) Do ¶
func (d *MachineStatesRequester) Do(ctx context.Context) (*MachineStatesResult, error)
Do performs the request
type MachineStatesResult ¶
type MachineStatesResult struct {
// contains filtered or unexported fields
}
MachineStatesResult is the result from a machine_states action
func (*MachineStatesResult) AllOutputs ¶ added in v0.26.0
func (d *MachineStatesResult) AllOutputs() []*MachineStatesOutput
AllOutputs provide access to all outputs
func (*MachineStatesResult) EachOutput ¶
func (d *MachineStatesResult) EachOutput(h func(r *MachineStatesOutput))
EachOutput iterates over all results received
func (*MachineStatesResult) RenderResults ¶
func (d *MachineStatesResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*MachineStatesResult) Stats ¶
func (d *MachineStatesResult) Stats() Stats
Stats is the rpc request stats
type MachineTransitionOutput ¶
type MachineTransitionOutput struct {
// contains filtered or unexported fields
}
MachineTransitionOutput is the output from the machine_transition action
func (*MachineTransitionOutput) HashMap ¶
func (d *MachineTransitionOutput) HashMap() map[string]any
HashMap is the raw output data
func (*MachineTransitionOutput) JSON ¶
func (d *MachineTransitionOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*MachineTransitionOutput) ParseMachineTransitionOutput ¶
func (d *MachineTransitionOutput) ParseMachineTransitionOutput(target any) error
ParseMachineTransitionOutput parses the result value from the MachineTransition action into target
func (*MachineTransitionOutput) ResultDetails ¶
func (d *MachineTransitionOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*MachineTransitionOutput) Success ¶
func (d *MachineTransitionOutput) Success() bool
Success is the value of the success output
Description: Indicates if the transition was successfully accepted
type MachineTransitionRequester ¶
type MachineTransitionRequester struct {
// contains filtered or unexported fields
}
MachineTransitionRequester performs a RPC request to choria_util#machine_transition
func (*MachineTransitionRequester) Do ¶
func (d *MachineTransitionRequester) Do(ctx context.Context) (*MachineTransitionResult, error)
Do performs the request
func (*MachineTransitionRequester) Instance ¶
func (d *MachineTransitionRequester) Instance(v string) *MachineTransitionRequester
Instance is an optional input to the machine_transition action
Description: Machine Instance ID
func (*MachineTransitionRequester) Name ¶
func (d *MachineTransitionRequester) Name(v string) *MachineTransitionRequester
Name is an optional input to the machine_transition action
Description: Machine Name
func (*MachineTransitionRequester) Path ¶
func (d *MachineTransitionRequester) Path(v string) *MachineTransitionRequester
Path is an optional input to the machine_transition action
Description: Machine Path
func (*MachineTransitionRequester) Version ¶
func (d *MachineTransitionRequester) Version(v string) *MachineTransitionRequester
Version is an optional input to the machine_transition action
Description: Machine Version
type MachineTransitionResult ¶
type MachineTransitionResult struct {
// contains filtered or unexported fields
}
MachineTransitionResult is the result from a machine_transition action
func (*MachineTransitionResult) AllOutputs ¶ added in v0.26.0
func (d *MachineTransitionResult) AllOutputs() []*MachineTransitionOutput
AllOutputs provide access to all outputs
func (*MachineTransitionResult) EachOutput ¶
func (d *MachineTransitionResult) EachOutput(h func(r *MachineTransitionOutput))
EachOutput iterates over all results received
func (*MachineTransitionResult) RenderResults ¶
func (d *MachineTransitionResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*MachineTransitionResult) Stats ¶
func (d *MachineTransitionResult) Stats() Stats
Stats is the rpc request stats
type MetaNS ¶ added in v0.20.0
type MetaNS struct { // Options is the CLI options to discover based on Options *discovery.StandardOptions // Agent should be the agent the request is targeted at Agent string // DisablePipedDiscovery prevents the STDIN being used as a discovery source DisablePipedDiscovery bool sync.Mutex // contains filtered or unexported fields }
MetaNS is a NodeSource that assists CLI tools in creating Choria standard command line based discovery.
func NewMetaNS ¶ added in v0.20.0
func NewMetaNS(opts *discovery.StandardOptions, enablePipeMode bool) *MetaNS
NewMetaNS creates a new meta discovery node source
type Metadata ¶
type Metadata struct { License string `json:"license"` Author string `json:"author"` Timeout int `json:"timeout"` Name string `json:"name"` Version string `json:"version"` URL string `json:"url"` Description string `json:"description"` }
Metadata is the agent metadata
type NodeSource ¶
type NodeSource interface { Reset() Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error) }
NodeSource discovers nodes
type PuppetDBNS ¶
PuppetDBNS is a NodeSource that uses the PuppetDB PQL Queries to discover nodes
func (*PuppetDBNS) Discover ¶
func (p *PuppetDBNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type RenderFormat ¶
type RenderFormat int
RenderFormat is the format used by the RenderResults helper
const ( // JSONFormat renders the results as a JSON document JSONFormat RenderFormat = iota // TextFormat renders the results as a Choria typical result set in line with choria req output TextFormat // TableFormat renders all successful responses in a table TableFormat TXTFooter )
type ResultDetails ¶
type ResultDetails struct {
// contains filtered or unexported fields
}
ResultDetails is the details about a result
func (*ResultDetails) OK ¶
func (d *ResultDetails) OK() bool
OK determines if the request was successful
func (*ResultDetails) Sender ¶
func (d *ResultDetails) Sender() string
Sender is the identity of the remote that produced the message
func (*ResultDetails) StatusCode ¶
func (d *ResultDetails) StatusCode() StatusCode
StatusCode is the status code produced by the remote
func (*ResultDetails) StatusMessage ¶
func (d *ResultDetails) StatusMessage() string
StatusMessage is the status message produced by the remote
type Stats ¶
type Stats interface { Agent() string Action() string All() bool NoResponseFrom() []string UnexpectedResponseFrom() []string DiscoveredCount() int DiscoveredNodes() *[]string FailCount() int OKCount() int ResponsesCount() int PublishDuration() (time.Duration, error) RequestDuration() (time.Duration, error) DiscoveryDuration() (time.Duration, error) OverrideDiscoveryTime(start time.Time, end time.Time) UniqueRequestID() string }
Stats are the statistics for a request
type StatusCode ¶
type StatusCode uint8
StatusCode is a reply status as defined by MCollective SimpleRPC - integers 0 to 5
See the constants OK, RPCAborted, UnknownRPCAction, MissingRPCData, InvalidRPCData and UnknownRPCError