model

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const WorkflowIDRegex = "^[a-z][a-z0-9._-]{1,34}[a-z0-9]$"

WorkflowIDRegex - Regex used to validate ID

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionDefinition

type ActionDefinition struct {
	Function string   `yaml:"function,omitempty"`
	Workflow string   `yaml:"workflow,omitempty"`
	Input    string   `yaml:"input,omitempty"`
	Secrets  []string `yaml:"secrets,omitempty"`
}

func (*ActionDefinition) Validate

func (o *ActionDefinition) Validate() error

type ActionState

type ActionState struct {
	StateCommon `yaml:",inline"`
	Action      *ActionDefinition `yaml:"action"`
	Async       bool              `yaml:"async"`
	Timeout     string            `yaml:"timeout,omitempty"`
	Transform   string            `yaml:"transform,omitempty"`
	Transition  string            `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition `yaml:"catch,omitempty"`
}

func (*ActionState) ErrorDefinitions

func (o *ActionState) ErrorDefinitions() []ErrorDefinition

func (*ActionState) GetID

func (o *ActionState) GetID() string

func (*ActionState) GetTransitions

func (o *ActionState) GetTransitions() []string

func (*ActionState) Validate

func (o *ActionState) Validate() error

type BranchMode

type BranchMode int
const (
	BranchModeAnd BranchMode = iota
	BranchModeOr
)

func ParseBranchMode

func ParseBranchMode(s string) (BranchMode, error)

func (BranchMode) MarshalJSON

func (a BranchMode) MarshalJSON() ([]byte, error)

func (BranchMode) MarshalYAML

func (a BranchMode) MarshalYAML() (interface{}, error)

func (BranchMode) String

func (a BranchMode) String() string

func (*BranchMode) UnmarshalJSON

func (a *BranchMode) UnmarshalJSON(data []byte) error

func (*BranchMode) UnmarshalYAML

func (a *BranchMode) UnmarshalYAML(unmarshal func(interface{}) error) error

type CallbackState

type CallbackState struct {
	StateCommon `yaml:",inline"`
	Action      *ActionDefinition       `yaml:"action"`
	Event       *ConsumeEventDefinition `yaml:"event"`
	Timeout     string                  `yaml:"timeout,omitempty"`
	Transform   string                  `yaml:"transform,omitempty"`
	Transition  string                  `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition       `yaml:"catch,omitempty"`
}

func (*CallbackState) ErrorDefinitions

func (o *CallbackState) ErrorDefinitions() []ErrorDefinition

func (*CallbackState) GetID

func (o *CallbackState) GetID() string

func (*CallbackState) GetTransitions

func (o *CallbackState) GetTransitions() []string

func (*CallbackState) Validate

func (o *CallbackState) Validate() error

type ConsumeEventDefinition

type ConsumeEventDefinition struct {
	Type    string                 `yaml:"type"`
	Context map[string]interface{} `yaml:"context,omitempty"`
}

func (*ConsumeEventDefinition) Validate

func (o *ConsumeEventDefinition) Validate() error

type ConsumeEventState

type ConsumeEventState struct {
	StateCommon `yaml:",inline"`
	Event       *ConsumeEventDefinition `yaml:"event"`
	Timeout     string                  `yaml:"timeout,omitempty"`
	Transform   string                  `yaml:"transform,omitempty"`
	Transition  string                  `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition       `yaml:"catch,omitempty"`
}

func (*ConsumeEventState) ErrorDefinitions

func (o *ConsumeEventState) ErrorDefinitions() []ErrorDefinition

func (*ConsumeEventState) GetID

func (o *ConsumeEventState) GetID() string

func (*ConsumeEventState) GetTransitions

func (o *ConsumeEventState) GetTransitions() []string

func (*ConsumeEventState) Validate

func (o *ConsumeEventState) Validate() error

type DefaultStart

type DefaultStart struct {
	StartCommon `yaml:",inline"`
}

func (*DefaultStart) GetEvents

func (o *DefaultStart) GetEvents() []StartEventDefinition

func (*DefaultStart) Validate

func (o *DefaultStart) Validate() error

type DelayState

type DelayState struct {
	StateCommon `yaml:",inline"`
	Duration    string            `yaml:"duration"`
	Transform   string            `yaml:"transform,omitempty"`
	Transition  string            `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition `yaml:"catch,omitempty"`
}

func (*DelayState) ErrorDefinitions

func (o *DelayState) ErrorDefinitions() []ErrorDefinition

func (*DelayState) GetID

func (o *DelayState) GetID() string

func (*DelayState) GetTransitions

func (o *DelayState) GetTransitions() []string

func (*DelayState) Validate

func (o *DelayState) Validate() error

type ErrorDefinition

type ErrorDefinition struct {
	Error      string           `yaml:"error"`
	Retry      *RetryDefinition `yaml:"retry,omitempty"`
	Transition string           `yaml:"transition,omitempty"`
}

func (*ErrorDefinition) Validate

func (o *ErrorDefinition) Validate() error

type ErrorState

type ErrorState struct {
	StateCommon `yaml:",inline"`
	Error       string   `yaml:"error"`
	Message     string   `yaml:"message"`
	Args        []string `yaml:"args,omitempty"`
	Transform   string   `yaml:"transform,omitempty"`
	Transition  string   `yaml:"transition,omitempty"`
}

func (*ErrorState) ErrorDefinitions

func (o *ErrorState) ErrorDefinitions() []ErrorDefinition

func (*ErrorState) GetArgs

func (o *ErrorState) GetArgs() []string

func (*ErrorState) GetID

func (o *ErrorState) GetID() string

func (*ErrorState) GetTransitions

func (o *ErrorState) GetTransitions() []string

func (*ErrorState) Validate

func (o *ErrorState) Validate() error

type EventConditionDefinition

type EventConditionDefinition struct {
	Event      ConsumeEventDefinition `yaml:"event"`
	Transform  string                 `yaml:"transform,omitempty"`
	Transition string                 `yaml:"transition,omitempty"`
}

type EventStart

type EventStart struct {
	StartCommon `yaml:",inline"`
	Event       *StartEventDefinition `yaml:"event"`
}

func (*EventStart) GetEvents

func (o *EventStart) GetEvents() []StartEventDefinition

func (*EventStart) Validate

func (o *EventStart) Validate() error

type EventsAndStart

type EventsAndStart struct {
	StartCommon `yaml:",inline"`
	LifeSpan    string                 `yaml:"lifespan,omitempty"`
	Correlate   []string               `yaml:"correlate,omitempty"`
	Events      []StartEventDefinition `yaml:"events"`
}

func (*EventsAndStart) GetEvents

func (o *EventsAndStart) GetEvents() []StartEventDefinition

func (*EventsAndStart) Validate

func (o *EventsAndStart) Validate() error

type EventsAndState

type EventsAndState struct {
	StateCommon `yaml:",inline"`
	Events      []EventConditionDefinition `yaml:"events"`
	Timeout     string                     `yaml:"timeout,omitempty"`
	Transform   string                     `yaml:"transform,omitempty"`
	Transition  string                     `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition          `yaml:"catch,omitempty"`
}

func (*EventsAndState) ErrorDefinitions

func (o *EventsAndState) ErrorDefinitions() []ErrorDefinition

func (*EventsAndState) GetEvents

func (o *EventsAndState) GetEvents() []EventConditionDefinition

func (*EventsAndState) GetID

func (o *EventsAndState) GetID() string

func (*EventsAndState) GetTransitions

func (o *EventsAndState) GetTransitions() []string

func (*EventsAndState) Validate

func (o *EventsAndState) Validate() error

type EventsXorStart

type EventsXorStart struct {
	StartCommon `yaml:",inline"`
	Events      []StartEventDefinition `yaml:"events"`
}

func (*EventsXorStart) GetEvents

func (o *EventsXorStart) GetEvents() []StartEventDefinition

func (*EventsXorStart) Validate

func (o *EventsXorStart) Validate() error

type EventsXorState

type EventsXorState struct {
	StateCommon `yaml:",inline"`
	Events      []EventConditionDefinition `yaml:"events"`
	Timeout     string                     `yaml:"timeout,omitempty"`
	Catch       []ErrorDefinition          `yaml:"catch,omitempty"`
}

func (*EventsXorState) ErrorDefinitions

func (o *EventsXorState) ErrorDefinitions() []ErrorDefinition

func (*EventsXorState) GetEvents

func (o *EventsXorState) GetEvents() []EventConditionDefinition

func (*EventsXorState) GetID

func (o *EventsXorState) GetID() string

func (*EventsXorState) GetTransitions

func (o *EventsXorState) GetTransitions() []string

func (*EventsXorState) Validate

func (o *EventsXorState) Validate() error

type ForEachState

type ForEachState struct {
	StateCommon `yaml:",inline"`
	Array       string            `yaml:"array"`
	Action      *ActionDefinition `yaml:"action"`
	Timeout     string            `yaml:"timeout,omitempty"`
	Transform   string            `yaml:"transform,omitempty"`
	Transition  string            `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition `yaml:"catch,omitempty"`
}

func (*ForEachState) ErrorDefinitions

func (o *ForEachState) ErrorDefinitions() []ErrorDefinition

func (*ForEachState) GetID

func (o *ForEachState) GetID() string

func (*ForEachState) GetTransitions

func (o *ForEachState) GetTransitions() []string

func (*ForEachState) Validate

func (o *ForEachState) Validate() error

type FunctionDefinition

type FunctionDefinition struct {
	ID    string `yaml:"id"`
	Image string `yaml:"image"`
	Size  Size   `yaml:"size,omitempty"`
	Cmd   string `yaml:"cmd,omitempty"`
}

func (*FunctionDefinition) Validate

func (o *FunctionDefinition) Validate() error

type GenerateEventDefinition

type GenerateEventDefinition struct {
	Type            string                 `yaml:"type"`
	Source          string                 `yaml:"source"`
	Data            string                 `yaml:"string"`
	DataContentType string                 `yaml:"data_content_type,omitempty"`
	Context         map[string]interface{} `yaml:"context,omitempty"`
}

func (*GenerateEventDefinition) Validate

func (o *GenerateEventDefinition) Validate() error

type GenerateEventState

type GenerateEventState struct {
	StateCommon `yaml:",inline"`
	Event       *GenerateEventDefinition `yaml:"event"`
	Transform   string                   `yaml:"transform,omitempty"`
	Transition  string                   `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition        `yaml:"catch,omitempty"`
}

func (*GenerateEventState) ErrorDefinitions

func (o *GenerateEventState) ErrorDefinitions() []ErrorDefinition

func (*GenerateEventState) GetID

func (o *GenerateEventState) GetID() string

func (*GenerateEventState) GetTransitions

func (o *GenerateEventState) GetTransitions() []string

func (*GenerateEventState) Validate

func (o *GenerateEventState) Validate() error

type NoopState

type NoopState struct {
	StateCommon `yaml:",inline"`
	Transform   string            `yaml:"transform,omitempty"`
	Transition  string            `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition `yaml:"catch,omitempty"`
}

func (*NoopState) ErrorDefinitions

func (o *NoopState) ErrorDefinitions() []ErrorDefinition

func (*NoopState) GetID

func (o *NoopState) GetID() string

func (*NoopState) GetTransitions

func (o *NoopState) GetTransitions() []string

func (*NoopState) Validate

func (o *NoopState) Validate() error

type ParallelState

type ParallelState struct {
	StateCommon `yaml:",inline"`
	Actions     []ActionDefinition `yaml:"actions"`
	Mode        BranchMode         `yaml:"mode,omitempty"`
	Timeout     string             `yaml:"timeout,omitempty"`
	Transform   string             `yaml:"transform,omitempty"`
	Transition  string             `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition  `yaml:"catch,omitempty"`
}

func (*ParallelState) ErrorDefinitions

func (o *ParallelState) ErrorDefinitions() []ErrorDefinition

func (*ParallelState) GetActions

func (o *ParallelState) GetActions() []ActionDefinition

func (*ParallelState) GetID

func (o *ParallelState) GetID() string

func (*ParallelState) GetTransitions

func (o *ParallelState) GetTransitions() []string

func (*ParallelState) Validate

func (o *ParallelState) Validate() error

type ProduceEventDefinition

type ProduceEventDefinition struct {
	Type    string                 `yaml:"type,omitempty"`
	Source  string                 `yaml:"source,omitempty"`
	Data    string                 `yaml:"data"`
	Context map[string]interface{} `yaml:"context"`
}

func (*ProduceEventDefinition) Validate

func (o *ProduceEventDefinition) Validate() error

type RetryDefinition

type RetryDefinition struct {
	MaxAttempts int     `yaml:"max_attempts"`
	Delay       string  `yaml:"delay,omitempty"`
	Multiplier  float64 `yaml:"multiplier,omitempty"`
}

func (*RetryDefinition) Validate

func (o *RetryDefinition) Validate() error

type ScheduledStart

type ScheduledStart struct {
	StartCommon `yaml:",inline"`
	Cron        string `yaml:"cron,omitempty"`
}

func (*ScheduledStart) GetEvents

func (o *ScheduledStart) GetEvents() []StartEventDefinition

func (*ScheduledStart) Validate

func (o *ScheduledStart) Validate() error

type SchemaDefinition

type SchemaDefinition struct {
	ID     string      `yaml:"id"`
	Schema interface{} `yaml:"schema"`
}

func (*SchemaDefinition) Validate

func (o *SchemaDefinition) Validate() error

type Size

type Size int

Size string enum to differentiate function sizes

const (
	SmallSize Size = iota
	MediumSize
	LargeSize
)

func ParseSize

func ParseSize(s string) (Size, error)

func (Size) MarshalJSON

func (a Size) MarshalJSON() ([]byte, error)

func (Size) MarshalYAML

func (a Size) MarshalYAML() (interface{}, error)

func (Size) String

func (a Size) String() string

func (*Size) UnmarshalJSON

func (a *Size) UnmarshalJSON(data []byte) error

func (*Size) UnmarshalYAML

func (a *Size) UnmarshalYAML(unmarshal func(interface{}) error) error

type StartCommon

type StartCommon struct {
	Type  StartType `yaml:"type"`
	State string    `yaml:"state,omitempty"`
}

func (*StartCommon) GetState

func (o *StartCommon) GetState() string

func (*StartCommon) GetType

func (o *StartCommon) GetType() StartType

type StartDefinition

type StartDefinition interface {
	GetState() string
	GetType() StartType
	Validate() error
	GetEvents() []StartEventDefinition
}

type StartEventDefinition

type StartEventDefinition struct {
	Type    string                 `yaml:"type"`
	Filters map[string]interface{} `yaml:"filters,omitempty"`
}

FIXME: Going to be renamed later

func (*StartEventDefinition) Validate

func (o *StartEventDefinition) Validate() error

type StartType

type StartType int
const (
	StartTypeDefault StartType = iota
	StartTypeScheduled
	StartTypeEvent
	StartTypeEventsXor
	StartTypeEventsAnd
)

func ParseStartType

func ParseStartType(s string) (StartType, error)

func (StartType) MarshalJSON

func (a StartType) MarshalJSON() ([]byte, error)

func (StartType) MarshalYAML

func (a StartType) MarshalYAML() (interface{}, error)

func (StartType) String

func (a StartType) String() string

func (*StartType) UnmarshalJSON

func (a *StartType) UnmarshalJSON(data []byte) error

func (*StartType) UnmarshalYAML

func (a *StartType) UnmarshalYAML(unmarshal func(interface{}) error) error

type State

type State interface {
	GetID() string
	GetType() StateType
	Validate() error
	ErrorDefinitions() []ErrorDefinition
	GetTransitions() []string
	// contains filtered or unexported methods
}

type StateCommon

type StateCommon struct {
	ID   string    `yaml:"id"`
	Type StateType `yaml:"type"`
}

func (*StateCommon) GetType

func (o *StateCommon) GetType() StateType

type StateType

type StateType int
const (
	StateTypeAction StateType = iota
	StateTypeConsumeEvent
	StateTypeDelay
	StateTypeEventsAnd
	StateTypeEventsXor
	StateTypeError
	StateTypeForEach
	StateTypeGenerateEvent
	StateTypeNoop
	StateTypeParallel
	StateTypeSwitch
	StateTypeValidate
	StateTypeConsume
	StateTypeCallback
)

func ParseStateType

func ParseStateType(s string) (StateType, error)

func (StateType) MarshalJSON

func (a StateType) MarshalJSON() ([]byte, error)

func (StateType) MarshalYAML

func (a StateType) MarshalYAML() (interface{}, error)

func (StateType) String

func (a StateType) String() string

func (*StateType) UnmarshalJSON

func (a *StateType) UnmarshalJSON(data []byte) error

func (*StateType) UnmarshalYAML

func (a *StateType) UnmarshalYAML(unmarshal func(interface{}) error) error

type SwitchConditionDefinition

type SwitchConditionDefinition struct {
	Condition  string `yaml:"condition"`
	Transform  string `yaml:"transform,omitempty"`
	Transition string `yaml:"transition,omitempty"`
}

func (*SwitchConditionDefinition) Validate

func (o *SwitchConditionDefinition) Validate() error

type SwitchState

type SwitchState struct {
	StateCommon       `yaml:",inline"`
	Conditions        []SwitchConditionDefinition `yaml:"conditions"`
	Default           string                      `yaml:"default,omitempty"`
	DefaultTransform  string                      `yaml:"defaultTransform,omitempty"`
	DefaultTransition string                      `yaml:"defaultTransition,omitempty"`
	Catch             []ErrorDefinition           `yaml:"catch,omitempty"`
}

func (*SwitchState) ErrorDefinitions

func (o *SwitchState) ErrorDefinitions() []ErrorDefinition

func (*SwitchState) GetConditions

func (o *SwitchState) GetConditions() []SwitchConditionDefinition

func (*SwitchState) GetID

func (o *SwitchState) GetID() string

func (*SwitchState) GetTransitions

func (o *SwitchState) GetTransitions() []string

func (*SwitchState) Validate

func (o *SwitchState) Validate() error

type TimeoutDefinition

type TimeoutDefinition struct {
	Interrupt string `yaml:"interrupt,omitempty"`
	Kill      string `yaml:"kill,omitempty"`
}

func (*TimeoutDefinition) Validate

func (o *TimeoutDefinition) Validate() error

type ValidateState

type ValidateState struct {
	StateCommon `yaml:",inline"`
	Subject     string            `yaml:"subject"`
	Schema      interface{}       `yaml:"schema"`
	Transform   string            `yaml:"transform,omitempty"`
	Transition  string            `yaml:"transition,omitempty"`
	Catch       []ErrorDefinition `yaml:"catch,omitempty"`
}

func (*ValidateState) ErrorDefinitions

func (o *ValidateState) ErrorDefinitions() []ErrorDefinition

func (*ValidateState) GetID

func (o *ValidateState) GetID() string

func (*ValidateState) GetTransitions

func (o *ValidateState) GetTransitions() []string

func (*ValidateState) Validate

func (o *ValidateState) Validate() error

type Workflow

type Workflow struct {
	ID          string               `yaml:"id"`
	Name        string               `yaml:"name,omitempty"`
	Description string               `yaml:"description,omitempty"`
	Functions   []FunctionDefinition `yaml:"functions,omitempty"`
	Schemas     []SchemaDefinition   `yaml:"schemas,omitempty"`
	States      []State              `yaml:"states,omitempty"`
	Timeouts    *TimeoutDefinition   `yaml:"timeouts,omitempty"`
	Start       StartDefinition      `yaml:"start,omitempty"`
}

func (*Workflow) GetFunction

func (o *Workflow) GetFunction(id string) (*FunctionDefinition, error)

func (*Workflow) GetFunctions

func (o *Workflow) GetFunctions() []FunctionDefinition

func (*Workflow) GetSchemas

func (o *Workflow) GetSchemas() []SchemaDefinition

func (*Workflow) GetStartDefinition

func (o *Workflow) GetStartDefinition() StartDefinition

func (*Workflow) GetStartState

func (o *Workflow) GetStartState() State

func (*Workflow) GetStates

func (o *Workflow) GetStates() []State

func (*Workflow) GetStatesMap

func (o *Workflow) GetStatesMap() map[string]State

GetStatesMap : Get workflow states as a map

func (*Workflow) Load

func (o *Workflow) Load(data []byte) error

func (*Workflow) UnmarshalYAML

func (o *Workflow) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL