Pass

class aws_cdk.aws_stepfunctions.Pass(scope, id, *, comment=None, input_path=None, output_path=None, parameters=None, result=None, result_path=None)

Bases: State

Define a Pass in the state machine.

A Pass state can be used to transform the current execution’s state.

ExampleMetadata:

infused

Example:

choice = sfn.Choice(self, "Did it work?")

# Add conditions with .when()
success_state = sfn.Pass(self, "SuccessState")
failure_state = sfn.Pass(self, "FailureState")
choice.when(sfn.Condition.string_equals("$.status", "SUCCESS"), success_state)
choice.when(sfn.Condition.number_greater_than("$.attempts", 5), failure_state)

# Use .otherwise() to indicate what should be done if none of the conditions match
try_again_state = sfn.Pass(self, "TryAgainState")
choice.otherwise(try_again_state)
Parameters:
  • scope (Construct) –

  • 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: $

  • parameters (Optional[Mapping[str, Any]]) – Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. Default: No parameters

  • result (Optional[Result]) – If given, treat as the result of this operation. Can be used to inject or replace the current execution state. Default: No injected result

  • 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: $

Methods

add_prefix(x)

Add a prefix to the stateId of this state.

Parameters:

x (str) –

Return type:

None

bind_to_graph(graph)

Register this state as part of the given graph.

Don’t call this. It will be called automatically when you work with states normally.

Parameters:

graph (StateGraph) –

Return type:

None

next(next)

Continue normal execution with the given state.

Parameters:

next (IChainable) –

Return type:

Chain

to_state_json()

Return the Amazon States Language object for this state.

Return type:

Mapping[Any, Any]

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

end_states

Continuable states of this Chainable.

id

Descriptive identifier for this chainable.

node

The construct tree node associated with this construct.

start_state

First state of this Chainable.

state_id

Tokenized string that evaluates to the state’s ID.

Static Methods

classmethod filter_nextables(states)

Return only the states that allow chaining from an array of states.

Parameters:

states (Sequence[State]) –

Return type:

List[INextable]

classmethod find_reachable_end_states(start, *, include_error_handlers=None)

Find the set of end states states reachable through transitions from the given start state.

Parameters:
  • start (State) –

  • include_error_handlers (Optional[bool]) – Whether or not to follow error-handling transitions. Default: false

Return type:

List[State]

classmethod find_reachable_states(start, *, include_error_handlers=None)

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state’s branch.

Parameters:
  • start (State) –

  • include_error_handlers (Optional[bool]) – Whether or not to follow error-handling transitions. Default: false

Return type:

List[State]

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod prefix_states(root, prefix)

Add a prefix to the stateId of all States found in a construct tree.

Parameters:
Return type:

None