Documentation ¶
Overview ¶
Package choria_provisionclient is an API client to the Choria Choria_provision agent Version 0.29.1.
Actions:
- Configure - Configure the Choria Server
- Gen25519 - Generates a new ED25519 keypair
- Gencsr - Request a CSR from the Choria Server
- Jwt - Re-enable provision mode in a running Choria Server
- Reprovision - Reenable provision mode in a running Choria Server
- Restart - Restart the Choria Server
- ReleaseUpdate - Performs an in-place binary update and restarts Choria
- Shutdown - Shut the Choria Server down cleanly
Index ¶
- Constants
- func DDL() (*agent.DDL, error)
- func DDLBytes() ([]byte, error)
- type BroadcastNS
- type ChoriaProvisionClient
- func (p *ChoriaProvisionClient) AgentMetadata() *Metadata
- func (p *ChoriaProvisionClient) Configure(inputConfig string) *ConfigureRequester
- func (p *ChoriaProvisionClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
- func (p *ChoriaProvisionClient) Gen25519(inputNonce string, inputToken string) *Gen25519Requester
- func (p *ChoriaProvisionClient) Gencsr(inputToken string) *GencsrRequester
- func (p *ChoriaProvisionClient) Jwt(inputToken string) *JwtRequester
- func (p *ChoriaProvisionClient) OptionAgentFilter(a ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionClassFilter(f ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionCollective(c string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionCombinedFilter(f ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionCompoundFilter(f ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionDiscoveryTimeout(t time.Duration) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionExprFilter(f string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionFactFilter(f ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionIdentityFilter(f ...string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionInBatches(size int, sleep int) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionLimitMethod(m string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionLimitSeed(s int64) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionLimitSize(s string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionReplyTo(t string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionReset() *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionTargets(t []string) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) OptionWorkers(w int) *ChoriaProvisionClient
- func (p *ChoriaProvisionClient) ReleaseUpdate(inputRepository string, inputToken string, inputVersion string) *ReleaseUpdateRequester
- func (p *ChoriaProvisionClient) Reprovision(inputToken string) *ReprovisionRequester
- func (p *ChoriaProvisionClient) Restart(inputToken string) *RestartRequester
- func (p *ChoriaProvisionClient) Shutdown(inputToken string) *ShutdownRequester
- type ConfigureOutput
- type ConfigureRequester
- func (d *ConfigureRequester) ActionPolicies(v map[string]any) *ConfigureRequester
- func (d *ConfigureRequester) Ca(v string) *ConfigureRequester
- func (d *ConfigureRequester) Certificate(v string) *ConfigureRequester
- func (d *ConfigureRequester) Do(ctx context.Context) (*ConfigureResult, error)
- func (d *ConfigureRequester) EcdhPublic(v string) *ConfigureRequester
- func (d *ConfigureRequester) Key(v string) *ConfigureRequester
- func (d *ConfigureRequester) OpaPolicies(v map[string]any) *ConfigureRequester
- func (d *ConfigureRequester) ServerJwt(v string) *ConfigureRequester
- func (d *ConfigureRequester) Ssldir(v string) *ConfigureRequester
- func (d *ConfigureRequester) Token(v string) *ConfigureRequester
- type ConfigureResult
- type DisplayMode
- type ExternalNS
- type FilterFunc
- type Gen25519Output
- func (d *Gen25519Output) Directory() string
- func (d *Gen25519Output) HashMap() map[string]any
- func (d *Gen25519Output) JSON() ([]byte, error)
- func (d *Gen25519Output) ParseGen25519Output(target any) error
- func (d *Gen25519Output) PublicKey() string
- func (d *Gen25519Output) ResultDetails() *ResultDetails
- func (d *Gen25519Output) Signature() string
- type Gen25519Requester
- type Gen25519Result
- type GencsrOutput
- func (d *GencsrOutput) Csr() string
- func (d *GencsrOutput) HashMap() map[string]any
- func (d *GencsrOutput) JSON() ([]byte, error)
- func (d *GencsrOutput) ParseGencsrOutput(target any) error
- func (d *GencsrOutput) PublicKey() string
- func (d *GencsrOutput) ResultDetails() *ResultDetails
- func (d *GencsrOutput) Ssldir() string
- type GencsrRequester
- func (d *GencsrRequester) C(v string) *GencsrRequester
- func (d *GencsrRequester) Cn(v string) *GencsrRequester
- func (d *GencsrRequester) Do(ctx context.Context) (*GencsrResult, error)
- func (d *GencsrRequester) L(v string) *GencsrRequester
- func (d *GencsrRequester) O(v string) *GencsrRequester
- func (d *GencsrRequester) Ou(v string) *GencsrRequester
- func (d *GencsrRequester) St(v string) *GencsrRequester
- type GencsrResult
- type InitializationOption
- type JwtOutput
- type JwtRequester
- type JwtResult
- type Log
- type MetaNS
- type Metadata
- type NodeSource
- type PuppetDBNS
- type ReleaseUpdateOutput
- type ReleaseUpdateRequester
- type ReleaseUpdateResult
- func (d *ReleaseUpdateResult) AllOutputs() []*ReleaseUpdateOutput
- func (d *ReleaseUpdateResult) EachOutput(h func(r *ReleaseUpdateOutput))
- func (d *ReleaseUpdateResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, ...) error
- func (d *ReleaseUpdateResult) Stats() Stats
- type RenderFormat
- type ReprovisionOutput
- type ReprovisionRequester
- type ReprovisionResult
- type RestartOutput
- type RestartRequester
- type RestartResult
- type ResultDetails
- type ShutdownOutput
- type ShutdownRequester
- type ShutdownResult
- type Stats
- type StatusCode
Constants ¶
const ( // DisplayDDL shows results based on the configuration in the DDL file DisplayDDL = DisplayMode(iota) // DisplayOK shows only passing results DisplayOK // DisplayFailed shows only failed results DisplayFailed // DisplayAll shows all results DisplayAll // DisplayNone shows no results DisplayNone )
const ( // OK is the reply status when all worked OK = StatusCode(iota) // Aborted is status for when the action could not run, most failures in an action should set this Aborted // UnknownAction is the status for unknown actions requested UnknownAction // MissingData is the status for missing input data MissingData // InvalidData is the status for invalid input data InvalidData // UnknownError is the status general failures in agents should set when things go bad UnknownError )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BroadcastNS ¶
BroadcastNS is a NodeSource that uses the Choria network broadcast method to discover nodes
func (*BroadcastNS) Discover ¶
func (b *BroadcastNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type ChoriaProvisionClient ¶
ChoriaProvisionClient to the choria_provision agent
func Must ¶
func Must(fw inter.Framework, opts ...InitializationOption) (client *ChoriaProvisionClient)
Must create a new client and panics on error
func New ¶
func New(fw inter.Framework, opts ...InitializationOption) (client *ChoriaProvisionClient, err error)
New creates a new client to the choria_provision agent
func (*ChoriaProvisionClient) AgentMetadata ¶
func (p *ChoriaProvisionClient) AgentMetadata() *Metadata
AgentMetadata is the agent metadata this client supports
func (*ChoriaProvisionClient) Configure ¶
func (p *ChoriaProvisionClient) Configure(inputConfig string) *ConfigureRequester
Configure performs the configure action
Description: Configure the Choria Server
Required Inputs:
- config (string) - The configuration to apply to this node
Optional Inputs:
- action_policies (map[string]any) - Map of Action Policy documents indexed by file name
- ca (string) - PEM text block for the CA
- certificate (string) - PEM text block for the certificate
- ecdh_public (string) - Required when sending a private key
- key (string) - A RSA private key
- opa_policies (map[string]any) - Map of Open Policy Agent Policy documents indexed by file name
- server_jwt (string) - JWT file used to identify the server to the broker for ed25519 based authentication
- ssldir (string) - Directory for storing the certificate in
- token (string) - Authentication token to pass to the server
func (*ChoriaProvisionClient) DiscoverNodes ¶
func (p *ChoriaProvisionClient) DiscoverNodes(ctx context.Context) (nodes []string, err error)
DiscoverNodes performs a discovery using the configured filter and node source
func (*ChoriaProvisionClient) Gen25519 ¶ added in v0.25.0
func (p *ChoriaProvisionClient) Gen25519(inputNonce string, inputToken string) *Gen25519Requester
Gen25519 performs the gen25519 action
Description: Generates a new ED25519 keypair
Required Inputs:
- nonce (string) - Single use token to be signed by the private key being generated
- token (string) - Authentication token to pass to the server
func (*ChoriaProvisionClient) Gencsr ¶
func (p *ChoriaProvisionClient) Gencsr(inputToken string) *GencsrRequester
Gencsr performs the gencsr action
Description: Request a CSR from the Choria Server
Required Inputs:
- token (string) - Authentication token to pass to the server
Optional Inputs:
- C (string) - Country Code
- L (string) - Locality or municipality (such as city or town name)
- O (string) - Organization
- OU (string) - Organizational Unit
- ST (string) - State
- cn (string) - The certificate Common Name to place in the CSR
func (*ChoriaProvisionClient) Jwt ¶
func (p *ChoriaProvisionClient) Jwt(inputToken string) *JwtRequester
Jwt performs the jwt action
Description: Re-enable provision mode in a running Choria Server
Required Inputs:
- token (string) - Authentication token to pass to the server
func (*ChoriaProvisionClient) OptionAgentFilter ¶
func (p *ChoriaProvisionClient) OptionAgentFilter(a ...string) *ChoriaProvisionClient
OptionAgentFilter adds an agent filter
func (*ChoriaProvisionClient) OptionClassFilter ¶
func (p *ChoriaProvisionClient) OptionClassFilter(f ...string) *ChoriaProvisionClient
OptionClassFilter adds a class filter
func (*ChoriaProvisionClient) OptionCollective ¶
func (p *ChoriaProvisionClient) OptionCollective(c string) *ChoriaProvisionClient
OptionCollective sets the collective to target
func (*ChoriaProvisionClient) OptionCombinedFilter ¶
func (p *ChoriaProvisionClient) OptionCombinedFilter(f ...string) *ChoriaProvisionClient
OptionCombinedFilter adds a combined filter
func (*ChoriaProvisionClient) OptionCompoundFilter ¶
func (p *ChoriaProvisionClient) OptionCompoundFilter(f ...string) *ChoriaProvisionClient
OptionCompoundFilter adds a compound filter
func (*ChoriaProvisionClient) OptionDiscoveryTimeout ¶
func (p *ChoriaProvisionClient) OptionDiscoveryTimeout(t time.Duration) *ChoriaProvisionClient
OptionDiscoveryTimeout configures the request discovery timeout, defaults to configured discovery timeout
func (*ChoriaProvisionClient) OptionExprFilter ¶
func (p *ChoriaProvisionClient) OptionExprFilter(f string) *ChoriaProvisionClient
OptionExprFilter sets a filter expression that will remove results from the result set
func (*ChoriaProvisionClient) OptionFactFilter ¶
func (p *ChoriaProvisionClient) OptionFactFilter(f ...string) *ChoriaProvisionClient
OptionFactFilter adds a fact filter
func (*ChoriaProvisionClient) OptionIdentityFilter ¶
func (p *ChoriaProvisionClient) OptionIdentityFilter(f ...string) *ChoriaProvisionClient
OptionIdentityFilter adds an identity filter
func (*ChoriaProvisionClient) OptionInBatches ¶
func (p *ChoriaProvisionClient) OptionInBatches(size int, sleep int) *ChoriaProvisionClient
OptionInBatches performs requests in batches
func (*ChoriaProvisionClient) OptionLimitMethod ¶
func (p *ChoriaProvisionClient) OptionLimitMethod(m string) *ChoriaProvisionClient
OptionLimitMethod configures the method to use when limiting targets - "random" or "first"
func (*ChoriaProvisionClient) OptionLimitSeed ¶
func (p *ChoriaProvisionClient) OptionLimitSeed(s int64) *ChoriaProvisionClient
OptionLimitSeed sets the random seed used to select targets when limiting and limit method is "random"
func (*ChoriaProvisionClient) OptionLimitSize ¶
func (p *ChoriaProvisionClient) OptionLimitSize(s string) *ChoriaProvisionClient
OptionLimitSize sets limits on the targets, either a number of a percentage like "10%"
func (*ChoriaProvisionClient) OptionReplyTo ¶ added in v0.23.0
func (p *ChoriaProvisionClient) OptionReplyTo(t string) *ChoriaProvisionClient
OptionReplyTo sets a custom reply target
func (*ChoriaProvisionClient) OptionReset ¶
func (p *ChoriaProvisionClient) OptionReset() *ChoriaProvisionClient
OptionReset resets the client options to use across requests to an empty list
func (*ChoriaProvisionClient) OptionTargets ¶
func (p *ChoriaProvisionClient) OptionTargets(t []string) *ChoriaProvisionClient
OptionTargets sets specific node targets which would avoid discovery for all action calls until reset
func (*ChoriaProvisionClient) OptionWorkers ¶
func (p *ChoriaProvisionClient) OptionWorkers(w int) *ChoriaProvisionClient
OptionWorkers sets how many worker connections should be started to the broker
func (*ChoriaProvisionClient) ReleaseUpdate ¶
func (p *ChoriaProvisionClient) ReleaseUpdate(inputRepository string, inputToken string, inputVersion string) *ReleaseUpdateRequester
ReleaseUpdate performs the release_update action
Description: Performs an in-place binary update and restarts Choria
Required Inputs:
- repository (string) - HTTP(S) server hosting the update repository
- token (string) - Authentication token to pass to the server
- version (string) - Package version to update to
func (*ChoriaProvisionClient) Reprovision ¶
func (p *ChoriaProvisionClient) Reprovision(inputToken string) *ReprovisionRequester
Reprovision performs the reprovision action
Description: Reenable provision mode in a running Choria Server
Required Inputs:
- token (string) - Authentication token to pass to the server
func (*ChoriaProvisionClient) Restart ¶
func (p *ChoriaProvisionClient) Restart(inputToken string) *RestartRequester
Restart performs the restart action
Description: Restart the Choria Server
Required Inputs:
- token (string) - Authentication token to pass to the server
Optional Inputs:
- splay (float64) - The configuration to apply to this node
func (*ChoriaProvisionClient) Shutdown ¶ added in v0.26.2
func (p *ChoriaProvisionClient) Shutdown(inputToken string) *ShutdownRequester
Shutdown performs the shutdown action
Description: Shut the Choria Server down cleanly
Required Inputs:
- token (string) - Authentication token to pass to the server
type ConfigureOutput ¶
type ConfigureOutput struct {
// contains filtered or unexported fields
}
ConfigureOutput is the output from the configure action
func (*ConfigureOutput) HashMap ¶
func (d *ConfigureOutput) HashMap() map[string]any
HashMap is the raw output data
func (*ConfigureOutput) JSON ¶
func (d *ConfigureOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ConfigureOutput) Message ¶
func (d *ConfigureOutput) Message() string
Message is the value of the message output
Description: Status message from the Provisioner
func (*ConfigureOutput) ParseConfigureOutput ¶
func (d *ConfigureOutput) ParseConfigureOutput(target any) error
ParseConfigureOutput parses the result value from the Configure action into target
func (*ConfigureOutput) ResultDetails ¶
func (d *ConfigureOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type ConfigureRequester ¶
type ConfigureRequester struct {
// contains filtered or unexported fields
}
ConfigureRequester performs a RPC request to choria_provision#configure
func (*ConfigureRequester) ActionPolicies ¶ added in v0.24.0
func (d *ConfigureRequester) ActionPolicies(v map[string]any) *ConfigureRequester
ActionPolicies is an optional input to the configure action
Description: Map of Action Policy documents indexed by file name
func (*ConfigureRequester) Ca ¶
func (d *ConfigureRequester) Ca(v string) *ConfigureRequester
Ca is an optional input to the configure action
Description: PEM text block for the CA
func (*ConfigureRequester) Certificate ¶
func (d *ConfigureRequester) Certificate(v string) *ConfigureRequester
Certificate is an optional input to the configure action
Description: PEM text block for the certificate
func (*ConfigureRequester) Do ¶
func (d *ConfigureRequester) Do(ctx context.Context) (*ConfigureResult, error)
Do performs the request
func (*ConfigureRequester) EcdhPublic ¶ added in v0.23.0
func (d *ConfigureRequester) EcdhPublic(v string) *ConfigureRequester
EcdhPublic is an optional input to the configure action
Description: Required when sending a private key
func (*ConfigureRequester) Key ¶ added in v0.23.0
func (d *ConfigureRequester) Key(v string) *ConfigureRequester
Key is an optional input to the configure action
Description: A RSA private key
func (*ConfigureRequester) OpaPolicies ¶ added in v0.24.0
func (d *ConfigureRequester) OpaPolicies(v map[string]any) *ConfigureRequester
OpaPolicies is an optional input to the configure action
Description: Map of Open Policy Agent Policy documents indexed by file name
func (*ConfigureRequester) ServerJwt ¶ added in v0.25.0
func (d *ConfigureRequester) ServerJwt(v string) *ConfigureRequester
ServerJwt is an optional input to the configure action
Description: JWT file used to identify the server to the broker for ed25519 based authentication
func (*ConfigureRequester) Ssldir ¶
func (d *ConfigureRequester) Ssldir(v string) *ConfigureRequester
Ssldir is an optional input to the configure action
Description: Directory for storing the certificate in
func (*ConfigureRequester) Token ¶
func (d *ConfigureRequester) Token(v string) *ConfigureRequester
Token is an optional input to the configure action
Description: Authentication token to pass to the server
type ConfigureResult ¶
type ConfigureResult struct {
// contains filtered or unexported fields
}
ConfigureResult is the result from a configure action
func (*ConfigureResult) AllOutputs ¶ added in v0.26.0
func (d *ConfigureResult) AllOutputs() []*ConfigureOutput
AllOutputs provide access to all outputs
func (*ConfigureResult) EachOutput ¶
func (d *ConfigureResult) EachOutput(h func(r *ConfigureOutput))
EachOutput iterates over all results received
func (*ConfigureResult) RenderResults ¶
func (d *ConfigureResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*ConfigureResult) Stats ¶
func (d *ConfigureResult) Stats() Stats
Stats is the rpc request stats
type ExternalNS ¶
ExternalNS is a NodeSource that calls an external command for discovery
func (*ExternalNS) Discover ¶
func (p *ExternalNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
type FilterFunc ¶
FilterFunc can generate a Choria filter
type Gen25519Output ¶ added in v0.25.0
type Gen25519Output struct {
// contains filtered or unexported fields
}
Gen25519Output is the output from the gen25519 action
func (*Gen25519Output) Directory ¶ added in v0.25.0
func (d *Gen25519Output) Directory() string
Directory is the value of the directory output
Description: The directory where server.key and server.pub is written to
func (*Gen25519Output) HashMap ¶ added in v0.25.0
func (d *Gen25519Output) HashMap() map[string]any
HashMap is the raw output data
func (*Gen25519Output) JSON ¶ added in v0.25.0
func (d *Gen25519Output) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*Gen25519Output) ParseGen25519Output ¶ added in v0.25.0
func (d *Gen25519Output) ParseGen25519Output(target any) error
ParseGen25519Output parses the result value from the Gen25519 action into target
func (*Gen25519Output) PublicKey ¶ added in v0.25.0
func (d *Gen25519Output) PublicKey() string
PublicKey is the value of the public_key output
Description: The ED255519 public key hex encoded
func (*Gen25519Output) ResultDetails ¶ added in v0.25.0
func (d *Gen25519Output) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*Gen25519Output) Signature ¶ added in v0.25.0
func (d *Gen25519Output) Signature() string
Signature is the value of the signature output
Description: The signature of the nonce made using the new private key, hex encoded
type Gen25519Requester ¶ added in v0.25.0
type Gen25519Requester struct {
// contains filtered or unexported fields
}
Gen25519Requester performs a RPC request to choria_provision#gen25519
func (*Gen25519Requester) Do ¶ added in v0.25.0
func (d *Gen25519Requester) Do(ctx context.Context) (*Gen25519Result, error)
Do performs the request
type Gen25519Result ¶ added in v0.25.0
type Gen25519Result struct {
// contains filtered or unexported fields
}
Gen25519Result is the result from a gen25519 action
func (*Gen25519Result) AllOutputs ¶ added in v0.26.0
func (d *Gen25519Result) AllOutputs() []*Gen25519Output
AllOutputs provide access to all outputs
func (*Gen25519Result) EachOutput ¶ added in v0.25.0
func (d *Gen25519Result) EachOutput(h func(r *Gen25519Output))
EachOutput iterates over all results received
func (*Gen25519Result) RenderResults ¶ added in v0.25.0
func (d *Gen25519Result) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*Gen25519Result) Stats ¶ added in v0.25.0
func (d *Gen25519Result) Stats() Stats
Stats is the rpc request stats
type GencsrOutput ¶
type GencsrOutput struct {
// contains filtered or unexported fields
}
GencsrOutput is the output from the gencsr action
func (*GencsrOutput) Csr ¶
func (d *GencsrOutput) Csr() string
Csr is the value of the csr output
Description: PEM text block for the CSR
func (*GencsrOutput) HashMap ¶
func (d *GencsrOutput) HashMap() map[string]any
HashMap is the raw output data
func (*GencsrOutput) JSON ¶
func (d *GencsrOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*GencsrOutput) ParseGencsrOutput ¶
func (d *GencsrOutput) ParseGencsrOutput(target any) error
ParseGencsrOutput parses the result value from the Gencsr action into target
func (*GencsrOutput) PublicKey ¶ added in v0.23.0
func (d *GencsrOutput) PublicKey() string
PublicKey is the value of the public_key output
Description: PEM text block of the public key that made the CSR
func (*GencsrOutput) ResultDetails ¶
func (d *GencsrOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
func (*GencsrOutput) Ssldir ¶
func (d *GencsrOutput) Ssldir() string
Ssldir is the value of the ssldir output
Description: SSL directory as determined by the server
type GencsrRequester ¶
type GencsrRequester struct {
// contains filtered or unexported fields
}
GencsrRequester performs a RPC request to choria_provision#gencsr
func (*GencsrRequester) C ¶
func (d *GencsrRequester) C(v string) *GencsrRequester
C is an optional input to the gencsr action
Description: Country Code
func (*GencsrRequester) Cn ¶
func (d *GencsrRequester) Cn(v string) *GencsrRequester
Cn is an optional input to the gencsr action
Description: The certificate Common Name to place in the CSR
func (*GencsrRequester) Do ¶
func (d *GencsrRequester) Do(ctx context.Context) (*GencsrResult, error)
Do performs the request
func (*GencsrRequester) L ¶
func (d *GencsrRequester) L(v string) *GencsrRequester
L is an optional input to the gencsr action
Description: Locality or municipality (such as city or town name)
func (*GencsrRequester) O ¶
func (d *GencsrRequester) O(v string) *GencsrRequester
O is an optional input to the gencsr action
Description: Organization
func (*GencsrRequester) Ou ¶ added in v0.26.0
func (d *GencsrRequester) Ou(v string) *GencsrRequester
Ou is an optional input to the gencsr action
Description: Organizational Unit
func (*GencsrRequester) St ¶ added in v0.26.0
func (d *GencsrRequester) St(v string) *GencsrRequester
St is an optional input to the gencsr action
Description: State
type GencsrResult ¶
type GencsrResult struct {
// contains filtered or unexported fields
}
GencsrResult is the result from a gencsr action
func (*GencsrResult) AllOutputs ¶ added in v0.26.0
func (d *GencsrResult) AllOutputs() []*GencsrOutput
AllOutputs provide access to all outputs
func (*GencsrResult) EachOutput ¶
func (d *GencsrResult) EachOutput(h func(r *GencsrOutput))
EachOutput iterates over all results received
func (*GencsrResult) RenderResults ¶
func (d *GencsrResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
type InitializationOption ¶
type InitializationOption func(opts *initOptions)
InitializationOption is an optional setting used to initialize the client
func Discovery ¶
func Discovery(ns NodeSource) InitializationOption
Discovery sets the NodeSource to use when finding nodes to manage
func DiscoveryMethod ¶
func DiscoveryMethod(m string) InitializationOption
DiscoveryMethod accepts a discovery method name as supplied from the CLI and configures the correct NodeSource reverts to broadcast method if an unsupported method is supplied, custom node sources can be set using Discovery()
func DiscoveryTimeout ¶
func DiscoveryTimeout(t time.Duration) InitializationOption
DiscoveryTimeout sets a timeout for discovery for those methods that support it
func Logger ¶
func Logger(l *logrus.Entry) InitializationOption
Logger sets the logger to use else one is made via the Choria framework
type JwtOutput ¶
type JwtOutput struct {
// contains filtered or unexported fields
}
JwtOutput is the output from the jwt action
func (*JwtOutput) EcdhPublic ¶ added in v0.23.0
EcdhPublic is the value of the ecdh_public output
Description: The ECDH public key for calculating shared secrets
func (*JwtOutput) Jwt ¶
Jwt is the value of the jwt output
Description: The contents of the JWT token
func (*JwtOutput) ParseJwtOutput ¶
ParseJwtOutput parses the result value from the Jwt action into target
func (*JwtOutput) ResultDetails ¶
func (d *JwtOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type JwtRequester ¶
type JwtRequester struct {
// contains filtered or unexported fields
}
JwtRequester performs a RPC request to choria_provision#jwt
type JwtResult ¶
type JwtResult struct {
// contains filtered or unexported fields
}
JwtResult is the result from a jwt action
func (*JwtResult) AllOutputs ¶ added in v0.26.0
AllOutputs provide access to all outputs
func (*JwtResult) EachOutput ¶
EachOutput iterates over all results received
func (*JwtResult) RenderResults ¶
func (d *JwtResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
type MetaNS ¶
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 ¶
func NewMetaNS(opts *discovery.StandardOptions, enablePipeMode bool) *MetaNS
NewMetaNS creates a new meta discovery node source
type Metadata ¶
type Metadata struct { License string `json:"license"` Author string `json:"author"` Timeout int `json:"timeout"` Name string `json:"name"` Version string `json:"version"` URL string `json:"url"` Description string `json:"description"` }
Metadata is the agent metadata
type NodeSource ¶
type NodeSource interface { Reset() Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error) }
NodeSource discovers nodes
type PuppetDBNS ¶
PuppetDBNS is a NodeSource that uses the PuppetDB PQL Queries to discover nodes
func (*PuppetDBNS) Discover ¶
func (p *PuppetDBNS) Discover(ctx context.Context, fw inter.Framework, filters []FilterFunc) ([]string, error)
Discover performs the discovery of nodes against the Choria Network
type ReleaseUpdateOutput ¶
type ReleaseUpdateOutput struct {
// contains filtered or unexported fields
}
ReleaseUpdateOutput is the output from the release_update action
func (*ReleaseUpdateOutput) HashMap ¶
func (d *ReleaseUpdateOutput) HashMap() map[string]any
HashMap is the raw output data
func (*ReleaseUpdateOutput) JSON ¶
func (d *ReleaseUpdateOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ReleaseUpdateOutput) Message ¶
func (d *ReleaseUpdateOutput) Message() string
Message is the value of the message output
Description: Status message from the Provisioner
func (*ReleaseUpdateOutput) ParseReleaseUpdateOutput ¶
func (d *ReleaseUpdateOutput) ParseReleaseUpdateOutput(target any) error
ParseReleaseUpdateOutput parses the result value from the ReleaseUpdate action into target
func (*ReleaseUpdateOutput) ResultDetails ¶
func (d *ReleaseUpdateOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type ReleaseUpdateRequester ¶
type ReleaseUpdateRequester struct {
// contains filtered or unexported fields
}
ReleaseUpdateRequester performs a RPC request to choria_provision#release_update
func (*ReleaseUpdateRequester) Do ¶
func (d *ReleaseUpdateRequester) Do(ctx context.Context) (*ReleaseUpdateResult, error)
Do performs the request
type ReleaseUpdateResult ¶
type ReleaseUpdateResult struct {
// contains filtered or unexported fields
}
ReleaseUpdateResult is the result from a release_update action
func (*ReleaseUpdateResult) AllOutputs ¶ added in v0.26.2
func (d *ReleaseUpdateResult) AllOutputs() []*ReleaseUpdateOutput
AllOutputs provide access to all outputs
func (*ReleaseUpdateResult) EachOutput ¶
func (d *ReleaseUpdateResult) EachOutput(h func(r *ReleaseUpdateOutput))
EachOutput iterates over all results received
func (*ReleaseUpdateResult) RenderResults ¶
func (d *ReleaseUpdateResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*ReleaseUpdateResult) Stats ¶
func (d *ReleaseUpdateResult) Stats() Stats
Stats is the rpc request stats
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 ReprovisionOutput ¶
type ReprovisionOutput struct {
// contains filtered or unexported fields
}
ReprovisionOutput is the output from the reprovision action
func (*ReprovisionOutput) HashMap ¶
func (d *ReprovisionOutput) HashMap() map[string]any
HashMap is the raw output data
func (*ReprovisionOutput) JSON ¶
func (d *ReprovisionOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ReprovisionOutput) Message ¶
func (d *ReprovisionOutput) Message() string
Message is the value of the message output
Description: Status message from the Provisioner
func (*ReprovisionOutput) ParseReprovisionOutput ¶
func (d *ReprovisionOutput) ParseReprovisionOutput(target any) error
ParseReprovisionOutput parses the result value from the Reprovision action into target
func (*ReprovisionOutput) ResultDetails ¶
func (d *ReprovisionOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type ReprovisionRequester ¶
type ReprovisionRequester struct {
// contains filtered or unexported fields
}
ReprovisionRequester performs a RPC request to choria_provision#reprovision
func (*ReprovisionRequester) Do ¶
func (d *ReprovisionRequester) Do(ctx context.Context) (*ReprovisionResult, error)
Do performs the request
type ReprovisionResult ¶
type ReprovisionResult struct {
// contains filtered or unexported fields
}
ReprovisionResult is the result from a reprovision action
func (*ReprovisionResult) AllOutputs ¶ added in v0.26.0
func (d *ReprovisionResult) AllOutputs() []*ReprovisionOutput
AllOutputs provide access to all outputs
func (*ReprovisionResult) EachOutput ¶
func (d *ReprovisionResult) EachOutput(h func(r *ReprovisionOutput))
EachOutput iterates over all results received
func (*ReprovisionResult) RenderResults ¶
func (d *ReprovisionResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*ReprovisionResult) Stats ¶
func (d *ReprovisionResult) Stats() Stats
Stats is the rpc request stats
type RestartOutput ¶
type RestartOutput struct {
// contains filtered or unexported fields
}
RestartOutput is the output from the restart action
func (*RestartOutput) HashMap ¶
func (d *RestartOutput) HashMap() map[string]any
HashMap is the raw output data
func (*RestartOutput) JSON ¶
func (d *RestartOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*RestartOutput) Message ¶
func (d *RestartOutput) Message() string
Message is the value of the message output
Description: Status message from the Provisioner
func (*RestartOutput) ParseRestartOutput ¶
func (d *RestartOutput) ParseRestartOutput(target any) error
ParseRestartOutput parses the result value from the Restart action into target
func (*RestartOutput) ResultDetails ¶
func (d *RestartOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type RestartRequester ¶
type RestartRequester struct {
// contains filtered or unexported fields
}
RestartRequester performs a RPC request to choria_provision#restart
func (*RestartRequester) Do ¶
func (d *RestartRequester) Do(ctx context.Context) (*RestartResult, error)
Do performs the request
func (*RestartRequester) Splay ¶
func (d *RestartRequester) Splay(v float64) *RestartRequester
Splay is an optional input to the restart action
Description: The configuration to apply to this node
type RestartResult ¶
type RestartResult struct {
// contains filtered or unexported fields
}
RestartResult is the result from a restart action
func (*RestartResult) AllOutputs ¶ added in v0.26.0
func (d *RestartResult) AllOutputs() []*RestartOutput
AllOutputs provide access to all outputs
func (*RestartResult) EachOutput ¶
func (d *RestartResult) EachOutput(h func(r *RestartOutput))
EachOutput iterates over all results received
func (*RestartResult) RenderResults ¶
func (d *RestartResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
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 ShutdownOutput ¶ added in v0.26.2
type ShutdownOutput struct {
// contains filtered or unexported fields
}
ShutdownOutput is the output from the shutdown action
func (*ShutdownOutput) HashMap ¶ added in v0.26.2
func (d *ShutdownOutput) HashMap() map[string]any
HashMap is the raw output data
func (*ShutdownOutput) JSON ¶ added in v0.26.2
func (d *ShutdownOutput) JSON() ([]byte, error)
JSON is the JSON representation of the output data
func (*ShutdownOutput) Message ¶ added in v0.26.2
func (d *ShutdownOutput) Message() string
Message is the value of the message output
Description: Status message from the Provisioner
func (*ShutdownOutput) ParseShutdownOutput ¶ added in v0.26.2
func (d *ShutdownOutput) ParseShutdownOutput(target any) error
ParseShutdownOutput parses the result value from the Shutdown action into target
func (*ShutdownOutput) ResultDetails ¶ added in v0.26.2
func (d *ShutdownOutput) ResultDetails() *ResultDetails
ResultDetails is the details about the request
type ShutdownRequester ¶ added in v0.26.2
type ShutdownRequester struct {
// contains filtered or unexported fields
}
ShutdownRequester performs a RPC request to choria_provision#shutdown
func (*ShutdownRequester) Do ¶ added in v0.26.2
func (d *ShutdownRequester) Do(ctx context.Context) (*ShutdownResult, error)
Do performs the request
type ShutdownResult ¶ added in v0.26.2
type ShutdownResult struct {
// contains filtered or unexported fields
}
ShutdownResult is the result from a shutdown action
func (*ShutdownResult) AllOutputs ¶ added in v0.26.2
func (d *ShutdownResult) AllOutputs() []*ShutdownOutput
AllOutputs provide access to all outputs
func (*ShutdownResult) EachOutput ¶ added in v0.26.2
func (d *ShutdownResult) EachOutput(h func(r *ShutdownOutput))
EachOutput iterates over all results received
func (*ShutdownResult) RenderResults ¶ added in v0.26.2
func (d *ShutdownResult) RenderResults(w io.Writer, format RenderFormat, displayMode DisplayMode, verbose bool, silent bool, colorize bool, log Log) error
func (*ShutdownResult) Stats ¶ added in v0.26.2
func (d *ShutdownResult) Stats() Stats
Stats is the rpc request stats
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