Documentation ¶
Overview ¶
State Machine implementation
State Machine Parser
Index ¶
- Variables
- func DefaultHandler(_ context.Context, input interface{}) (interface{}, error)
- func Validate(sm_json *string) error
- func ValidateNameAndType(s State) error
- type Catcher
- type Choice
- type ChoiceRule
- type ChoiceState
- func (s *ChoiceState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *ChoiceState) GetType() *string
- func (s *ChoiceState) Name() *string
- func (s *ChoiceState) SetName(name *string)
- func (s *ChoiceState) SetType(t *string)
- func (s *ChoiceState) Validate() error
- type Execution
- func (sm *Execution) EnteredEvent(s State, input interface{})
- func (sm *Execution) ExitedEvent(s State, output interface{})
- func (sm *Execution) Failed()
- func (sm *Execution) Path() []string
- func (sm *Execution) SetLastOutput(output interface{}, err error)
- func (sm *Execution) SetOutput(output interface{}, err error)
- func (sm *Execution) Start()
- func (sm *Execution) Succeeded()
- type ExecutionFn
- type FailState
- func (s *FailState) Execute(_ context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *FailState) GetType() *string
- func (s *FailState) Name() *string
- func (s *FailState) SetName(name *string)
- func (s *FailState) SetType(t *string)
- func (s *FailState) Validate() error
- type HistoryEvent
- type MapState
- type ParallelState
- func (s *ParallelState) Execute(_ context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *ParallelState) GetType() *string
- func (s *ParallelState) Name() *string
- func (s *ParallelState) SetName(name *string)
- func (s *ParallelState) SetType(t *string)
- func (s *ParallelState) Validate() error
- type PassState
- func (s *PassState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *PassState) GetType() *string
- func (s *PassState) Name() *string
- func (s *PassState) SetName(name *string)
- func (s *PassState) SetType(t *string)
- func (s *PassState) Validate() error
- type Retrier
- type State
- type StateMachine
- func (sm *StateMachine) DefaultLambdaContext(lambda_name string) context.Context
- func (sm *StateMachine) Execute(input interface{}) (*Execution, error)
- func (sm *StateMachine) FindTask(name string) (*TaskState, error)
- func (sm *StateMachine) SetDefaultHandler()
- func (sm *StateMachine) SetResource(lambda_arn *string)
- func (sm *StateMachine) SetTaskFnHandlers(tfs *handler.TaskHandlers) error
- func (sm *StateMachine) SetTaskHandler(task_name string, resource_fn interface{}) error
- func (sm *StateMachine) Tasks() map[string]*TaskState
- func (sm *StateMachine) Validate() error
- type States
- type SucceedState
- func (s *SucceedState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *SucceedState) GetType() *string
- func (s *SucceedState) Name() *string
- func (s *SucceedState) SetName(name *string)
- func (s *SucceedState) SetType(t *string)
- func (s *SucceedState) Validate() error
- type TaskState
- func (s *TaskState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *TaskState) GetType() *string
- func (s *TaskState) Name() *string
- func (s *TaskState) SetName(name *string)
- func (s *TaskState) SetTaskHandler(resourcefn interface{})
- func (s *TaskState) SetType(t *string)
- func (s *TaskState) Validate() error
- type WaitState
- func (s *WaitState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
- func (s *WaitState) GetType() *string
- func (s *WaitState) Name() *string
- func (s *WaitState) SetName(name *string)
- func (s *WaitState) SetType(t *string)
- func (s *WaitState) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyStateMachine = `{
"StartAt": "WIN",
"States": { "WIN": {"Type": "Succeed"}}
}`
EmptyStateMachine is a small Valid StateMachine
Functions ¶
func DefaultHandler ¶
func ValidateNameAndType ¶
Types ¶
type Choice ¶
type Choice struct { ChoiceRule Next *string `json:",omitempty"` }
type ChoiceRule ¶
type ChoiceRule struct { Variable *jsonpath.Path `json:",omitempty"` StringEquals *string `json:",omitempty"` StringLessThan *string `json:",omitempty"` StringGreaterThan *string `json:",omitempty"` StringLessThanEquals *string `json:",omitempty"` StringGreaterThanEquals *string `json:",omitempty"` NumericEquals *float64 `json:",omitempty"` NumericLessThan *float64 `json:",omitempty"` NumericGreaterThan *float64 `json:",omitempty"` NumericLessThanEquals *float64 `json:",omitempty"` NumericGreaterThanEquals *float64 `json:",omitempty"` BooleanEquals *bool `json:",omitempty"` TimestampEquals *time.Time `json:",omitempty"` TimestampLessThan *time.Time `json:",omitempty"` TimestampGreaterThan *time.Time `json:",omitempty"` TimestampLessThanEquals *time.Time `json:",omitempty"` TimestampGreaterThanEquals *time.Time `json:",omitempty"` And []*ChoiceRule `json:",omitempty"` Or []*ChoiceRule `json:",omitempty"` Not *ChoiceRule `json:",omitempty"` }
func (*ChoiceRule) String ¶
func (cr *ChoiceRule) String() string
type ChoiceState ¶
type ChoiceState struct { Type *string Comment *string `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` Default *string `json:",omitempty"` // Default State if no choices match Choices []*Choice `json:",omitempty"` // contains filtered or unexported fields }
func (*ChoiceState) Execute ¶
func (s *ChoiceState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
func (*ChoiceState) GetType ¶
func (s *ChoiceState) GetType() *string
func (*ChoiceState) SetType ¶
func (s *ChoiceState) SetType(t *string)
func (*ChoiceState) Validate ¶
func (s *ChoiceState) Validate() error
type Execution ¶
type Execution struct { Output map[string]interface{} OutputJSON string Error error LastOutput map[string]interface{} // interim output LastOutputJSON string LastError error // interim error ExecutionHistory []HistoryEvent }
func (*Execution) EnteredEvent ¶
func (*Execution) ExitedEvent ¶
func (*Execution) SetLastOutput ¶
type ExecutionFn ¶
type FailState ¶
type FailState struct { Type *string Comment *string `json:",omitempty"` Error *string `json:",omitempty"` Cause *string `json:",omitempty"` // contains filtered or unexported fields }
type HistoryEvent ¶
type HistoryEvent struct {
sfn.HistoryEvent
}
type MapState ¶
type MapState struct { Type *string Comment *string `json:",omitempty"` Iterator *StateMachine ItemsPath *jsonpath.Path `json:",omitempty"` Parameters interface{} `json:",omitempty"` MaxConcurrency *float64 `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` ResultPath *jsonpath.Path `json:",omitempty"` Catch []*Catcher `json:",omitempty"` Retry []*Retrier `json:",omitempty"` Next *string `json:",omitempty"` End *bool `json:",omitempty"` // contains filtered or unexported fields }
type ParallelState ¶
type ParallelState struct { Type *string Comment *string `json:",omitempty"` // contains filtered or unexported fields }
func (*ParallelState) Execute ¶
func (s *ParallelState) Execute(_ context.Context, input interface{}) (output interface{}, next *string, err error)
func (*ParallelState) GetType ¶
func (s *ParallelState) GetType() *string
func (*ParallelState) SetType ¶
func (s *ParallelState) SetType(t *string)
func (*ParallelState) Validate ¶
func (s *ParallelState) Validate() error
type PassState ¶
type PassState struct { Type *string Comment *string `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` ResultPath *jsonpath.Path `json:",omitempty"` Result interface{} `json:",omitempty"` Next *string `json:",omitempty"` End *bool `json:",omitempty"` // contains filtered or unexported fields }
type StateMachine ¶
StateMachine the core struct for the machine
func FromJSON ¶
func FromJSON(raw []byte) (*StateMachine, error)
func ParseFile ¶
func ParseFile(file string) (*StateMachine, error)
Takes a file, and a map of Task Function s
func (*StateMachine) DefaultLambdaContext ¶
func (sm *StateMachine) DefaultLambdaContext(lambda_name string) context.Context
func (*StateMachine) Execute ¶
func (sm *StateMachine) Execute(input interface{}) (*Execution, error)
func (*StateMachine) SetDefaultHandler ¶
func (sm *StateMachine) SetDefaultHandler()
func (*StateMachine) SetResource ¶
func (sm *StateMachine) SetResource(lambda_arn *string)
func (*StateMachine) SetTaskFnHandlers ¶
func (sm *StateMachine) SetTaskFnHandlers(tfs *handler.TaskHandlers) error
func (*StateMachine) SetTaskHandler ¶
func (sm *StateMachine) SetTaskHandler(task_name string, resource_fn interface{}) error
func (*StateMachine) Tasks ¶
func (sm *StateMachine) Tasks() map[string]*TaskState
func (*StateMachine) Validate ¶
func (sm *StateMachine) Validate() error
type SucceedState ¶
type SucceedState struct { Type *string Comment *string `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` // contains filtered or unexported fields }
func (*SucceedState) Execute ¶
func (s *SucceedState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
func (*SucceedState) GetType ¶
func (s *SucceedState) GetType() *string
func (*SucceedState) SetType ¶
func (s *SucceedState) SetType(t *string)
func (*SucceedState) Validate ¶
func (s *SucceedState) Validate() error
type TaskState ¶
type TaskState struct { Type *string Comment *string `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` ResultPath *jsonpath.Path `json:",omitempty"` Parameters interface{} `json:",omitempty"` Resource *string `json:",omitempty"` Catch []*Catcher `json:",omitempty"` Retry []*Retrier `json:",omitempty"` // Maps a Lambda Handler Function TaskHandler interface{} `json:"-"` Next *string `json:",omitempty"` End *bool `json:",omitempty"` TimeoutSeconds int `json:",omitempty"` HeartbeatSeconds int `json:",omitempty"` // contains filtered or unexported fields }
func (*TaskState) Execute ¶
func (s *TaskState) Execute(ctx context.Context, input interface{}) (output interface{}, next *string, err error)
Input must include the Task name in $.Task
func (*TaskState) SetTaskHandler ¶
func (s *TaskState) SetTaskHandler(resourcefn interface{})
type WaitState ¶
type WaitState struct { Type *string Comment *string `json:",omitempty"` InputPath *jsonpath.Path `json:",omitempty"` OutputPath *jsonpath.Path `json:",omitempty"` Seconds *float64 `json:",omitempty"` SecondsPath *jsonpath.Path `json:",omitempty"` Timestamp *time.Time `json:",omitempty"` TimestampPath *jsonpath.Path `json:",omitempty"` Next *string `json:",omitempty"` End *bool `json:",omitempty"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.