Bases: object
A collection of states to chain onto.
A Chain has a start and zero or more chainable ends. If there are zero ends, calling next() on the Chain will fail.
infused
Example:
# Define a state machine with one Pass state
child = sfn.StateMachine(self, "ChildStateMachine",
definition=sfn.Chain.start(sfn.Pass(self, "PassState"))
)
# Include the state machine in a Task state with callback pattern
task = tasks.StepFunctionsStartExecution(self, "ChildTask",
state_machine=child,
integration_pattern=sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
input=sfn.TaskInput.from_object({
"token": sfn.JsonPath.task_token,
"foo": "bar"
}),
name="MyExecutionName"
)
# Define a second state machine with the Task state above
sfn.StateMachine(self, "ParentStateMachine",
definition=task
)
Methods
Continue normal execution with the given state.
next (IChainable
)
Return a single state that encompasses all states in the chain.
This can be used to add error handling to a sequence of states.
Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change ‘outputPath’ to ‘$[0]’.
id (str
)
comment (Optional
[str
]) – An optional description for this state. Default: No comment
input_path (Optional
[str
]) – JSONPath expression to select part of the state to be the input to this state. May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}. Default: $
output_path (Optional
[str
]) – JSONPath expression to select part of the state to be the output to this state. May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}. Default: $
result_path (Optional
[str
]) – JSONPath expression to indicate where to inject the state’s output. May also be the special value JsonPath.DISCARD, which will cause the state’s input to become its output. Default: $
result_selector (Optional
[Mapping
[str
, Any
]]) – The JSON that will replace the state’s raw result and become the effective result before ResultPath is applied. You can use ResultSelector to create a payload with values that are static or selected from the state’s raw result. Default: - None
Attributes
The chainable end state(s) of this chain.
Identify this Chain.
The start state of this chain.
Static Methods
Make a Chain with specific start and end states, and a last-added Chainable.
start_state (State
)
end_states (Sequence
[INextable
])
last_added (IChainable
)
Make a Chain with the start from one chain and the ends from another.
start (IChainable
)
next (IChainable
)
Begin a new Chain from one chainable.
state (IChainable
)