Wait
- class aws_cdk.aws_stepfunctions.Wait(scope, id, *, time, comment=None, query_language=None, state_name=None, assign=None)
Bases:
State
Define a Wait state in the state machine.
A Wait state can be used to delay execution of the state machine for a while.
- ExampleMetadata:
infused
Example:
convert_to_seconds = tasks.EvaluateExpression(self, "Convert to seconds", expression="$.waitMilliseconds / 1000", result_path="$.waitSeconds" ) create_message = tasks.EvaluateExpression(self, "Create message", # Note: this is a string inside a string. expression="`Now waiting ${$.waitSeconds} seconds...`", runtime=lambda_.Runtime.NODEJS_LATEST, result_path="$.message" ) publish_message = tasks.SnsPublish(self, "Publish message", topic=sns.Topic(self, "cool-topic"), message=sfn.TaskInput.from_json_path_at("$.message"), result_path="$.sns" ) wait = sfn.Wait(self, "Wait", time=sfn.WaitTime.seconds_path("$.waitSeconds") ) sfn.StateMachine(self, "StateMachine", definition=convert_to_seconds.next(create_message).next(publish_message).next(wait) )
- Parameters:
scope (
Construct
) –id (
str
) – Descriptive identifier for this chainable.time (
WaitTime
) – Wait duration.comment (
Optional
[str
]) – A comment describing this state. Default: No commentquery_language (
Optional
[QueryLanguage
]) – The name of the query language used by the state. If the state does not contain aqueryLanguage
field, then it will use the query language specified in the top-levelqueryLanguage
field. Default: - JSONPathstate_name (
Optional
[str
]) – Optional name for this state. Default: - The construct ID will be used as state nameassign (
Optional
[Mapping
[str
,Any
]]) – Workflow variables to store in this step. Using workflow variables, you can store data in a step and retrieve that data in future steps. Default: - Not assign variables
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:
- to_state_json(top_level_query_language=None)
Return the Amazon States Language object for this state.
- Parameters:
top_level_query_language (
Optional
[QueryLanguage
]) –- 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 tree node.
- 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.
- 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.
- 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.
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod json_path(scope, id, *, time, comment=None, query_language=None, state_name=None, assign=None, input_path=None, output_path=None)
Define a Wait state using JSONPath in the state machine.
A Wait state can be used to delay execution of the state machine for a while.
- Parameters:
scope (
Construct
) –id (
str
) –time (
WaitTime
) – Wait duration.comment (
Optional
[str
]) – A comment describing this state. Default: No commentquery_language (
Optional
[QueryLanguage
]) – The name of the query language used by the state. If the state does not contain aqueryLanguage
field, then it will use the query language specified in the top-levelqueryLanguage
field. Default: - JSONPathstate_name (
Optional
[str
]) – Optional name for this state. Default: - The construct ID will be used as state nameassign (
Optional
[Mapping
[str
,Any
]]) – Workflow variables to store in this step. Using workflow variables, you can store data in a step and retrieve that data in future steps. Default: - Not assign variablesinput_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: $
- Return type:
- classmethod jsonata(scope, id, *, time, comment=None, query_language=None, state_name=None, assign=None, outputs=None)
Define a Wait state using JSONata in the state machine.
A Wait state can be used to delay execution of the state machine for a while.
- Parameters:
scope (
Construct
) –id (
str
) –time (
WaitTime
) – Wait duration.comment (
Optional
[str
]) – A comment describing this state. Default: No commentquery_language (
Optional
[QueryLanguage
]) – The name of the query language used by the state. If the state does not contain aqueryLanguage
field, then it will use the query language specified in the top-levelqueryLanguage
field. Default: - JSONPathstate_name (
Optional
[str
]) – Optional name for this state. Default: - The construct ID will be used as state nameassign (
Optional
[Mapping
[str
,Any
]]) – Workflow variables to store in this step. Using workflow variables, you can store data in a step and retrieve that data in future steps. Default: - Not assign variablesoutputs (
Any
) – Used to specify and transform output from the state. When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly. Default: - $states.result or $states.errorOutput
- Return type:
- classmethod prefix_states(root, prefix)
Add a prefix to the stateId of all States found in a construct tree.
- Parameters:
root (
IConstruct
) –prefix (
str
) –
- Return type:
None