Documentation ¶
Overview ¶
Package scoutclient is an API client to the Choria Scout agent Version 0.0.1.
Actions:
- Checks - Obtain a list of checks and their current status
- Resume - Resume active checking of one or more checks
- Maintenance - Pause checking of one or more checks
- GossValidate - Performs a Goss validation using a specific file
- Trigger - Force an immediate check of one or more checks
Index ¶
- Constants
- func DDL() (*agent.DDL, error)
- func DDLBytes() ([]byte, error)
- type BroadcastNS
- type ChecksOutput
- type ChecksRequester
- type ChecksResult
- type ChoriaFramework
- type DisplayMode
- type ExternalNS
- type FilterFunc
- type GossValidateOutput
- func (d *GossValidateOutput) Failures() int64
- func (d *GossValidateOutput) HashMap() map[string]interface{}
- func (d *GossValidateOutput) JSON() ([]byte, error)
- func (d *GossValidateOutput) ParseGossValidateOutput(target interface{}) error
- func (d *GossValidateOutput) ResultDetails() *ResultDetails
- func (d *GossValidateOutput) Results() []interface{}
- func (d *GossValidateOutput) Runtime() int64
- func (d *GossValidateOutput) Success() string
- func (d *GossValidateOutput) Summary() string
- func (d *GossValidateOutput) Tests() int64
- type GossValidateRequester
- type GossValidateResult
- type InitializationOption
- type Log
- type MaintenanceOutput
- func (d *MaintenanceOutput) Failed() []interface{}
- func (d *MaintenanceOutput) HashMap() map[string]interface{}
- func (d *MaintenanceOutput) JSON() ([]byte, error)
- func (d *MaintenanceOutput) ParseMaintenanceOutput(target interface{}) error
- func (d *MaintenanceOutput) ResultDetails() *ResultDetails
- func (d *MaintenanceOutput) Skipped() []interface{}
- func (d *MaintenanceOutput) Transitioned() []interface{}
- type MaintenanceRequester
- type MaintenanceResult
- type MetaNS
- type Metadata
- type NodeSource
- type PuppetDBNS
- type RenderFormat
- type ResultDetails
- type ResumeOutput
- func (d *ResumeOutput) Failed() []interface{}
- func (d *ResumeOutput) HashMap() map[string]interface{}
- func (d *ResumeOutput) JSON() ([]byte, error)
- func (d *ResumeOutput) ParseResumeOutput(target interface{}) error
- func (d *ResumeOutput) ResultDetails() *ResultDetails
- func (d *ResumeOutput) Skipped() []interface{}
- func (d *ResumeOutput) Transitioned() []interface{}
- type ResumeRequester
- type ResumeResult
- type ScoutClient
- func (p *ScoutClient) AgentMetadata() *Metadata
- func (p *ScoutClient) Checks() *ChecksRequester
- func (p *ScoutClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
- func (p *ScoutClient) GossValidate(fileI string) *GossValidateRequester
- func (p *ScoutClient) Maintenance() *MaintenanceRequester
- func (p *ScoutClient) OptionAgentFilter(a ...string) *ScoutClient
- func (p *ScoutClient) OptionClassFilter(f ...string) *ScoutClient
- func (p *ScoutClient) OptionCollective(c string) *ScoutClient
- func (p *ScoutClient) OptionCombinedFilter(f ...string) *ScoutClient
- func (p *ScoutClient) OptionCompoundFilter(f ...string) *ScoutClient
- func (p *ScoutClient) OptionDiscoveryTimeout(t time.Duration) *ScoutClient
- func (p *ScoutClient) OptionExprFilter(f string) *ScoutClient
- func (p *ScoutClient) OptionFactFilter(f ...string) *ScoutClient
- func (p *ScoutClient) OptionIdentityFilter(f ...string) *ScoutClient
- func (p *ScoutClient) OptionInBatches(size int, sleep int) *ScoutClient
- func (p *ScoutClient) OptionLimitMethod(m string) *ScoutClient
- func (p *ScoutClient) OptionLimitSeed(s int64) *ScoutClient
- func (p *ScoutClient) OptionLimitSize(s string) *ScoutClient
- func (p *ScoutClient) OptionReset() *ScoutClient
- func (p *ScoutClient) OptionTargets(t []string) *ScoutClient
- func (p *ScoutClient) OptionWorkers(w int) *ScoutClient
- func (p *ScoutClient) Resume() *ResumeRequester
- func (p *ScoutClient) Trigger() *TriggerRequester
- type Stats
- type StatusCode
- type TriggerOutput
- func (d *TriggerOutput) Failed() []interface{}
- func (d *TriggerOutput) HashMap() map[string]interface{}
- func (d *TriggerOutput) JSON() ([]byte, error)
- func (d *TriggerOutput) ParseTriggerOutput(target interface{}) error
- func (d *TriggerOutput) ResultDetails() *ResultDetails
- func (d *TriggerOutput) Skipped() []interface{}
- func (d *TriggerOutput) Transitioned() []interface{}
- type TriggerRequester
- type TriggerResult
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 ChoriaFramework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type ChecksOutput ¶
type ChecksOutput struct {
// contains filtered or unexported fields
}
ChecksOutput is the output from the checks action
func (*ChecksOutput) Checks ¶
func (d *ChecksOutput) Checks() []interface{}
Checks is the value of the checks output
Description: Details about each check
func (*ChecksOutput) HashMap ¶
func (d *ChecksOutput) HashMap() map[string]interface{}
HashMap is the raw output data
func (*ChecksOutput) JSON ¶
func (d *ChecksOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ChecksOutput) ParseChecksOutput ¶
func (d *ChecksOutput) ParseChecksOutput(target interface{}) error
ParseOutput parses the result value from the Checks action into target
func (*ChecksOutput) ResultDetails ¶
func (d *ChecksOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type ChecksRequester ¶
type ChecksRequester struct {
// contains filtered or unexported fields
}
ChecksRequester performs a RPC request to scout#checks
func (*ChecksRequester) Do ¶
func (d *ChecksRequester) Do(ctx context.Context) (*ChecksResult, error)
Do performs the request
type ChecksResult ¶
type ChecksResult struct {
// contains filtered or unexported fields
}
ChecksResult is the result from a checks action
func (*ChecksResult) EachOutput ¶
func (d *ChecksResult) EachOutput(h func(r *ChecksOutput))
EachOutput iterates over all results received
func (*ChecksResult) RenderResults ¶
func (d *ChecksResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
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 ProgressWidth() int }
ChoriaFramework is the Choria framework
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 ChoriaFramework, 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 GossValidateOutput ¶
type GossValidateOutput struct {
// contains filtered or unexported fields
}
GossValidateOutput is the output from the goss_validate action
func (*GossValidateOutput) Failures ¶
func (d *GossValidateOutput) Failures() int64
Failures is the value of the failures output
Description: The number of tests that failed
func (*GossValidateOutput) HashMap ¶
func (d *GossValidateOutput) HashMap() map[string]interface{}
HashMap is the raw output data
func (*GossValidateOutput) JSON ¶
func (d *GossValidateOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*GossValidateOutput) ParseGossValidateOutput ¶
func (d *GossValidateOutput) ParseGossValidateOutput(target interface{}) error
ParseOutput parses the result value from the GossValidate action into target
func (*GossValidateOutput) ResultDetails ¶
func (d *GossValidateOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*GossValidateOutput) Results ¶
func (d *GossValidateOutput) Results() []interface{}
Results is the value of the results output
Description: The full test results
func (*GossValidateOutput) Runtime ¶
func (d *GossValidateOutput) Runtime() int64
Runtime is the value of the runtime output
Description: The time it took to run the tests, in seconds
func (*GossValidateOutput) Success ¶
func (d *GossValidateOutput) Success() string
Success is the value of the success output
Description: Indicates if the test passed
func (*GossValidateOutput) Summary ¶
func (d *GossValidateOutput) Summary() string
Summary is the value of the summary output
Description: A human friendly test result
func (*GossValidateOutput) Tests ¶
func (d *GossValidateOutput) Tests() int64
Tests is the value of the tests output
Description: The number of tests that were run
type GossValidateRequester ¶
type GossValidateRequester struct {
// contains filtered or unexported fields
}
GossValidateRequester performs a RPC request to scout#goss_validate
func (*GossValidateRequester) Do ¶
func (d *GossValidateRequester) Do(ctx context.Context) (*GossValidateResult, error)
Do performs the request
func (*GossValidateRequester) Vars ¶
func (d *GossValidateRequester) Vars(v string) *GossValidateRequester
Vars is an optional input to the goss_validate action
Description: Path to a file to use as template variables
type GossValidateResult ¶
type GossValidateResult struct {
// contains filtered or unexported fields
}
GossValidateResult is the result from a goss_validate action
func (*GossValidateResult) EachOutput ¶
func (d *GossValidateResult) EachOutput(h func(r *GossValidateOutput))
EachOutput iterates over all results received
func (*GossValidateResult) RenderResults ¶
func (d *GossValidateResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*GossValidateResult) Stats ¶
func (d *GossValidateResult) 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 MaintenanceOutput ¶
type MaintenanceOutput struct {
// contains filtered or unexported fields
}
MaintenanceOutput is the output from the maintenance action
func (*MaintenanceOutput) Failed ¶
func (d *MaintenanceOutput) Failed() []interface{}
Failed is the value of the failed output
Description: List of checks that could not be paused
func (*MaintenanceOutput) HashMap ¶
func (d *MaintenanceOutput) HashMap() map[string]interface{}
HashMap is the raw output data
func (*MaintenanceOutput) JSON ¶
func (d *MaintenanceOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*MaintenanceOutput) ParseMaintenanceOutput ¶
func (d *MaintenanceOutput) ParseMaintenanceOutput(target interface{}) error
ParseOutput parses the result value from the Maintenance action into target
func (*MaintenanceOutput) ResultDetails ¶
func (d *MaintenanceOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*MaintenanceOutput) Skipped ¶
func (d *MaintenanceOutput) Skipped() []interface{}
Skipped is the value of the skipped output
Description: List of checks that was skipped
func (*MaintenanceOutput) Transitioned ¶
func (d *MaintenanceOutput) Transitioned() []interface{}
Transitioned is the value of the transitioned output
Description: List of checks that were paused
type MaintenanceRequester ¶
type MaintenanceRequester struct {
// contains filtered or unexported fields
}
MaintenanceRequester performs a RPC request to scout#maintenance
func (*MaintenanceRequester) Checks ¶
func (d *MaintenanceRequester) Checks(v []interface{}) *MaintenanceRequester
Checks is an optional input to the maintenance action
Description: Check to pause, empty means all
func (*MaintenanceRequester) Do ¶
func (d *MaintenanceRequester) Do(ctx context.Context) (*MaintenanceResult, error)
Do performs the request
type MaintenanceResult ¶
type MaintenanceResult struct {
// contains filtered or unexported fields
}
MaintenanceResult is the result from a maintenance action
func (*MaintenanceResult) EachOutput ¶
func (d *MaintenanceResult) EachOutput(h func(r *MaintenanceOutput))
EachOutput iterates over all results received
func (*MaintenanceResult) RenderResults ¶
func (d *MaintenanceResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*MaintenanceResult) Stats ¶
func (d *MaintenanceResult) 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
func (*MetaNS) Discover ¶ added in v0.20.0
func (p *MetaNS) Discover(ctx context.Context, fw ChoriaFramework, _ []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network.
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 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 ResumeOutput ¶
type ResumeOutput struct {
// contains filtered or unexported fields
}
ResumeOutput is the output from the resume action
func (*ResumeOutput) Failed ¶
func (d *ResumeOutput) Failed() []interface{}
Failed is the value of the failed output
Description: List of checks that could not be resumed
func (*ResumeOutput) HashMap ¶
func (d *ResumeOutput) HashMap() map[string]interface{}
HashMap is the raw output data
func (*ResumeOutput) JSON ¶
func (d *ResumeOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ResumeOutput) ParseResumeOutput ¶
func (d *ResumeOutput) ParseResumeOutput(target interface{}) error
ParseOutput parses the result value from the Resume action into target
func (*ResumeOutput) ResultDetails ¶
func (d *ResumeOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*ResumeOutput) Skipped ¶
func (d *ResumeOutput) Skipped() []interface{}
Skipped is the value of the skipped output
Description: List of checks that was skipped
func (*ResumeOutput) Transitioned ¶
func (d *ResumeOutput) Transitioned() []interface{}
Transitioned is the value of the transitioned output
Description: List of checks that were resumed
type ResumeRequester ¶
type ResumeRequester struct {
// contains filtered or unexported fields
}
ResumeRequester performs a RPC request to scout#resume
func (*ResumeRequester) Checks ¶
func (d *ResumeRequester) Checks(v []interface{}) *ResumeRequester
Checks is an optional input to the resume action
Description: Check to resume, empty means all
func (*ResumeRequester) Do ¶
func (d *ResumeRequester) Do(ctx context.Context) (*ResumeResult, error)
Do performs the request
type ResumeResult ¶
type ResumeResult struct {
// contains filtered or unexported fields
}
ResumeResult is the result from a resume action
func (*ResumeResult) EachOutput ¶
func (d *ResumeResult) EachOutput(h func(r *ResumeOutput))
EachOutput iterates over all results received
func (*ResumeResult) RenderResults ¶
func (d *ResumeResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
type ScoutClient ¶
ScoutClient to the scout agent
func Must ¶
func Must(opts ...InitializationOption) (client *ScoutClient)
Must create a new client and panics on error
func New ¶
func New(opts ...InitializationOption) (client *ScoutClient, err error)
New creates a new client to the scout agent
func (*ScoutClient) AgentMetadata ¶
func (p *ScoutClient) AgentMetadata() *Metadata
AgentMetadata is the agent metadata this client supports
func (*ScoutClient) Checks ¶
func (p *ScoutClient) Checks() *ChecksRequester
Checks performs the checks action
Description: Obtain a list of checks and their current status
func (*ScoutClient) DiscoverNodes ¶
func (p *ScoutClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
DiscoverNodes performs a discovery using the configured filter and node source
func (*ScoutClient) GossValidate ¶
func (p *ScoutClient) GossValidate(fileI string) *GossValidateRequester
GossValidate performs the goss_validate action
Description: Performs a Goss validation using a specific file
Required Inputs:
- file (string) - Path to the Goss validation specification
Optional Inputs:
- vars (string) - Path to a file to use as template variables
func (*ScoutClient) Maintenance ¶
func (p *ScoutClient) Maintenance() *MaintenanceRequester
Maintenance performs the maintenance action
Description: Pause checking of one or more checks
Optional Inputs:
- checks ([]interface{}) - Check to pause, empty means all
func (*ScoutClient) OptionAgentFilter ¶
func (p *ScoutClient) OptionAgentFilter(a ...string) *ScoutClient
OptionAgentFilter adds an agent filter
func (*ScoutClient) OptionClassFilter ¶
func (p *ScoutClient) OptionClassFilter(f ...string) *ScoutClient
OptionClassFilter adds a class filter
func (*ScoutClient) OptionCollective ¶
func (p *ScoutClient) OptionCollective(c string) *ScoutClient
OptionCollective sets the collective to target
func (*ScoutClient) OptionCombinedFilter ¶
func (p *ScoutClient) OptionCombinedFilter(f ...string) *ScoutClient
OptionCombinedFilter adds a combined filter
func (*ScoutClient) OptionCompoundFilter ¶
func (p *ScoutClient) OptionCompoundFilter(f ...string) *ScoutClient
OptionCompoundFilter adds a compound filter
func (*ScoutClient) OptionDiscoveryTimeout ¶
func (p *ScoutClient) OptionDiscoveryTimeout(t time.Duration) *ScoutClient
OptionDiscoveryTimeout configures the request discovery timeout, defaults to configured discovery timeout
func (*ScoutClient) OptionExprFilter ¶
func (p *ScoutClient) OptionExprFilter(f string) *ScoutClient
OptionExprFilter sets a filter expression that will remove results from the result set
func (*ScoutClient) OptionFactFilter ¶
func (p *ScoutClient) OptionFactFilter(f ...string) *ScoutClient
OptionFactFilter adds a fact filter
func (*ScoutClient) OptionIdentityFilter ¶
func (p *ScoutClient) OptionIdentityFilter(f ...string) *ScoutClient
OptionIdentityFilter adds an identity filter
func (*ScoutClient) OptionInBatches ¶
func (p *ScoutClient) OptionInBatches(size int, sleep int) *ScoutClient
OptionInBatches performs requests in batches
func (*ScoutClient) OptionLimitMethod ¶
func (p *ScoutClient) OptionLimitMethod(m string) *ScoutClient
OptionLimitMethod configures the method to use when limiting targets - "random" or "first"
func (*ScoutClient) OptionLimitSeed ¶
func (p *ScoutClient) OptionLimitSeed(s int64) *ScoutClient
OptionLimitSeed sets the random seed used to select targets when limiting and limit method is "random"
func (*ScoutClient) OptionLimitSize ¶
func (p *ScoutClient) OptionLimitSize(s string) *ScoutClient
OptionLimitSize sets limits on the targets, either a number of a percentage like "10%"
func (*ScoutClient) OptionReset ¶
func (p *ScoutClient) OptionReset() *ScoutClient
OptionReset resets the client options to use across requests to an empty list
func (*ScoutClient) OptionTargets ¶
func (p *ScoutClient) OptionTargets(t []string) *ScoutClient
OptionTargets sets specific node targets which would avoid discovery for all action calls until reset
func (*ScoutClient) OptionWorkers ¶
func (p *ScoutClient) OptionWorkers(w int) *ScoutClient
OptionWorkers sets how many worker connections should be started to the broker
func (*ScoutClient) Resume ¶
func (p *ScoutClient) Resume() *ResumeRequester
Resume performs the resume action
Description: Resume active checking of one or more checks
Optional Inputs:
- checks ([]interface{}) - Check to resume, empty means all
func (*ScoutClient) Trigger ¶
func (p *ScoutClient) Trigger() *TriggerRequester
Trigger performs the trigger action
Description: Force an immediate check of one or more checks
Optional Inputs:
- checks ([]interface{}) - Check to trigger, empty means all
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) }
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
type TriggerOutput ¶
type TriggerOutput struct {
// contains filtered or unexported fields
}
TriggerOutput is the output from the trigger action
func (*TriggerOutput) Failed ¶
func (d *TriggerOutput) Failed() []interface{}
Failed is the value of the failed output
Description: List of checks that could not be triggered
func (*TriggerOutput) HashMap ¶
func (d *TriggerOutput) HashMap() map[string]interface{}
HashMap is the raw output data
func (*TriggerOutput) JSON ¶
func (d *TriggerOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*TriggerOutput) ParseTriggerOutput ¶
func (d *TriggerOutput) ParseTriggerOutput(target interface{}) error
ParseOutput parses the result value from the Trigger action into target
func (*TriggerOutput) ResultDetails ¶
func (d *TriggerOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*TriggerOutput) Skipped ¶
func (d *TriggerOutput) Skipped() []interface{}
Skipped is the value of the skipped output
Description: List of checks that was skipped
func (*TriggerOutput) Transitioned ¶
func (d *TriggerOutput) Transitioned() []interface{}
Transitioned is the value of the transitioned output
Description: List of checks that were triggered
type TriggerRequester ¶
type TriggerRequester struct {
// contains filtered or unexported fields
}
TriggerRequester performs a RPC request to scout#trigger
func (*TriggerRequester) Checks ¶
func (d *TriggerRequester) Checks(v []interface{}) *TriggerRequester
Checks is an optional input to the trigger action
Description: Check to trigger, empty means all
func (*TriggerRequester) Do ¶
func (d *TriggerRequester) Do(ctx context.Context) (*TriggerResult, error)
Do performs the request
type TriggerResult ¶
type TriggerResult struct {
// contains filtered or unexported fields
}
TriggerResult is the result from a trigger action
func (*TriggerResult) EachOutput ¶
func (d *TriggerResult) EachOutput(h func(r *TriggerOutput))
EachOutput iterates over all results received
func (*TriggerResult) RenderResults ¶
func (d *TriggerResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error