Documentation ¶
Index ¶
- func ActionString(action Action) string
- func GenServiceMethod(action Action, target Target) string
- func ParseServiceMethod(sm string) (Action, Target)
- func TargetString(target Target) string
- type Action
- type Command
- type EchoRequest
- type EchoResponse
- type Header
- type InstallRequest
- type InstallRequestParams
- type InstallResponse
- type PingRequest
- type PingResponse
- type Request
- type Response
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionString ¶
ActionString converts an action value into its string representation
func GenServiceMethod ¶
GenServiceMethod converts a pair of target and action codes into a "Target.Action" string
func ParseServiceMethod ¶
ParseServiceMethod converts a "Target.Action" string into a pair of target and action codes
func TargetString ¶
TargetString converts an target value into its string representation
Types ¶
type Action ¶
type Action int
Action is what the gourd client is requesting to be done
func ActionCode ¶
ActionCode converts an action string into its code representation
type Command ¶
type Command struct { Header Body interface{} `json:"body"` }
Command is a data structure that represents a command issued by a gourd client
func NewCommand ¶
NewCommand creates a new command
func NewHostEcho ¶
NewHostEcho creates a new echo command for the local gourdd
func NewHostInstall ¶
NewHostInstall creates a new install command for the local gourdd
func NewHostPing ¶
func NewHostPing() Command
NewHostPing creates a new ping command for the local gourdd
func (*Command) Clear ¶
func (c *Command) Clear()
Clear sets all of the command fields to empty values
func (*Command) SetFromRequest ¶
SetFromRequest updates the command data using a request
type EchoRequest ¶
type EchoRequest struct { Action Action `json:"action"` Target Target `json:"target"` Message string `json:"message"` }
EchoRequest is what a clients use to issue new echo commands
func (*EchoRequest) GetAction ¶
func (r *EchoRequest) GetAction() Action
func (*EchoRequest) GetParams ¶
func (r *EchoRequest) GetParams() interface{}
func (*EchoRequest) GetTarget ¶
func (r *EchoRequest) GetTarget() Target
type EchoResponse ¶
type EchoResponse struct { ID string `json:"id"` Error string `json:"error"` Message string `json:"message"` }
EchoResponse is what a client will recieve after issuing an echo command
func (*EchoResponse) GetData ¶
func (r *EchoResponse) GetData() interface{}
func (*EchoResponse) GetError ¶
func (r *EchoResponse) GetError() string
func (*EchoResponse) GetId ¶
func (r *EchoResponse) GetId() string
type Header ¶
type Header struct { ID string `json:"id"` Timestamp int64 `json:"timestamp"` Action Action `json:"action"` Target Target `json:"target"` }
Header contains all of the metadata for a command
type InstallRequest ¶
type InstallRequest struct { Action Action `json:"action"` Target Target `json:"target"` Item string `json:"item"` User string `json:"user"` }
InstallRequest is what a clients use to issue new install commands
func (*InstallRequest) GetAction ¶
func (r *InstallRequest) GetAction() Action
func (*InstallRequest) GetParams ¶
func (r *InstallRequest) GetParams() interface{}
func (*InstallRequest) GetTarget ¶
func (r *InstallRequest) GetTarget() Target
type InstallRequestParams ¶
InstallRequestParams identify what to install and who to install it for
func (*InstallRequestParams) Read ¶
func (p *InstallRequestParams) Read() (string, string)
type InstallResponse ¶
type InstallResponse struct { ID string `json:"id"` Error string `json:"error"` Message string `json:"message"` }
InstallResponse is what a client will recieve after issuing a install command
func (*InstallResponse) GetData ¶
func (r *InstallResponse) GetData() interface{}
func (*InstallResponse) GetError ¶
func (r *InstallResponse) GetError() string
func (*InstallResponse) GetId ¶
func (r *InstallResponse) GetId() string
type PingRequest ¶
PingRequest is what a clients use to issue new ping commands
func (*PingRequest) GetAction ¶
func (r *PingRequest) GetAction() Action
func (*PingRequest) GetParams ¶
func (r *PingRequest) GetParams() interface{}
func (*PingRequest) GetTarget ¶
func (r *PingRequest) GetTarget() Target
type PingResponse ¶
type PingResponse struct { ID string `json:"id"` Error string `json:"error"` Message string `json:"message"` }
PingResponse is what a client will recieve after issuing a ping command
func (*PingResponse) GetData ¶
func (r *PingResponse) GetData() interface{}
func (*PingResponse) GetError ¶
func (r *PingResponse) GetError() string
func (*PingResponse) GetId ¶
func (r *PingResponse) GetId() string
type Request ¶
Request is what a clients use to issue new commands
func NewRequest ¶
NewRequest creates a new command request
type Response ¶
Response is what a server will send back to a client after a command
func NewResponse ¶
NewResponse creates a new command response
type Target ¶
type Target int
Target is what should be affected the action of a command
func TargetCode ¶
TargetCode converts an target string into its code representation