Documentation ¶
Overview ¶
Package rpc contains the I/O signatures for the RPC calls
Index ¶
- Constants
- Variables
- func BuildMethod(rpcMethod string) string
- type AddHostInput
- type AddHostOutput
- type CommandConfig
- type CommonInput
- type Endpoint
- type HealthCheckInput
- type HealthCheckOutput
- type ListHostsInput
- type ListHostsOutput
- type Operation
- type OperationArgument
- type OperationInput
- type OperationOutput
- type OperationResult
- type OperationStatusCheckInput
- type OperationStatusCheckOutput
- type OperationType
- type RefreshInput
- type RefreshOutput
- type RemoveHostInput
- type RemoveHostOutput
- type ServerIdentifier
- type SetIdentifierInput
- type SetIdentifierOutput
Constants ¶
const ProtoVersion = "werify.v1"
ProtoVersion is poor man's protocol versioning system
const RunOperationRpcCommand = "RunOperation"
RunOperationRpcCommand is the name of the Run Operation RPC command
Variables ¶
var Commands = map[string]CommandConfig{ "add": {1, 1, "Adds a host to werifyd", "AddHost"}, "del": {2, 1, "Removes a host from werifyd", "RemoveHost"}, "list": {3, 0, "Lists hosts in werifyd", "ListHost"}, "listactive": {4, 0, "Lists active hosts in werifyd", "ListHost"}, "listinactive": {5, 0, "Lists inactive hosts in werifyd", "ListHost"}, "operation": {6, 1, "Runs operations from file on werifyd", RunOperationRpcCommand}, "get": {7, 1, "Get status of operation with handle", "OperationStatusCheck"}, "refresh": {8, 0, "Start health check on all hosts", "Refresh"}, }
Commands is the map of all cli commands. Key is the command name in cli.
Functions ¶
func BuildMethod ¶
BuildMethod prepends the ProtoVersion to the rpc method name
Types ¶
type AddHostInput ¶
type AddHostInput struct { CommonInput Endpoint Endpoint }
AddHostInput is the input struct for the add host functionality
type AddHostOutput ¶
type AddHostOutput struct {
Ok bool
}
AddHostOutput is the output struct for the add host functionality
type CommandConfig ¶
type CommandConfig struct { // Order is the listing order on cli help Order int // NumArgs is the # of arguments the command expects NumArgs int // Description is the cli help string Description string // RpcMethod is the method to call RpcMethod string }
CommandConfig configures a cli command
type CommonInput ¶
type CommonInput struct {
EnvTag string
}
CommonInput is included in all RPC inputs
type Endpoint ¶
type Endpoint string
Endpoint is the host:port of a (hopefully) running werifyd
func NewEndpoint ¶
NewEndpoint creates an Endpoint
type HealthCheckInput ¶
type HealthCheckInput struct {
CommonInput
}
HealthCheckInput is the input struct for the health-check functionality
type HealthCheckOutput ¶
type HealthCheckOutput struct {
Ok bool
}
HealthCheckOutput is the output struct for the health-check functionality
type ListHostsInput ¶
type ListHostsInput struct { CommonInput ListActive bool ListInactive bool }
ListHostsInput is the input struct for the list hosts functionality
type ListHostsOutput ¶
ListHostsOutput is the output struct for the list hosts functionality
type Operation ¶
type Operation struct { OpType OperationType `json:"type"` PathArg OperationArgument `json:"path,omitempty"` CheckArg OperationArgument `json:"check,omitempty"` }
Operation is a single operation
type OperationArgument ¶
type OperationArgument string
OperationArgument is one of the arguments of the operation
type OperationInput ¶
type OperationInput struct { CommonInput // Forward determines if we are running these operations on the currect context or forwarding them down to other hosts. // This also makes the current call async, in OperationOutput only Id will be returned. Forward bool // Ops is a map of operations, map key is the given unique name Ops map[string]Operation }
OperationInput is the input struct for the operation functionality
type OperationOutput ¶
type OperationOutput struct { // Handle is a unique id to check the results using OperationStatusCheckInput Handle string // Results is a map of results per given unique name per server identifier Results map[ServerIdentifier]map[string]OperationResult // StartedAt is the start time StartedAt time.Time // EndedAt shows if the operation is still running or ended EndedAt *time.Time }
OperationOutput is the output struct for the operation functionality
type OperationResult ¶
OperationResult is a result of a single operation
type OperationStatusCheckInput ¶
type OperationStatusCheckInput struct { CommonInput // Handle is the unique id of the operation to check results for Handle string }
OperationStatusCheckInput is the input struct to check status of an operation
type OperationStatusCheckOutput ¶
type OperationStatusCheckOutput OperationOutput
OperationStatusCheckOutput is the output struct for the operation functionality
type RefreshInput ¶
type RefreshInput struct {
CommonInput
}
RefreshInput is the input struct for refresh hosts/start healthcheck functionality
type RefreshOutput ¶
type RefreshOutput struct {
Ok bool
}
RefreshOutput is the output struct for refresh hosts/start healthcheck functionality
type RemoveHostInput ¶
type RemoveHostInput struct { CommonInput Endpoint Endpoint }
RemoveHostInput is the input struct for the remove host functionality
type RemoveHostOutput ¶
type RemoveHostOutput struct {
Ok bool
}
RemoveHostOutput is the output struct for the remove host functionality
type ServerIdentifier ¶
type ServerIdentifier string
ServerIdentifier is actually an Endpoint in a different context.
type SetIdentifierInput ¶
type SetIdentifierInput struct { CommonInput Identifier ServerIdentifier }
SetIdentifierInput is the input struct for the set identifier functionality
type SetIdentifierOutput ¶
type SetIdentifierOutput struct {
Ok bool
}
SetIdentifierOutput is the output struct for the set identifier functionality