Documentation
¶
Index ¶
Constants ¶
View Source
const ( MaxRetries = 5 IntervalBetweenRetries = 200 * time.Millisecond )
View Source
const ( Version = "v1alpha" KindConfiguration = "Configuration" KindFiniteStateMachine = "FiniteStateMachine" KindEvent = "EventRequest" CmdGet = "get" CmdSend = "send" CmdVersion = "version" StdinFlag = "--" )
Variables ¶
View Source
var ( // ConfigDefaultDir points to the directory in the user's HOME folder where configuration and Certificates are kept ConfigDefaultDir = path.Join(os.Getenv("HOME"), ".fsm") // CertsDir is the folder holding the X.509 Certificates and, optionally, the root CA Cert CertsDir = path.Join(ConfigDefaultDir, "certs") // CaCert is the name of the root CA X.509 Certificate for TLS Auth CaCert = "ca.pem" )
View Source
var SendHandlers = HandlersMap{ KindConfiguration: func(clt *CliClient, data []byte) (resp interface{}, grpcErr error) { var c ConfigEntity err := yaml.Unmarshal(data, &c) if err != nil { return nil, err } return clt.PutConfiguration(context.Background(), c.Spec) }, KindFiniteStateMachine: func(clt *CliClient, data []byte) (resp interface{}, grpcErr error) { var fsm FsmEntity err := yaml.Unmarshal(data, &fsm) if err != nil { return nil, err } request := &protos.PutFsmRequest{Id: fsm.Id, Fsm: fsm.Spec} return clt.PutFiniteStateMachine(context.Background(), request) }, KindEvent: func(clt *CliClient, data []byte) (resp interface{}, grpcErr error) { var evt EventRequestEntity err := yaml.Unmarshal(data, &evt) if err != nil { return nil, err } return clt.sendEvent(evt.Spec) }, }
Functions ¶
This section is empty.
Types ¶
type CliClient ¶
type CliClient struct {
protos.StatemachineServiceClient
}
type ConfigEntity ¶
type ConfigEntity struct { GenericEntity `yaml:",inline"` Spec *protos.Configuration `yaml:"spec"` }
type EventRequestEntity ¶
type EventRequestEntity struct { GenericEntity `yaml:",inline"` Spec *protos.EventRequest `yaml:"spec"` }
type FsmEntity ¶
type FsmEntity struct { GenericEntity `yaml:",inline"` Spec *protos.FiniteStateMachine `yaml:"spec"` }
type GenericEntity ¶
type GenericEntity struct { Version string `yaml:"apiVersion"` Kind string `yaml:"kind"` Id string `yaml:"id"` }
A GenericEntity is the "wrapper" type that is sent to the CLI and wraps the entity (defined in the Spec) which will be sent to the FSM Server. It has an optional Id for those requests that need it (typically, when storing a new FSM or sending an Event); if unset, a new random UUID will be generated by the server.
Click to show internal directories.
Click to hide internal directories.