Documentation
¶
Index ¶
- Constants
- Variables
- func EventStructLevelValidation(v *validator.Validate, structLevel *validator.StructLevel)
- type Action
- type ActionDataFilter
- type ActionMode
- type Auth
- type AuthProperties
- type AuthType
- type BaseAuthProperties
- type BaseDataCondition
- type BaseEventCondition
- type BaseState
- func (s *BaseState) GetCompensatedBy() string
- func (s *BaseState) GetEnd() *End
- func (s *BaseState) GetID() string
- func (s *BaseState) GetMetadata() *Metadata
- func (s *BaseState) GetName() string
- func (s *BaseState) GetOnErrors() []OnError
- func (s *BaseState) GetStateDataFilter() *StateDataFilter
- func (s *BaseState) GetTransition() *Transition
- func (s *BaseState) GetType() StateType
- func (s *BaseState) GetUsedForCompensation() bool
- type BaseSwitchState
- type BaseWorkflow
- type BasicAuthProperties
- type BearerAuthProperties
- type Branch
- type BranchTimeouts
- type CallbackState
- type CallbackStateTimeout
- type Common
- type CompletionType
- type Constants
- type ContinueAs
- type Correlation
- type Cron
- type DataBasedSwitchState
- type DataBasedSwitchStateTimeout
- type DataCondition
- type DataInputSchema
- type DefaultCondition
- type DelayState
- type End
- type EndDataCondition
- type EndEventCondition
- type Error
- type Event
- type EventBasedSwitchState
- type EventBasedSwitchStateTimeout
- type EventCondition
- type EventDataFilter
- type EventKind
- type EventRef
- type EventState
- type EventStateTimeout
- type ForEachModeType
- type ForEachState
- type ForEachStateTimeout
- type Function
- type FunctionRef
- type FunctionType
- type GrantType
- type InjectState
- type InjectStateTimeout
- type Metadata
- type OAuth2AuthProperties
- type OnError
- type OnEvents
- type OperationState
- type OperationStateTimeout
- type ParallelState
- type ParallelStateTimeout
- type ProduceEvent
- type Retry
- type Schedule
- type Secrets
- type Sleep
- type SleepState
- type SleepStateTimeout
- type Start
- type State
- type StateDataFilter
- type StateExecTimeout
- type StateType
- type Timeouts
- type Transition
- type TransitionDataCondition
- type TransitionEventCondition
- type Workflow
- type WorkflowExecTimeout
- type WorkflowRef
Constants ¶
const ( //StateTypeDelay ... StateTypeDelay = "delay" // StateTypeEvent ... StateTypeEvent = "event" // StateTypeOperation ... StateTypeOperation = "operation" // StateTypeParallel ... StateTypeParallel = "parallel" // StateTypeSwitch ... StateTypeSwitch = "switch" // StateTypeForEach ... StateTypeForEach = "foreach" // StateTypeInject ... StateTypeInject = "inject" // StateTypeCallback ... StateTypeCallback = "callback" // StateTypeSleep ... StateTypeSleep = "sleep" // CompletionTypeAllOf ... CompletionTypeAllOf CompletionType = "allOf" // CompletionTypeAtLeast ... CompletionTypeAtLeast CompletionType = "atLeast" // ForEachModeTypeSequential ... ForEachModeTypeSequential ForEachModeType = "sequential" // ForEachModeTypeParallel ... ForEachModeTypeParallel ForEachModeType = "parallel" )
const ( // DefaultExpressionLang ... DefaultExpressionLang = "jq" // ActionModeSequential ... ActionModeSequential ActionMode = "sequential" // ActionModeParallel ... ActionModeParallel ActionMode = "parallel" // UnlimitedTimeout description for unlimited timeouts UnlimitedTimeout = "unlimited" )
Variables ¶
var FALSE = false
FALSE used by bool fields that needs a boolean pointer
var TRUE = true
TRUE used by bool fields that needs a boolean pointer
Functions ¶
func EventStructLevelValidation ¶
func EventStructLevelValidation(v *validator.Validate, structLevel *validator.StructLevel)
EventStructLevelValidation custom validator for event kind consumed
Types ¶
type Action ¶
type Action struct {
// Unique action definition name
Name string `json:"name,omitempty"`
FunctionRef FunctionRef `json:"functionRef,omitempty"`
// References a 'trigger' and 'result' reusable event definitions
EventRef EventRef `json:"eventRef,omitempty"`
// References a sub-workflow to be executed
SubFlowRef WorkflowRef `json:"subFlowRef,omitempty"`
// Sleep Defines time period workflow execution should sleep before / after function execution
Sleep Sleep `json:"sleep,omitempty"`
// RetryRef References a defined workflow retry definition. If not defined the default retry policy is assumed
RetryRef string `json:"retryRef,omitempty"`
// List of unique references to defined workflow errors for which the action should not be retried. Used only when `autoRetries` is set to `true`
NonRetryableErrors []string `json:"nonRetryableErrors,omitempty" validate:"omitempty,min=1"`
// List of unique references to defined workflow errors for which the action should be retried. Used only when `autoRetries` is set to `false`
RetryableErrors []string `json:"retryableErrors,omitempty" validate:"omitempty,min=1"`
// Action data filter
ActionDataFilter ActionDataFilter `json:"actionDataFilter,omitempty"`
}
Action ...
type ActionDataFilter ¶
type ActionDataFilter struct {
// Workflow expression that selects state data that the state action can use
FromStateData string `json:"fromStateData,omitempty"`
// Workflow expression that filters the actions' data results
Results string `json:"results,omitempty"`
// Workflow expression that selects a state data element to which the action results should be added/merged into. If not specified, denote, the top-level state data element
ToStateData string `json:"toStateData,omitempty"`
}
ActionDataFilter ...
type Auth ¶ added in v2.1.0
type Auth struct {
// Name Unique auth definition name
Name string `json:"name" validate:"required"`
// Scheme Defines the auth type
Scheme AuthType `json:"scheme,omitempty" validate:"omitempty,min=1"`
// Properties ...
Properties AuthProperties `json:"properties" validate:"required"`
}
Auth ...
func (*Auth) UnmarshalJSON ¶ added in v2.1.0
UnmarshalJSON ...
type AuthProperties ¶ added in v2.1.0
type AuthProperties interface {
// GetMetadata ...
GetMetadata() *Metadata
// GetSecret ...
GetSecret() string
}
AuthProperties ...
type BaseAuthProperties ¶ added in v2.1.0
type BaseAuthProperties struct {
Common
// Secret Expression referencing a workflow secret that contains all needed auth info
Secret string `json:"secret,omitempty"`
}
BaseAuthProperties ...
func (*BaseAuthProperties) GetMetadata ¶ added in v2.1.0
func (b *BaseAuthProperties) GetMetadata() *Metadata
GetMetadata ...
func (*BaseAuthProperties) GetSecret ¶ added in v2.1.0
func (b *BaseAuthProperties) GetSecret() string
GetSecret ...
func (*BaseAuthProperties) UnmarshalJSON ¶ added in v2.1.0
func (b *BaseAuthProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type BaseDataCondition ¶
type BaseDataCondition struct {
// Data condition name
Name string `json:"name,omitempty"`
// Workflow expression evaluated against state data. Must evaluate to true or false
Condition string `json:"condition" validate:"required"`
Metadata Metadata `json:"metadata,omitempty"`
}
BaseDataCondition ...
func (*BaseDataCondition) GetCondition ¶
func (b *BaseDataCondition) GetCondition() string
GetCondition ...
func (*BaseDataCondition) GetMetadata ¶
func (b *BaseDataCondition) GetMetadata() Metadata
GetMetadata ...
type BaseEventCondition ¶
type BaseEventCondition struct {
// Event condition name
Name string `json:"name,omitempty"`
// References a unique event name in the defined workflow events
EventRef string `json:"eventRef" validate:"required"`
// Event data filter definition
EventDataFilter EventDataFilter `json:"eventDataFilter,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
}
BaseEventCondition ...
func (*BaseEventCondition) GetEventDataFilter ¶
func (e *BaseEventCondition) GetEventDataFilter() EventDataFilter
GetEventDataFilter ...
func (*BaseEventCondition) GetEventRef ¶
func (e *BaseEventCondition) GetEventRef() string
GetEventRef ...
func (*BaseEventCondition) GetMetadata ¶
func (e *BaseEventCondition) GetMetadata() Metadata
GetMetadata ...
type BaseState ¶
type BaseState struct {
// Unique State id
ID string `json:"id,omitempty" validate:"omitempty,min=1"`
// State name
Name string `json:"name" validate:"required"`
// State type
Type StateType `json:"type" validate:"required"`
// States error handling and retries definitions
OnErrors []OnError `json:"onErrors,omitempty" validate:"omitempty,dive"`
// Next transition of the workflow after the time delay
Transition *Transition `json:"transition,omitempty"`
// State data filter
StateDataFilter *StateDataFilter `json:"stateDataFilter,omitempty"`
// Unique Name of a workflow state which is responsible for compensation of this state
CompensatedBy string `json:"compensatedBy,omitempty" validate:"omitempty,min=1"`
// If true, this state is used to compensate another state. Default is false
UsedForCompensation bool `json:"usedForCompensation,omitempty"`
// State end definition
End *End `json:"end,omitempty"`
Metadata *Metadata `json:"metadata,omitempty"`
}
BaseState ...
func (*BaseState) GetCompensatedBy ¶
GetCompensatedBy ...
func (*BaseState) GetStateDataFilter ¶
func (s *BaseState) GetStateDataFilter() *StateDataFilter
GetStateDataFilter ...
func (*BaseState) GetUsedForCompensation ¶
GetUsedForCompensation ...
type BaseSwitchState ¶
type BaseSwitchState struct {
BaseState
// Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
DefaultCondition DefaultCondition `json:"defaultCondition,omitempty"`
}
BaseSwitchState ...
type BaseWorkflow ¶
type BaseWorkflow struct {
// Workflow unique identifier
ID string `json:"id" validate:"omitempty,min=1"`
// Key Domain-specific workflow identifier
Key string `json:"key,omitempty" validate:"omitempty,min=1"`
// Workflow name
Name string `json:"name" validate:"required"`
// Workflow description
Description string `json:"description,omitempty"`
// Workflow version
Version string `json:"version" validate:"omitempty,min=1"`
Start *Start `json:"start" validate:"required"`
// Annotations List of helpful terms describing the workflows intended purpose, subject areas, or other important qualities
Annotations []string `json:"annotations,omitempty"`
// DataInputSchema URI of the JSON Schema used to validate the workflow data input
DataInputSchema *DataInputSchema `json:"dataInputSchema,omitempty"`
// Serverless Workflow schema version
SpecVersion string `json:"specVersion,omitempty" validate:"required"`
// Secrets allow you to access sensitive information, such as passwords, OAuth tokens, ssh keys, etc inside your Workflow Expressions.
Secrets Secrets `json:"secrets,omitempty"`
// Constants Workflow constants are used to define static, and immutable, data which is available to Workflow Expressions.
Constants *Constants `json:"constants,omitempty"`
// Identifies the expression language used for workflow expressions. Default is 'jq'
ExpressionLang string `json:"expressionLang,omitempty" validate:"omitempty,min=1"`
// Timeouts definition for Workflow, State, Action, Branch, and Event consumption.
Timeouts *Timeouts `json:"timeouts,omitempty"`
// Errors declarations for this Workflow definition
Errors []Error `json:"errors,omitempty"`
// If 'true', workflow instances is not terminated when there are no active execution paths. Instance can be terminated via 'terminate end definition' or reaching defined 'execTimeout'
KeepActive bool `json:"keepActive,omitempty"`
// Metadata custom information shared with the runtime
Metadata Metadata `json:"metadata,omitempty"`
// AutoRetries If set to true, actions should automatically be retried on unchecked errors. Default is false
AutoRetries bool `json:"autoRetries,omitempty"`
// Auth definitions can be used to define authentication information that should be applied to resources defined in the operation
// property of function definitions. It is not used as authentication information for the function invocation,
// but just to access the resource containing the function invocation information.
Auth *Auth `json:"auth,omitempty"`
}
BaseWorkflow describes the partial Workflow definition that does not rely on generic interfaces to make it easy for custom unmarshalers implementations to unmarshal the common data structure.
type BasicAuthProperties ¶ added in v2.1.0
type BasicAuthProperties struct {
BaseAuthProperties
// Username String or a workflow expression. Contains the username
Username string `json:"username" validate:"required"`
// Password String or a workflow expression. Contains the user password
Password string `json:"password" validate:"required"`
}
BasicAuthProperties Basic Auth Info
func (*BasicAuthProperties) UnmarshalJSON ¶ added in v2.1.0
func (b *BasicAuthProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type BearerAuthProperties ¶ added in v2.1.0
type BearerAuthProperties struct {
BaseAuthProperties
// Token String or a workflow expression. Contains the token
Token string `json:"token" validate:"required"`
}
BearerAuthProperties Bearer auth information
func (*BearerAuthProperties) UnmarshalJSON ¶ added in v2.1.0
func (b *BearerAuthProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type Branch ¶
type Branch struct {
// Branch name
Name string `json:"name" validate:"required"`
// Actions to be executed in this branch
Actions []Action `json:"actions" validate:"required,min=1"`
// Timeouts State specific timeouts
Timeouts BranchTimeouts `json:"timeouts,omitempty"`
}
Branch Definition
type BranchTimeouts ¶ added in v2.1.0
type BranchTimeouts struct {
// ActionExecTimeout Single actions definition execution timeout duration (ISO 8601 duration format)
ActionExecTimeout string `json:"actionExecTimeout,omitempty" validate:"omitempty,min=1"`
// BranchExecTimeout Single branch execution timeout duration (ISO 8601 duration format)
BranchExecTimeout string `json:"branchExecTimeout,omitempty" validate:"omitempty,min=1"`
}
BranchTimeouts ...
type CallbackState ¶
type CallbackState struct {
BaseState
// Defines the action to be executed
Action Action `json:"action" validate:"required"`
// References a unique callback event name in the defined workflow events
EventRef string `json:"eventRef" validate:"required"`
// Time period to wait for incoming events (ISO 8601 format)
Timeouts CallbackStateTimeout `json:"timeouts" validate:"required"`
// Event data filter
EventDataFilter EventDataFilter `json:"eventDataFilter,omitempty"`
}
CallbackState ...
type CallbackStateTimeout ¶ added in v2.1.0
type CallbackStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
ActionExecTimeout string `json:"actionExecTimeout,omitempty"`
EventTimeout string `json:"eventTimeout,omitempty"`
}
CallbackStateTimeout ...
type Common ¶
type Common struct {
// Metadata information
Metadata Metadata `json:"metadata,omitempty"`
}
Common schema for Serverless Workflow specification
type CompletionType ¶
type CompletionType string
CompletionType Option types on how to complete branch execution.
type Constants ¶ added in v2.1.0
type Constants struct {
// Data represents the generic structure of the constants value
Data map[string]json.RawMessage `json:",omitempty"`
}
Constants Workflow constants are used to define static, and immutable, data which is available to Workflow Expressions.
func (*Constants) UnmarshalJSON ¶ added in v2.1.0
UnmarshalJSON ...
type ContinueAs ¶ added in v2.1.0
type ContinueAs struct {
WorkflowRef
// TODO: add object or string data type
// If string type, an expression which selects parts of the states data output to become the workflow data input of continued execution. If object type, a custom object to become the workflow data input of the continued execution
Data interface{} `json:"data,omitempty"`
// WorkflowExecTimeout Workflow execution timeout to be used by the workflow continuing execution. Overwrites any specific settings set by that workflow
WorkflowExecTimeout WorkflowExecTimeout `json:"workflowExecTimeout,omitempty"`
}
ContinueAs ...
type Correlation ¶
type Correlation struct {
// CloudEvent Extension Context Attribute name
ContextAttributeName string `json:"contextAttributeName" validate:"required"`
// CloudEvent Extension Context Attribute value
ContextAttributeValue string `json:"contextAttributeValue,omitempty"`
}
Correlation ...
type Cron ¶
type Cron struct {
// Repeating interval (cron expression) describing when the workflow instance should be created
Expression string `json:"expression" validate:"required"`
// Specific date and time (ISO 8601 format) when the cron expression invocation is no longer valid
ValidUntil string `json:"validUntil,omitempty"`
}
Cron ...
func (*Cron) UnmarshalJSON ¶
UnmarshalJSON custom unmarshal function for Cron
type DataBasedSwitchState ¶
type DataBasedSwitchState struct {
BaseSwitchState
DataConditions []DataCondition `json:"dataConditions" validate:"required,min=1,dive"`
Timeouts DataBasedSwitchStateTimeout `json:"timeouts,omitempty"`
}
DataBasedSwitchState Permits transitions to other states based on data conditions
func (*DataBasedSwitchState) UnmarshalJSON ¶
func (j *DataBasedSwitchState) UnmarshalJSON(data []byte) error
UnmarshalJSON implementation for json Unmarshal function for the Databasedswitch type
type DataBasedSwitchStateTimeout ¶ added in v2.1.0
type DataBasedSwitchStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
}
DataBasedSwitchStateTimeout ...
type DataCondition ¶
DataCondition ...
type DataInputSchema ¶ added in v2.1.0
type DataInputSchema struct {
Schema string `json:"schema" validate:"required"`
FailOnValidationErrors *bool `json:"failOnValidationErrors" validate:"required"`
}
DataInputSchema ...
func (*DataInputSchema) UnmarshalJSON ¶ added in v2.1.0
func (d *DataInputSchema) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type DefaultCondition ¶ added in v2.1.0
type DefaultCondition struct {
Transition Transition `json:"transition,omitempty"`
End End `json:"end,omitempty"`
}
DefaultCondition Can be either a transition or end definition
type DelayState ¶
type DelayState struct {
BaseState
// Amount of time (ISO 8601 format) to delay
TimeDelay string `json:"timeDelay" validate:"required"`
}
DelayState Causes the workflow execution to delay for a specified duration
type End ¶
type End struct {
// If true, completes all execution flows in the given workflow instance
Terminate bool `json:"terminate,omitempty"`
// Defines events that should be produced
ProduceEvents []ProduceEvent `json:"produceEvents,omitempty"`
// If set to true, triggers workflow compensation. Default is false
Compensate bool `json:"compensate,omitempty"`
ContinueAs ContinueAs `json:"continueAs,omitempty"`
}
End definition
type EndDataCondition ¶
type EndDataCondition struct {
BaseDataCondition
// Workflow end definition
End End `json:"end" validate:"required"`
}
EndDataCondition ...
type EndEventCondition ¶
type EndEventCondition struct {
BaseEventCondition
// Explicit transition to end
End End `json:"end" validate:"required"`
}
EndEventCondition Switch state data event condition
type Error ¶
type Error struct {
// Name Domain-specific error name
Name string `json:"name" validate:"required"`
// Code OnError code. Can be used in addition to the name to help runtimes resolve to technical errors/exceptions. Should not be defined if error is set to '*'
Code string `json:"code,omitempty" validate:"omitempty,min=1"`
// OnError description
Description string `json:"description,omitempty"`
}
Error declaration for workflow definitions
type Event ¶
type Event struct {
Common
// Unique event name
Name string `json:"name" validate:"required"`
// CloudEvent source
Source string `json:"source,omitempty"`
// CloudEvent type
Type string `json:"type" validate:"required"`
// Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'
Kind EventKind `json:"kind,omitempty"`
// If `true`, only the Event payload is accessible to consuming Workflow states. If `false`, both event payload and context attributes should be accessible"
DataOnly bool `json:"dataOnly,omitempty"`
// CloudEvent correlation definitions
Correlation []Correlation `json:"correlation,omitempty" validate:"omitempty,dive"`
}
Event ...
type EventBasedSwitchState ¶
type EventBasedSwitchState struct {
BaseSwitchState
// Defines conditions evaluated against events
EventConditions []EventCondition `json:"eventConditions" validate:"required,min=1,dive"`
// State specific timeouts
Timeouts EventBasedSwitchStateTimeout `json:"timeouts,omitempty"`
}
EventBasedSwitchState Permits transitions to other states based on events
func (*EventBasedSwitchState) UnmarshalJSON ¶
func (j *EventBasedSwitchState) UnmarshalJSON(data []byte) error
UnmarshalJSON implementation for json Unmarshal function for the Eventbasedswitch type
type EventBasedSwitchStateTimeout ¶ added in v2.1.0
type EventBasedSwitchStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
EventTimeout string `json:"eventTimeout,omitempty"`
}
EventBasedSwitchStateTimeout ...
type EventCondition ¶
type EventCondition interface {
GetName() string
GetEventRef() string
GetEventDataFilter() EventDataFilter
GetMetadata() Metadata
}
EventCondition ...
type EventDataFilter ¶
type EventDataFilter struct {
// Workflow expression that filters of the event data (payload)
Data string `json:"data,omitempty"`
// Workflow expression that selects a state data element to which the event payload should be added/merged into. If not specified, denotes, the top-level state data element.
ToStateData string `json:"toStateData,omitempty"`
}
EventDataFilter ...
type EventRef ¶
type EventRef struct {
// Reference to the unique name of a 'produced' event definition
TriggerEventRef string `json:"triggerEventRef" validate:"required"`
// Reference to the unique name of a 'consumed' event definition
ResultEventRef string `json:"resultEventRef" validate:"required"`
// TODO: create StringOrMap structure
// If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by 'triggerEventRef'. If object type, a custom object to become the data (payload) of the event referenced by 'triggerEventRef'.
Data interface{} `json:"data,omitempty"`
// Add additional extension context attributes to the produced event
ContextAttributes map[string]interface{} `json:"contextAttributes,omitempty"`
}
EventRef ...
type EventState ¶
type EventState struct {
BaseState
// If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed
Exclusive bool `json:"exclusive,omitempty"`
// Define the events to be consumed and optional actions to be performed
OnEvents []OnEvents `json:"onEvents" validate:"required,min=1,dive"`
// State specific timeouts
Timeout EventStateTimeout `json:"timeouts,omitempty"`
}
EventState This state is used to wait for events from event sources, then consumes them and invoke one or more actions to run in sequence or parallel
func (*EventState) UnmarshalJSON ¶
func (e *EventState) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type EventStateTimeout ¶ added in v2.1.0
type EventStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
ActionExecTimeout string `json:"actionExecTimeout,omitempty"`
EventTimeout string `json:"eventTimeout,omitempty"`
}
EventStateTimeout ...
type ForEachModeType ¶ added in v2.1.0
type ForEachModeType string
ForEachModeType Specifies how iterations are to be performed (sequentially or in parallel)
type ForEachState ¶
type ForEachState struct {
BaseState
// Workflow expression selecting an array element of the states data
InputCollection string `json:"inputCollection" validate:"required"`
// Workflow expression specifying an array element of the states data to add the results of each iteration
OutputCollection string `json:"outputCollection,omitempty"`
// Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array
IterationParam string `json:"iterationParam" validate:"required"`
// Specifies how upper bound on how many iterations may run in parallel
BatchSize intstr.IntOrString `json:"batchSize,omitempty"`
// Actions to be executed for each of the elements of inputCollection
Actions []Action `json:"actions,omitempty"`
// State specific timeout
Timeouts ForEachStateTimeout `json:"timeouts,omitempty"`
// Mode Specifies how iterations are to be performed (sequentially or in parallel)
Mode ForEachModeType `json:"mode,omitempty"`
}
ForEachState ...
type ForEachStateTimeout ¶ added in v2.1.0
type ForEachStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
ActionExecTimeout string `json:"actionExecTimeout,omitempty"`
}
ForEachStateTimeout ...
type Function ¶
type Function struct {
Common
// Unique function name
Name string `json:"name" validate:"required"`
// If type is `rest`, <path_to_openapi_definition>#<operation_id>. If type is `rpc`, <path_to_grpc_proto_file>#<service_name>#<service_method>. If type is `expression`, defines the workflow expression.
Operation string `json:"operation" validate:"required"`
// Defines the function type. Is either `rest`, `rpc`, `expression` or `graphql`. Default is `rest`
Type FunctionType `json:"type,omitempty"`
// References an auth definition name to be used to access to resource defined in the operation parameter
AuthRef string `json:"authRef,omitempty" validate:"omitempty,min=1"`
}
Function ...
type FunctionRef ¶
type FunctionRef struct {
// Name of the referenced function
RefName string `json:"refName" validate:"required"`
// Function arguments
Arguments map[string]interface{} `json:"arguments,omitempty"`
// String containing a valid GraphQL selection set
SelectionSet string `json:"selectionSet,omitempty"`
}
FunctionRef ...
func (*FunctionRef) UnmarshalJSON ¶
func (f *FunctionRef) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type FunctionType ¶
type FunctionType string
FunctionType ...
const ( // FunctionTypeREST ... FunctionTypeREST FunctionType = "rest" // FunctionTypeRPC ... FunctionTypeRPC FunctionType = "rpc" // FunctionTypeExpression ... FunctionTypeExpression FunctionType = "expression" // FunctionTypeGraphQL ... FunctionTypeGraphQL FunctionType = "graphql" // FunctionTypeAsyncAPI ... FunctionTypeAsyncAPI FunctionType = "asyncapi" // FunctionTypeOData ... FunctionTypeOData FunctionType = "odata" )
type InjectState ¶
type InjectState struct {
BaseState
// JSON object which can be set as states data input and can be manipulated via filters
Data map[string]interface{} `json:"data" validate:"required,min=1"`
// State specific timeouts
Timeouts InjectStateTimeout `json:"timeouts,omitempty"`
}
InjectState ...
type InjectStateTimeout ¶ added in v2.1.0
type InjectStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
}
InjectStateTimeout ...
type OAuth2AuthProperties ¶ added in v2.1.0
type OAuth2AuthProperties struct {
BaseAuthProperties
// Authority String or a workflow expression. Contains the authority information
Authority string `json:"authority,omitempty" validate:"omitempty,min=1"`
// GrantType Defines the grant type
GrantType GrantType `json:"grantType" validate:"required"`
// ClientID String or a workflow expression. Contains the client identifier
ClientID string `json:"clientId" validate:"required"`
// ClientSecret Workflow secret or a workflow expression. Contains the client secret
ClientSecret string `json:"clientSecret,omitempty" validate:"omitempty,min=1"`
// Scopes Array containing strings or workflow expressions. Contains the OAuth2 scopes
Scopes []string `json:"scopes,omitempty" validate:"omitempty,min=1"`
// Username String or a workflow expression. Contains the username. Used only if grantType is 'resourceOwner'
Username string `json:"username,omitempty" validate:"omitempty,min=1"`
// Password String or a workflow expression. Contains the user password. Used only if grantType is 'resourceOwner'
Password string `json:"password,omitempty" validate:"omitempty,min=1"`
// Audiences Array containing strings or workflow expressions. Contains the OAuth2 audiences
Audiences []string `json:"audiences,omitempty" validate:"omitempty,min=1"`
// SubjectToken String or a workflow expression. Contains the subject token
SubjectToken string `json:"subjectToken,omitempty" validate:"omitempty,min=1"`
// RequestedSubject String or a workflow expression. Contains the requested subject
RequestedSubject string `json:"requestedSubject,omitempty" validate:"omitempty,min=1"`
// RequestedIssuer String or a workflow expression. Contains the requested issuer
RequestedIssuer string `json:"requestedIssuer,omitempty" validate:"omitempty,min=1"`
}
OAuth2AuthProperties OAuth2 information
func (*OAuth2AuthProperties) UnmarshalJSON ¶ added in v2.1.0
func (b *OAuth2AuthProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type OnError ¶ added in v2.1.0
type OnError struct {
// ErrorRef Reference to a unique workflow error definition. Used of errorRefs is not used
ErrorRef string `json:"errorRef,omitempty"`
// ErrorRefs References one or more workflow error definitions. Used if errorRef is not used
ErrorRefs []string `json:"errorRefs,omitempty"`
// Transition to next state to handle the error. If retryRef is defined, this transition is taken only if retries were unsuccessful.
Transition Transition `json:"transition,omitempty"`
// End workflow execution in case of this error. If retryRef is defined, this ends workflow only if retries were unsuccessful.
End End `json:"end,omitempty"`
}
OnError ...
type OnEvents ¶
type OnEvents struct {
// References one or more unique event names in the defined workflow events
EventRefs []string `json:"eventRefs" validate:"required,min=1"`
// Specifies how actions are to be performed (in sequence of parallel)
ActionMode ActionMode `json:"actionMode,omitempty"`
// Actions to be performed if expression matches
Actions []Action `json:"actions,omitempty" validate:"omitempty,dive"`
// Event data filter
EventDataFilter EventDataFilter `json:"eventDataFilter,omitempty"`
}
OnEvents ...
type OperationState ¶
type OperationState struct {
BaseState
// Specifies whether actions are performed in sequence or in parallel
ActionMode ActionMode `json:"actionMode,omitempty"`
// Actions to be performed
Actions []Action `json:"actions" validate:"required,min=1,dive"`
// State specific timeouts
Timeouts OperationStateTimeout `json:"timeouts,omitempty"`
}
OperationState Defines actions be performed. Does not wait for incoming events
type OperationStateTimeout ¶ added in v2.1.0
type OperationStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
ActionExecTimeout string `json:"actionExecTimeout,omitempty" validate:"omitempty,min=1"`
}
OperationStateTimeout ...
type ParallelState ¶
type ParallelState struct {
BaseState
// Branch Definitions
Branches []Branch `json:"branches" validate:"required,min=1,dive"`
// Option types on how to complete branch execution.
CompletionType CompletionType `json:"completionType,omitempty"`
// Used when completionType is set to 'atLeast' to specify the minimum number of branches that must complete before the state will transition."
NumCompleted intstr.IntOrString `json:"numCompleted,omitempty"`
// State specific timeouts
Timeouts ParallelStateTimeout `json:"timeouts,omitempty"`
}
ParallelState Consists of a number of states that are executed in parallel
type ParallelStateTimeout ¶ added in v2.1.0
type ParallelStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
BranchExecTimeout string `json:"branchExecTimeout,omitempty" validate:"omitempty,min=1"`
}
ParallelStateTimeout ...
type ProduceEvent ¶
type ProduceEvent struct {
// References a name of a defined event
EventRef string `json:"eventRef" validate:"required"`
// TODO: add object or string data type
// If String, expression which selects parts of the states data output to become the data of the produced event. If object a custom object to become the data of produced event.
Data interface{} `json:"data,omitempty"`
// Add additional event extension context attributes
ContextAttributes map[string]interface{} `json:"contextAttributes,omitempty"`
}
ProduceEvent ...
type Retry ¶
type Retry struct {
// Unique retry strategy name
Name string `json:"name" validate:"required"`
// Time delay between retry attempts (ISO 8601 duration format)
Delay string `json:"delay,omitempty"`
// Maximum time delay between retry attempts (ISO 8601 duration format)
MaxDelay string `json:"maxDelay,omitempty"`
// Static value by which the delay increases during each attempt (ISO 8601 time format)
Increment string `json:"increment,omitempty"`
// Numeric value, if specified the delay between retries is multiplied by this value.
Multiplier floatstr.Float32OrString `json:"multiplier,omitempty" validate:"omitempty,min=0"`
// Maximum number of retry attempts.
MaxAttempts intstr.IntOrString `json:"maxAttempts" validate:"required"`
// If float type, maximum amount of random time added or subtracted from the delay between each retry relative to total delay (between 0 and 1). If string type, absolute maximum amount of random time added or subtracted from the delay between each retry (ISO 8601 duration format)
Jitter floatstr.Float32OrString `json:"jitter,omitempty" validate:"omitempty,min=0,max=1"`
}
Retry ...
type Schedule ¶
type Schedule struct {
// Time interval (must be repeating interval) described with ISO 8601 format. Declares when workflow instances will be automatically created.
Interval string `json:"interval,omitempty"`
Cron *Cron `json:"cron,omitempty"`
// Timezone name used to evaluate the interval & cron-expression. (default: UTC)
Timezone string `json:"timezone,omitempty"`
}
Schedule ...
func (*Schedule) UnmarshalJSON ¶
UnmarshalJSON ...
type Secrets ¶ added in v2.1.0
type Secrets []string
Secrets allow you to access sensitive information, such as passwords, OAuth tokens, ssh keys, etc inside your Workflow Expressions.
func (*Secrets) UnmarshalJSON ¶ added in v2.1.0
UnmarshalJSON ...
type Sleep ¶ added in v2.1.0
type Sleep struct {
// Before Amount of time (ISO 8601 duration format) to sleep before function/subflow invocation. Does not apply if 'eventRef' is defined.
Before string `json:"before,omitempty"`
// After Amount of time (ISO 8601 duration format) to sleep after function/subflow invocation. Does not apply if 'eventRef' is defined.
After string `json:"after,omitempty"`
}
Sleep ...
type SleepState ¶ added in v2.1.0
type SleepState struct {
BaseState
// Duration (ISO 8601 duration format) to sleep
Duration string `json:"duration" validate:"required"`
// Timeouts State specific timeouts
Timeouts SleepStateTimeout `json:"timeouts,omitempty"`
}
SleepState ...
type SleepStateTimeout ¶ added in v2.1.0
type SleepStateTimeout struct {
StateExecTimeout StateExecTimeout `json:"stateExecTimeout,omitempty"`
}
SleepStateTimeout ...
type Start ¶
type Start struct {
StateName string `json:"stateName" validate:"required"`
Schedule *Schedule `json:"schedule,omitempty" validate:"omitempty"`
}
Start definition
type State ¶
type State interface {
GetID() string
GetName() string
GetType() StateType
GetOnErrors() []OnError
GetTransition() *Transition
GetStateDataFilter() *StateDataFilter
GetCompensatedBy() string
GetUsedForCompensation() bool
GetEnd() *End
GetMetadata() *Metadata
}
State definition for a Workflow state
type StateDataFilter ¶
type StateDataFilter struct {
// Workflow expression to filter the state data input
Input string `json:"input,omitempty"`
// Workflow expression that filters the state data output
Output string `json:"output,omitempty"`
}
StateDataFilter ...
type StateExecTimeout ¶ added in v2.1.0
type StateExecTimeout struct {
// Single state execution timeout, not including retries (ISO 8601 duration format)
Single string `json:"single,omitempty" validate:"omitempty,min=1"`
// Total state execution timeout, including retries (ISO 8601 duration format)
Total string `json:"total" validate:"required"`
}
StateExecTimeout ...
func (*StateExecTimeout) UnmarshalJSON ¶ added in v2.1.0
func (s *StateExecTimeout) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type Timeouts ¶ added in v2.1.0
type Timeouts struct {
// WorkflowExecTimeout Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'
WorkflowExecTimeout *WorkflowExecTimeout `json:"workflowExecTimeout,omitempty"`
// StateExecTimeout Total state execution timeout (including retries) (ISO 8601 duration format)
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
// ActionExecTimeout Single actions definition execution timeout duration (ISO 8601 duration format)
ActionExecTimeout string `json:"actionExecTimeout,omitempty" validate:"omitempty,min=1"`
// BranchExecTimeout Single branch execution timeout duration (ISO 8601 duration format)
BranchExecTimeout string `json:"branchExecTimeout,omitempty" validate:"omitempty,min=1"`
// EventTimeout Timeout duration to wait for consuming defined events (ISO 8601 duration format)
EventTimeout string `json:"eventTimeout,omitempty" validate:"omitempty,min=1"`
}
Timeouts ...
func (*Timeouts) UnmarshalJSON ¶ added in v2.1.0
UnmarshalJSON ...
type Transition ¶
type Transition struct {
// Name of state to transition to
NextState string `json:"nextState" validate:"required,min=1"`
// Array of events to be produced before the transition happens
ProduceEvents []ProduceEvent `json:"produceEvents,omitempty" validate:"omitempty,dive"`
// If set to true, triggers workflow compensation when before this transition is taken. Default is false
Compensate bool `json:"compensate,omitempty"`
}
Transition ...
func (*Transition) UnmarshalJSON ¶
func (t *Transition) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type TransitionDataCondition ¶
type TransitionDataCondition struct {
BaseDataCondition
// Workflow transition if condition is evaluated to true
Transition Transition `json:"transition" validate:"required"`
}
TransitionDataCondition ...
type TransitionEventCondition ¶
type TransitionEventCondition struct {
BaseEventCondition
// Next transition of the workflow if there is valid matches
Transition Transition `json:"transition" validate:"required"`
}
TransitionEventCondition Switch state data event condition
type Workflow ¶
type Workflow struct {
BaseWorkflow
States []State `json:"states" validate:"required,min=1"`
Events []Event `json:"events,omitempty"`
Functions []Function `json:"functions,omitempty"`
Retries []Retry `json:"retries,omitempty"`
}
Workflow base definition
func (*Workflow) UnmarshalJSON ¶
UnmarshalJSON implementation for json Unmarshal function for the Workflow type
type WorkflowExecTimeout ¶ added in v2.1.0
type WorkflowExecTimeout struct {
// Duration Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'
Duration string `json:"duration,omitempty" validate:"omitempty,min=1"`
// If `false`, workflow instance is allowed to finish current execution. If `true`, current workflow execution is abrupted.
Interrupt bool `json:"interrupt,omitempty"`
// Name of a workflow state to be executed before workflow instance is terminated
RunBefore string `json:"runBefore,omitempty" validate:"omitempty,min=1"`
}
WorkflowExecTimeout ...
func (*WorkflowExecTimeout) UnmarshalJSON ¶ added in v2.1.0
func (w *WorkflowExecTimeout) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type WorkflowRef ¶ added in v2.1.0
type WorkflowRef struct {
// Sub-workflow unique id
WorkflowID string `json:"workflowId" validate:"required"`
// Sub-workflow version
Version string `json:"version,omitempty"`
}
WorkflowRef holds a reference for a workflow definition
func (*WorkflowRef) UnmarshalJSON ¶ added in v2.1.0
func (s *WorkflowRef) UnmarshalJSON(data []byte) error
UnmarshalJSON ...