Documentation ¶
Overview ¶
Package rpcutilclient is an API client to the Choria Rpcutil agent Version 0.19.0.
Actions:
- AgentInventory - Inventory of all agents on the server
- CollectiveInfo - Info about the main and sub collectives
- 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
- func DDL() (*agent.DDL, error)
- func DDLBytes() ([]byte, error)
- type AgentInventoryOutput
- func (d *AgentInventoryOutput) Agents() interface{}
- func (d *AgentInventoryOutput) HashMap() map[string]interface{}
- func (d *AgentInventoryOutput) JSON() ([]byte, error)
- func (d *AgentInventoryOutput) ParseAgentInventoryOutput(target interface{}) error
- func (d *AgentInventoryOutput) ResultDetails() *ResultDetails
- type AgentInventoryRequester
- type AgentInventoryResult
- type BroadcastNS
- type ChoriaFramework
- type CollectiveInfoOutput
- func (d *CollectiveInfoOutput) Collectives() interface{}
- func (d *CollectiveInfoOutput) HashMap() map[string]interface{}
- func (d *CollectiveInfoOutput) JSON() ([]byte, error)
- func (d *CollectiveInfoOutput) MainCollective() interface{}
- func (d *CollectiveInfoOutput) ParseCollectiveInfoOutput(target interface{}) error
- func (d *CollectiveInfoOutput) ResultDetails() *ResultDetails
- type CollectiveInfoRequester
- type CollectiveInfoResult
- type DaemonStatsOutput
- func (d *DaemonStatsOutput) Agents() interface{}
- func (d *DaemonStatsOutput) Configfile() interface{}
- func (d *DaemonStatsOutput) Filtered() interface{}
- func (d *DaemonStatsOutput) HashMap() map[string]interface{}
- func (d *DaemonStatsOutput) JSON() ([]byte, error)
- func (d *DaemonStatsOutput) ParseDaemonStatsOutput(target interface{}) error
- func (d *DaemonStatsOutput) Passed() interface{}
- func (d *DaemonStatsOutput) Pid() interface{}
- func (d *DaemonStatsOutput) Replies() interface{}
- func (d *DaemonStatsOutput) ResultDetails() *ResultDetails
- func (d *DaemonStatsOutput) Starttime() interface{}
- func (d *DaemonStatsOutput) Threads() interface{}
- func (d *DaemonStatsOutput) Times() interface{}
- func (d *DaemonStatsOutput) Total() interface{}
- func (d *DaemonStatsOutput) Ttlexpired() interface{}
- func (d *DaemonStatsOutput) Unvalidated() interface{}
- func (d *DaemonStatsOutput) Validated() interface{}
- func (d *DaemonStatsOutput) Version() interface{}
- type DaemonStatsRequester
- type DaemonStatsResult
- type DisplayMode
- type FilterFunc
- type GetConfigItemOutput
- func (d *GetConfigItemOutput) HashMap() map[string]interface{}
- func (d *GetConfigItemOutput) Item() interface{}
- func (d *GetConfigItemOutput) JSON() ([]byte, error)
- func (d *GetConfigItemOutput) ParseGetConfigItemOutput(target interface{}) error
- func (d *GetConfigItemOutput) ResultDetails() *ResultDetails
- func (d *GetConfigItemOutput) Value() interface{}
- type GetConfigItemRequester
- type GetConfigItemResult
- type GetDataOutput
- type GetDataRequester
- type GetDataResult
- type GetFactOutput
- func (d *GetFactOutput) Fact() interface{}
- func (d *GetFactOutput) HashMap() map[string]interface{}
- func (d *GetFactOutput) JSON() ([]byte, error)
- func (d *GetFactOutput) ParseGetFactOutput(target interface{}) error
- func (d *GetFactOutput) ResultDetails() *ResultDetails
- func (d *GetFactOutput) Value() interface{}
- type GetFactRequester
- type GetFactResult
- type GetFactsOutput
- type GetFactsRequester
- type GetFactsResult
- type InitializationOption
- type InventoryOutput
- func (d *InventoryOutput) Agents() interface{}
- func (d *InventoryOutput) Classes() interface{}
- func (d *InventoryOutput) Collectives() interface{}
- func (d *InventoryOutput) DataPlugins() interface{}
- func (d *InventoryOutput) Facts() interface{}
- func (d *InventoryOutput) HashMap() map[string]interface{}
- func (d *InventoryOutput) JSON() ([]byte, error)
- func (d *InventoryOutput) Machines() interface{}
- func (d *InventoryOutput) MainCollective() interface{}
- func (d *InventoryOutput) ParseInventoryOutput(target interface{}) error
- func (d *InventoryOutput) ResultDetails() *ResultDetails
- func (d *InventoryOutput) Version() interface{}
- type InventoryRequester
- type InventoryResult
- type Log
- type Metadata
- type NodeSource
- type PingOutput
- type PingRequester
- type PingResult
- type PuppetDBNS
- type RenderFormat
- type ResultDetails
- type RpcutilClient
- func (p *RpcutilClient) AgentInventory() *AgentInventoryRequester
- func (p *RpcutilClient) AgentMetadata() *Metadata
- func (p *RpcutilClient) CollectiveInfo() *CollectiveInfoRequester
- func (p *RpcutilClient) DaemonStats() *DaemonStatsRequester
- func (p *RpcutilClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
- func (p *RpcutilClient) GetConfigItem(itemI string) *GetConfigItemRequester
- func (p *RpcutilClient) GetData(sourceI string) *GetDataRequester
- func (p *RpcutilClient) GetFact(factI string) *GetFactRequester
- func (p *RpcutilClient) GetFacts(factsI string) *GetFactsRequester
- func (p *RpcutilClient) Inventory() *InventoryRequester
- func (p *RpcutilClient) OptionAgentFilter(a ...string) *RpcutilClient
- func (p *RpcutilClient) OptionClassFilter(f ...string) *RpcutilClient
- func (p *RpcutilClient) OptionCollective(c string) *RpcutilClient
- func (p *RpcutilClient) OptionCombinedFilter(f ...string) *RpcutilClient
- func (p *RpcutilClient) OptionCompoundFilter(f ...string) *RpcutilClient
- func (p *RpcutilClient) OptionDiscoveryTimeout(t time.Duration) *RpcutilClient
- func (p *RpcutilClient) OptionExprFilter(f string) *RpcutilClient
- func (p *RpcutilClient) OptionFactFilter(f ...string) *RpcutilClient
- func (p *RpcutilClient) OptionIdentityFilter(f ...string) *RpcutilClient
- func (p *RpcutilClient) OptionInBatches(size int, sleep int) *RpcutilClient
- func (p *RpcutilClient) OptionLimitMethod(m string) *RpcutilClient
- func (p *RpcutilClient) OptionLimitSeed(s int64) *RpcutilClient
- func (p *RpcutilClient) OptionLimitSize(s string) *RpcutilClient
- func (p *RpcutilClient) OptionReset() *RpcutilClient
- func (p *RpcutilClient) OptionTargets(t []string) *RpcutilClient
- func (p *RpcutilClient) OptionWorkers(w int) *RpcutilClient
- func (p *RpcutilClient) Ping() *PingRequester
- 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 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
ParseOutput 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 ¶
func (d *AgentInventoryRequester) Do(ctx context.Context) (*AgentInventoryResult, error)
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) 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 ¶
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 ChoriaFramework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type ChoriaFramework ¶
type ChoriaFramework interface { Logger(string) *logrus.Entry SetLogger(*logrus.Logger) Configuration() *config.Config NewMessage(payload string, agent string, collective string, msgType string, request *choria.Message) (msg *choria.Message, err error) NewReplyFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Reply, err error) NewTransportFromJSON(data string) (message protocol.TransportMessage, err error) MiddlewareServers() (servers srvcache.Servers, err error) NewConnector(ctx context.Context, servers func() (srvcache.Servers, error), name string, logger *logrus.Entry) (conn choria.Connector, err error) NewRequestID() (string, error) Certname() string PQLQueryCertNames(query string) ([]string, error) Colorize(c string, format string, a ...interface{}) string }
ChoriaFramework is the Choria framework
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() interface{}
MainCollective is the value of the main_collective output
Description: The main Collective
func (*CollectiveInfoOutput) ParseCollectiveInfoOutput ¶
func (d *CollectiveInfoOutput) ParseCollectiveInfoOutput(target interface{}) error
ParseOutput 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 ¶
func (d *CollectiveInfoRequester) Do(ctx context.Context) (*CollectiveInfoResult, error)
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) 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() interface{}
Configfile is the value of the configfile output
Description: Config file used to start the daemon
func (*DaemonStatsOutput) Filtered ¶
func (d *DaemonStatsOutput) Filtered() interface{}
Filtered is the value of the filtered output
Description: 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
ParseOutput parses the result value from the DaemonStats action into target
func (*DaemonStatsOutput) Passed ¶
func (d *DaemonStatsOutput) Passed() interface{}
Passed is the value of the passed output
Description: Passed filter checks
func (*DaemonStatsOutput) Pid ¶
func (d *DaemonStatsOutput) Pid() interface{}
Pid is the value of the pid output
Description: Process ID of the daemon
func (*DaemonStatsOutput) Replies ¶
func (d *DaemonStatsOutput) Replies() interface{}
Replies is the value of the replies output
Description: 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() interface{}
Starttime is the value of the starttime output
Description: Time the server started
func (*DaemonStatsOutput) Threads ¶
func (d *DaemonStatsOutput) Threads() interface{}
Threads is the value of the threads output
Description: List of threads active in the daemon
func (*DaemonStatsOutput) Times ¶
func (d *DaemonStatsOutput) Times() interface{}
Times is the value of the times output
Description: Processor time consumed by the daemon
func (*DaemonStatsOutput) Total ¶
func (d *DaemonStatsOutput) Total() interface{}
Total is the value of the total output
Description: Total messages received
func (*DaemonStatsOutput) Ttlexpired ¶
func (d *DaemonStatsOutput) Ttlexpired() interface{}
Ttlexpired is the value of the ttlexpired output
Description: Messages that did pass TTL checks
func (*DaemonStatsOutput) Unvalidated ¶
func (d *DaemonStatsOutput) Unvalidated() interface{}
Unvalidated is the value of the unvalidated output
Description: Messages that failed security validation
func (*DaemonStatsOutput) Validated ¶
func (d *DaemonStatsOutput) Validated() interface{}
Validated is the value of the validated output
Description: Messages that passed security validation
func (*DaemonStatsOutput) Version ¶
func (d *DaemonStatsOutput) Version() interface{}
Version is the value of the version output
Description: MCollective Version
type DaemonStatsRequester ¶
type DaemonStatsRequester struct {
// contains filtered or unexported fields
}
DaemonStatsRequester performs a RPC request to rpcutil#daemon_stats
func (*DaemonStatsRequester) Do ¶
func (d *DaemonStatsRequester) Do(ctx context.Context) (*DaemonStatsResult, error)
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) 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 FilterFunc ¶
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() interface{}
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
ParseOutput 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 ¶
func (d *GetConfigItemRequester) Do(ctx context.Context) (*GetConfigItemResult, error)
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) 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
ParseOutput 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 ¶
func (d *GetDataRequester) Do(ctx context.Context) (*GetDataResult, error)
Do performs the request
func (*GetDataRequester) Query ¶
func (d *GetDataRequester) Query(v string) *GetDataRequester
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) 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
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() interface{}
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
ParseOutput 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 ¶
func (d *GetFactRequester) Do(ctx context.Context) (*GetFactResult, error)
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) 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
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
ParseOutput 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() 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 ¶
func (d *GetFactsRequester) Do(ctx context.Context) (*GetFactsResult, error)
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) 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 ConfigFile ¶
func ConfigFile(f string) InitializationOption
ConfigFile sets the config file to use, when not set will use the user default
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 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() 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() interface{}
Machines is the value of the machines output
Description: Autonomous Agents
func (*InventoryOutput) MainCollective ¶
func (d *InventoryOutput) MainCollective() interface{}
MainCollective is the value of the main_collective output
Description: The main Collective
func (*InventoryOutput) ParseInventoryOutput ¶
func (d *InventoryOutput) ParseInventoryOutput(target interface{}) error
ParseOutput 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() interface{}
Version is the value of the version output
Description: MCollective Version
type InventoryRequester ¶
type InventoryRequester struct {
// contains filtered or unexported fields
}
InventoryRequester performs a RPC request to rpcutil#inventory
func (*InventoryRequester) Do ¶
func (d *InventoryRequester) Do(ctx context.Context) (*InventoryResult, error)
Do performs the request
type InventoryResult ¶
type InventoryResult struct {
// contains filtered or unexported fields
}
InventoryResult is the result from a inventory action
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 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 ChoriaFramework, 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
ParseOutput parses the result value from the Ping action into target
func (*PingOutput) Pong ¶
func (d *PingOutput) Pong() interface{}
Pong is the value of the pong output
Description: The local 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) 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
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 ChoriaFramework, 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 RpcutilClient ¶
RpcutilClient to the rpcutil agent
func Must ¶
func Must(opts ...InitializationOption) (client *RpcutilClient)
Must create a new client and panics on error
func New ¶
func New(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
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
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(itemI 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(sourceI 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(factI 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(factsI 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) 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) }
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