rpcutilclient

package
Version: v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package rpcutilclient is an API client to the Choria Rpcutil agent Version 0.26.0.

Actions:

  • AgentInventory - Inventory of all agents on the server including versions, licenses and more
  • CollectiveInfo - Info about the main and sub collectives that the server belongs to
  • DaemonStats - Get statistics from the running daemon
  • GetConfigItem - Get the active value of a specific config property
  • GetData - Get data from a data plugin
  • GetFact - Retrieve a single fact from the fact store
  • GetFacts - Retrieve multiple facts from the fact store
  • Inventory - System Inventory
  • Ping - Responds to requests for PING with PONG

Index

Constants

View Source
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
)
View Source
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

func DDL

func DDL() (*agent.DDL, error)

DDL is a parsed and loaded DDL for the agent

func DDLBytes

func DDLBytes() ([]byte, error)

DDLBytes is the raw JSON encoded DDL file for the agent

Types

type AgentInventoryOutput

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

AgentInventoryOutput is the output from the agent_inventory action

func (*AgentInventoryOutput) Agents

func (d *AgentInventoryOutput) Agents() []interface{}

Agents is the value of the agents output

Description: List of agents on the server

func (*AgentInventoryOutput) HashMap

func (d *AgentInventoryOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*AgentInventoryOutput) JSON

func (d *AgentInventoryOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*AgentInventoryOutput) ParseAgentInventoryOutput

func (d *AgentInventoryOutput) ParseAgentInventoryOutput(target interface{}) error

ParseAgentInventoryOutput parses the result value from the AgentInventory action into target

func (*AgentInventoryOutput) ResultDetails

func (d *AgentInventoryOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

type AgentInventoryRequester

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

AgentInventoryRequester performs a RPC request to rpcutil#agent_inventory

func (*AgentInventoryRequester) Do

Do performs the request

type AgentInventoryResult

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

AgentInventoryResult is the result from a agent_inventory action

func (*AgentInventoryResult) AllOutputs added in v0.26.0

func (d *AgentInventoryResult) AllOutputs() []*AgentInventoryOutput

AllOutputs provide access to all outputs

func (*AgentInventoryResult) EachOutput

func (d *AgentInventoryResult) EachOutput(h func(r *AgentInventoryOutput))

EachOutput iterates over all results received

func (*AgentInventoryResult) RenderResults

func (d *AgentInventoryResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*AgentInventoryResult) Stats

func (d *AgentInventoryResult) Stats() Stats

Stats is the rpc request stats

type BroadcastNS

type BroadcastNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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

func (*BroadcastNS) Reset

func (b *BroadcastNS) Reset()

Reset resets the internal node cache

type CollectiveInfoOutput

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

CollectiveInfoOutput is the output from the collective_info action

func (*CollectiveInfoOutput) Collectives

func (d *CollectiveInfoOutput) Collectives() []interface{}

Collectives is the value of the collectives output

Description: All Collectives

func (*CollectiveInfoOutput) HashMap

func (d *CollectiveInfoOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*CollectiveInfoOutput) JSON

func (d *CollectiveInfoOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*CollectiveInfoOutput) MainCollective

func (d *CollectiveInfoOutput) MainCollective() string

MainCollective is the value of the main_collective output

Description: The main Collective

func (*CollectiveInfoOutput) ParseCollectiveInfoOutput

func (d *CollectiveInfoOutput) ParseCollectiveInfoOutput(target interface{}) error

ParseCollectiveInfoOutput parses the result value from the CollectiveInfo action into target

func (*CollectiveInfoOutput) ResultDetails

func (d *CollectiveInfoOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

type CollectiveInfoRequester

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

CollectiveInfoRequester performs a RPC request to rpcutil#collective_info

func (*CollectiveInfoRequester) Do

Do performs the request

type CollectiveInfoResult

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

CollectiveInfoResult is the result from a collective_info action

func (*CollectiveInfoResult) AllOutputs added in v0.26.0

func (d *CollectiveInfoResult) AllOutputs() []*CollectiveInfoOutput

AllOutputs provide access to all outputs

func (*CollectiveInfoResult) EachOutput

func (d *CollectiveInfoResult) EachOutput(h func(r *CollectiveInfoOutput))

EachOutput iterates over all results received

func (*CollectiveInfoResult) RenderResults

func (d *CollectiveInfoResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*CollectiveInfoResult) Stats

func (d *CollectiveInfoResult) Stats() Stats

Stats is the rpc request stats

type DaemonStatsOutput

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

DaemonStatsOutput is the output from the daemon_stats action

func (*DaemonStatsOutput) Agents

func (d *DaemonStatsOutput) Agents() []interface{}

Agents is the value of the agents output

Description: List of agents loaded

func (*DaemonStatsOutput) Configfile

func (d *DaemonStatsOutput) Configfile() string

Configfile is the value of the configfile output

Description: Config file used to start the daemon

func (*DaemonStatsOutput) Filtered

func (d *DaemonStatsOutput) Filtered() int64

Filtered is the value of the filtered output

Description: Count of message that didn't pass filter checks

func (*DaemonStatsOutput) HashMap

func (d *DaemonStatsOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*DaemonStatsOutput) JSON

func (d *DaemonStatsOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*DaemonStatsOutput) ParseDaemonStatsOutput

func (d *DaemonStatsOutput) ParseDaemonStatsOutput(target interface{}) error

ParseDaemonStatsOutput parses the result value from the DaemonStats action into target

func (*DaemonStatsOutput) Passed

func (d *DaemonStatsOutput) Passed() int64

Passed is the value of the passed output

Description: Count of messages that passed filter checks

func (*DaemonStatsOutput) Pid

func (d *DaemonStatsOutput) Pid() int64

Pid is the value of the pid output

Description: Process ID of the Choria Server

func (*DaemonStatsOutput) Replies

func (d *DaemonStatsOutput) Replies() int64

Replies is the value of the replies output

Description: Count of replies sent back to clients

func (*DaemonStatsOutput) ResultDetails

func (d *DaemonStatsOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

func (*DaemonStatsOutput) Starttime

func (d *DaemonStatsOutput) Starttime() int64

Starttime is the value of the starttime output

Description: Time the Choria Server started in unix seconds

func (*DaemonStatsOutput) Threads

func (d *DaemonStatsOutput) Threads() []interface{}

Threads is the value of the threads output

Description: List of threads active in the Choria Server

func (*DaemonStatsOutput) Times

func (d *DaemonStatsOutput) Times() map[string]interface{}

Times is the value of the times output

Description: Processor time consumed by the Choria Server

func (*DaemonStatsOutput) Total

func (d *DaemonStatsOutput) Total() int64

Total is the value of the total output

Description: Count of messages received by the Choria Server

func (*DaemonStatsOutput) Ttlexpired

func (d *DaemonStatsOutput) Ttlexpired() int64

Ttlexpired is the value of the ttlexpired output

Description: Count of messages that did pass TTL checks

func (*DaemonStatsOutput) Unvalidated

func (d *DaemonStatsOutput) Unvalidated() int64

Unvalidated is the value of the unvalidated output

Description: Count of messages that failed security validation

func (*DaemonStatsOutput) Validated

func (d *DaemonStatsOutput) Validated() int64

Validated is the value of the validated output

Description: Count of messages that passed security validation

func (*DaemonStatsOutput) Version

func (d *DaemonStatsOutput) Version() string

Version is the value of the version output

Description: Choria Server Version

type DaemonStatsRequester

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

DaemonStatsRequester performs a RPC request to rpcutil#daemon_stats

func (*DaemonStatsRequester) Do

Do performs the request

type DaemonStatsResult

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

DaemonStatsResult is the result from a daemon_stats action

func (*DaemonStatsResult) AllOutputs added in v0.26.0

func (d *DaemonStatsResult) AllOutputs() []*DaemonStatsOutput

AllOutputs provide access to all outputs

func (*DaemonStatsResult) EachOutput

func (d *DaemonStatsResult) EachOutput(h func(r *DaemonStatsOutput))

EachOutput iterates over all results received

func (*DaemonStatsResult) RenderResults

func (d *DaemonStatsResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*DaemonStatsResult) Stats

func (d *DaemonStatsResult) Stats() Stats

Stats is the rpc request stats

type DisplayMode

type DisplayMode uint8

DisplayMode overrides the DDL display hints

type ExternalNS added in v0.20.0

type ExternalNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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

type FilterFunc func(f *protocol.Filter) error

FilterFunc can generate a Choria filter

type GetConfigItemOutput

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

GetConfigItemOutput is the output from the get_config_item action

func (*GetConfigItemOutput) HashMap

func (d *GetConfigItemOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*GetConfigItemOutput) Item

func (d *GetConfigItemOutput) Item() string

Item is the value of the item output

Description: The config property being retrieved

func (*GetConfigItemOutput) JSON

func (d *GetConfigItemOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*GetConfigItemOutput) ParseGetConfigItemOutput

func (d *GetConfigItemOutput) ParseGetConfigItemOutput(target interface{}) error

ParseGetConfigItemOutput parses the result value from the GetConfigItem action into target

func (*GetConfigItemOutput) ResultDetails

func (d *GetConfigItemOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

func (*GetConfigItemOutput) Value

func (d *GetConfigItemOutput) Value() interface{}

Value is the value of the value output

Description: The value that is in use

type GetConfigItemRequester

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

GetConfigItemRequester performs a RPC request to rpcutil#get_config_item

func (*GetConfigItemRequester) Do

Do performs the request

type GetConfigItemResult

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

GetConfigItemResult is the result from a get_config_item action

func (*GetConfigItemResult) AllOutputs added in v0.26.0

func (d *GetConfigItemResult) AllOutputs() []*GetConfigItemOutput

AllOutputs provide access to all outputs

func (*GetConfigItemResult) EachOutput

func (d *GetConfigItemResult) EachOutput(h func(r *GetConfigItemOutput))

EachOutput iterates over all results received

func (*GetConfigItemResult) RenderResults

func (d *GetConfigItemResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*GetConfigItemResult) Stats

func (d *GetConfigItemResult) Stats() Stats

Stats is the rpc request stats

type GetDataOutput

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

GetDataOutput is the output from the get_data action

func (*GetDataOutput) HashMap

func (d *GetDataOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*GetDataOutput) JSON

func (d *GetDataOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*GetDataOutput) ParseGetDataOutput

func (d *GetDataOutput) ParseGetDataOutput(target interface{}) error

ParseGetDataOutput parses the result value from the GetData action into target

func (*GetDataOutput) ResultDetails

func (d *GetDataOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

type GetDataRequester

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

GetDataRequester performs a RPC request to rpcutil#get_data

func (*GetDataRequester) Do

Do performs the request

func (*GetDataRequester) Query

Query is an optional input to the get_data action

Description: The query argument to supply to the data plugin

type GetDataResult

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

GetDataResult is the result from a get_data action

func (*GetDataResult) AllOutputs added in v0.26.0

func (d *GetDataResult) AllOutputs() []*GetDataOutput

AllOutputs provide access to all outputs

func (*GetDataResult) EachOutput

func (d *GetDataResult) EachOutput(h func(r *GetDataOutput))

EachOutput iterates over all results received

func (*GetDataResult) RenderResults

func (d *GetDataResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*GetDataResult) Stats

func (d *GetDataResult) Stats() Stats

Stats is the rpc request stats

type GetFactOutput

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

GetFactOutput is the output from the get_fact action

func (*GetFactOutput) Fact

func (d *GetFactOutput) Fact() string

Fact is the value of the fact output

Description: The name of the fact being returned

func (*GetFactOutput) HashMap

func (d *GetFactOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*GetFactOutput) JSON

func (d *GetFactOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*GetFactOutput) ParseGetFactOutput

func (d *GetFactOutput) ParseGetFactOutput(target interface{}) error

ParseGetFactOutput parses the result value from the GetFact action into target

func (*GetFactOutput) ResultDetails

func (d *GetFactOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

func (*GetFactOutput) Value

func (d *GetFactOutput) Value() interface{}

Value is the value of the value output

Description: The value of the fact

type GetFactRequester

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

GetFactRequester performs a RPC request to rpcutil#get_fact

func (*GetFactRequester) Do

Do performs the request

type GetFactResult

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

GetFactResult is the result from a get_fact action

func (*GetFactResult) AllOutputs added in v0.26.0

func (d *GetFactResult) AllOutputs() []*GetFactOutput

AllOutputs provide access to all outputs

func (*GetFactResult) EachOutput

func (d *GetFactResult) EachOutput(h func(r *GetFactOutput))

EachOutput iterates over all results received

func (*GetFactResult) RenderResults

func (d *GetFactResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*GetFactResult) Stats

func (d *GetFactResult) Stats() Stats

Stats is the rpc request stats

type GetFactsOutput

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

GetFactsOutput is the output from the get_facts action

func (*GetFactsOutput) HashMap

func (d *GetFactsOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*GetFactsOutput) JSON

func (d *GetFactsOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*GetFactsOutput) ParseGetFactsOutput

func (d *GetFactsOutput) ParseGetFactsOutput(target interface{}) error

ParseGetFactsOutput parses the result value from the GetFacts action into target

func (*GetFactsOutput) ResultDetails

func (d *GetFactsOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

func (*GetFactsOutput) Values

func (d *GetFactsOutput) Values() map[string]interface{}

Values is the value of the values output

Description: List of values of the facts

type GetFactsRequester

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

GetFactsRequester performs a RPC request to rpcutil#get_facts

func (*GetFactsRequester) Do

Do performs the request

type GetFactsResult

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

GetFactsResult is the result from a get_facts action

func (*GetFactsResult) AllOutputs added in v0.26.0

func (d *GetFactsResult) AllOutputs() []*GetFactsOutput

AllOutputs provide access to all outputs

func (*GetFactsResult) EachOutput

func (d *GetFactsResult) EachOutput(h func(r *GetFactsOutput))

EachOutput iterates over all results received

func (*GetFactsResult) RenderResults

func (d *GetFactsResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*GetFactsResult) Stats

func (d *GetFactsResult) Stats() Stats

Stats is the rpc request stats

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

Logger sets the logger to use else one is made via the Choria framework

func Progress

func Progress() InitializationOption

Progress enables displaying a progress bar

type InventoryOutput

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

InventoryOutput is the output from the inventory action

func (*InventoryOutput) Agents

func (d *InventoryOutput) Agents() []interface{}

Agents is the value of the agents output

Description: List of agent names

func (*InventoryOutput) Classes

func (d *InventoryOutput) Classes() []interface{}

Classes is the value of the classes output

Description: List of classes on the system

func (*InventoryOutput) Collectives

func (d *InventoryOutput) Collectives() []interface{}

Collectives is the value of the collectives output

Description: All Collectives

func (*InventoryOutput) DataPlugins

func (d *InventoryOutput) DataPlugins() []interface{}

DataPlugins is the value of the data_plugins output

Description: List of data plugin names

func (*InventoryOutput) Facts

func (d *InventoryOutput) Facts() map[string]interface{}

Facts is the value of the facts output

Description: List of facts and values

func (*InventoryOutput) HashMap

func (d *InventoryOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*InventoryOutput) JSON

func (d *InventoryOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*InventoryOutput) Machines

func (d *InventoryOutput) Machines() map[string]interface{}

Machines is the value of the machines output

Description: Autonomous Agents

func (*InventoryOutput) MainCollective

func (d *InventoryOutput) MainCollective() string

MainCollective is the value of the main_collective output

Description: The main Collective

func (*InventoryOutput) ParseInventoryOutput

func (d *InventoryOutput) ParseInventoryOutput(target interface{}) error

ParseInventoryOutput parses the result value from the Inventory action into target

func (*InventoryOutput) ResultDetails

func (d *InventoryOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

func (*InventoryOutput) Version

func (d *InventoryOutput) Version() string

Version is the value of the version output

Description: Choria Server Version

type InventoryRequester

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

InventoryRequester performs a RPC request to rpcutil#inventory

func (*InventoryRequester) Do

Do performs the request

type InventoryResult

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

InventoryResult is the result from a inventory action

func (*InventoryResult) AllOutputs added in v0.26.0

func (d *InventoryResult) AllOutputs() []*InventoryOutput

AllOutputs provide access to all outputs

func (*InventoryResult) EachOutput

func (d *InventoryResult) EachOutput(h func(r *InventoryOutput))

EachOutput iterates over all results received

func (*InventoryResult) RenderResults

func (d *InventoryResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*InventoryResult) Stats

func (d *InventoryResult) Stats() Stats

Stats is the rpc request stats

type Log

type Log interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
}

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

func (*MetaNS) Discover added in v0.20.0

func (p *MetaNS) Discover(ctx context.Context, fw inter.Framework, _ []FilterFunc) ([]string, error)

Discover performs the discovery of nodes against the Choria Network.

func (*MetaNS) Reset added in v0.20.0

func (p *MetaNS) Reset()

Reset resets the internal node cache

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 PingOutput

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

PingOutput is the output from the ping action

func (*PingOutput) HashMap

func (d *PingOutput) HashMap() map[string]interface{}

HashMap is the raw output data

func (*PingOutput) JSON

func (d *PingOutput) JSON() ([]byte, error)

JSON is the JSON representation of the output data

func (*PingOutput) ParsePingOutput

func (d *PingOutput) ParsePingOutput(target interface{}) error

ParsePingOutput parses the result value from the Ping action into target

func (*PingOutput) Pong

func (d *PingOutput) Pong() float64

Pong is the value of the pong output

Description: The local Unix timestamp

func (*PingOutput) ResultDetails

func (d *PingOutput) ResultDetails() *ResultDetails

ResultDetails is the details about the request

type PingRequester

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

PingRequester performs a RPC request to rpcutil#ping

func (*PingRequester) Do

func (d *PingRequester) Do(ctx context.Context) (*PingResult, error)

Do performs the request

type PingResult

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

PingResult is the result from a ping action

func (*PingResult) AllOutputs added in v0.26.0

func (d *PingResult) AllOutputs() []*PingOutput

AllOutputs provide access to all outputs

func (*PingResult) EachOutput

func (d *PingResult) EachOutput(h func(r *PingOutput))

EachOutput iterates over all results received

func (*PingResult) RenderResults

func (d *PingResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error

func (*PingResult) Stats

func (d *PingResult) Stats() Stats

Stats is the rpc request stats

type PuppetDBNS

type PuppetDBNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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

func (*PuppetDBNS) Reset

func (p *PuppetDBNS) Reset()

Reset resets the internal node cache

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 renders only the request summary statistics
	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 RpcutilClient

type RpcutilClient struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RpcutilClient to the rpcutil agent

func Must

func Must(fw inter.Framework, opts ...InitializationOption) (client *RpcutilClient)

Must create a new client and panics on error

func New

func New(fw inter.Framework, opts ...InitializationOption) (client *RpcutilClient, err error)

New creates a new client to the rpcutil agent

func (*RpcutilClient) AgentInventory

func (p *RpcutilClient) AgentInventory() *AgentInventoryRequester

AgentInventory performs the agent_inventory action

Description: Inventory of all agents on the server including versions, licenses and more

func (*RpcutilClient) AgentMetadata

func (p *RpcutilClient) AgentMetadata() *Metadata

AgentMetadata is the agent metadata this client supports

func (*RpcutilClient) CollectiveInfo

func (p *RpcutilClient) CollectiveInfo() *CollectiveInfoRequester

CollectiveInfo performs the collective_info action

Description: Info about the main and sub collectives that the server belongs to

func (*RpcutilClient) DaemonStats

func (p *RpcutilClient) DaemonStats() *DaemonStatsRequester

DaemonStats performs the daemon_stats action

Description: Get statistics from the running daemon

func (*RpcutilClient) DiscoverNodes

func (p *RpcutilClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)

DiscoverNodes performs a discovery using the configured filter and node source

func (*RpcutilClient) GetConfigItem

func (p *RpcutilClient) GetConfigItem(inputItem string) *GetConfigItemRequester

GetConfigItem performs the get_config_item action

Description: Get the active value of a specific config property

Required Inputs:

  • item (string) - The item to retrieve from the server

func (*RpcutilClient) GetData

func (p *RpcutilClient) GetData(inputSource string) *GetDataRequester

GetData performs the get_data action

Description: Get data from a data plugin

Required Inputs:

  • source (string) - The data plugin to retrieve information from

Optional Inputs:

  • query (string) - The query argument to supply to the data plugin

func (*RpcutilClient) GetFact

func (p *RpcutilClient) GetFact(inputFact string) *GetFactRequester

GetFact performs the get_fact action

Description: Retrieve a single fact from the fact store

Required Inputs:

  • fact (string) - The fact to retrieve

func (*RpcutilClient) GetFacts

func (p *RpcutilClient) GetFacts(inputFacts string) *GetFactsRequester

GetFacts performs the get_facts action

Description: Retrieve multiple facts from the fact store

Required Inputs:

  • facts (string) - Facts to retrieve

func (*RpcutilClient) Inventory

func (p *RpcutilClient) Inventory() *InventoryRequester

Inventory performs the inventory action

Description: System Inventory

func (*RpcutilClient) OptionAgentFilter

func (p *RpcutilClient) OptionAgentFilter(a ...string) *RpcutilClient

OptionAgentFilter adds an agent filter

func (*RpcutilClient) OptionClassFilter

func (p *RpcutilClient) OptionClassFilter(f ...string) *RpcutilClient

OptionClassFilter adds a class filter

func (*RpcutilClient) OptionCollective

func (p *RpcutilClient) OptionCollective(c string) *RpcutilClient

OptionCollective sets the collective to target

func (*RpcutilClient) OptionCombinedFilter

func (p *RpcutilClient) OptionCombinedFilter(f ...string) *RpcutilClient

OptionCombinedFilter adds a combined filter

func (*RpcutilClient) OptionCompoundFilter

func (p *RpcutilClient) OptionCompoundFilter(f ...string) *RpcutilClient

OptionCompoundFilter adds a compound filter

func (*RpcutilClient) OptionDiscoveryTimeout

func (p *RpcutilClient) OptionDiscoveryTimeout(t time.Duration) *RpcutilClient

OptionDiscoveryTimeout configures the request discovery timeout, defaults to configured discovery timeout

func (*RpcutilClient) OptionExprFilter

func (p *RpcutilClient) OptionExprFilter(f string) *RpcutilClient

OptionExprFilter sets a filter expression that will remove results from the result set

func (*RpcutilClient) OptionFactFilter

func (p *RpcutilClient) OptionFactFilter(f ...string) *RpcutilClient

OptionFactFilter adds a fact filter

func (*RpcutilClient) OptionIdentityFilter

func (p *RpcutilClient) OptionIdentityFilter(f ...string) *RpcutilClient

OptionIdentityFilter adds an identity filter

func (*RpcutilClient) OptionInBatches

func (p *RpcutilClient) OptionInBatches(size int, sleep int) *RpcutilClient

OptionInBatches performs requests in batches

func (*RpcutilClient) OptionLimitMethod

func (p *RpcutilClient) OptionLimitMethod(m string) *RpcutilClient

OptionLimitMethod configures the method to use when limiting targets - "random" or "first"

func (*RpcutilClient) OptionLimitSeed

func (p *RpcutilClient) OptionLimitSeed(s int64) *RpcutilClient

OptionLimitSeed sets the random seed used to select targets when limiting and limit method is "random"

func (*RpcutilClient) OptionLimitSize

func (p *RpcutilClient) OptionLimitSize(s string) *RpcutilClient

OptionLimitSize sets limits on the targets, either a number of a percentage like "10%"

func (*RpcutilClient) OptionReplyTo added in v0.23.0

func (p *RpcutilClient) OptionReplyTo(t string) *RpcutilClient

OptionReplyTo sets a custom reply target

func (*RpcutilClient) OptionReset

func (p *RpcutilClient) OptionReset() *RpcutilClient

OptionReset resets the client options to use across requests to an empty list

func (*RpcutilClient) OptionTargets

func (p *RpcutilClient) OptionTargets(t []string) *RpcutilClient

OptionTargets sets specific node targets which would avoid discovery for all action calls until reset

func (*RpcutilClient) OptionWorkers

func (p *RpcutilClient) OptionWorkers(w int) *RpcutilClient

OptionWorkers sets how many worker connections should be started to the broker

func (*RpcutilClient) Ping

func (p *RpcutilClient) Ping() *PingRequester

Ping performs the ping action

Description: Responds to requests for PING with PONG

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

Jump to

Keyboard shortcuts

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