Fail
- class aws_cdk.aws_stepfunctions.Fail(scope, id, *, cause=None, cause_path=None, error=None, error_path=None, comment=None, query_language=None, state_name=None)
Bases:
StateDefine a Fail state in the state machine.
Reaching a Fail state terminates the state execution in failure.
- ExampleMetadata:
infused
Example:
fail = sfn.Fail(self, "Fail", error_path=sfn.JsonPath.format("error: {}.", sfn.JsonPath.string_at("$.someError")), cause_path="States.Format('cause: {}.', $.someCause)" )
- Parameters:
scope (
Construct)id (
str) – Descriptive identifier for this chainable.cause (
Optional[str]) – A description for the cause of the failure. Default: - No descriptioncause_path (
Optional[str]) – JsonPath expression to select part of the state to be the cause to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID. Default: - No cause patherror (
Optional[str]) – Error code used to represent this failure. Default: - No error codeerror_path (
Optional[str]) – JsonPath expression to select part of the state to be the error to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID. Default: - No error pathcomment (
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 aqueryLanguagefield, then it will use the query language specified in the top-levelqueryLanguagefield. Default: - JSONPathstate_name (
Optional[str]) – Optional name for this state. Default: - The construct ID will be used as state name
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
- to_state_json(query_language=None)
Return the Amazon States Language object for this state.
- Parameters:
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
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill 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
xis an object created from a class which extendsConstruct.
- classmethod json_path(scope, id, *, cause=None, cause_path=None, error=None, error_path=None, comment=None, query_language=None, state_name=None)
Define a Fail state using JSONPath in the state machine.
Reaching a Fail state terminates the state execution in failure.
- Parameters:
scope (
Construct)id (
str)cause (
Optional[str]) – A description for the cause of the failure. Default: - No descriptioncause_path (
Optional[str]) – JsonPath expression to select part of the state to be the cause to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID. Default: - No cause patherror (
Optional[str]) – Error code used to represent this failure. Default: - No error codeerror_path (
Optional[str]) – JsonPath expression to select part of the state to be the error to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID. Default: - No error pathcomment (
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 aqueryLanguagefield, then it will use the query language specified in the top-levelqueryLanguagefield. Default: - JSONPathstate_name (
Optional[str]) – Optional name for this state. Default: - The construct ID will be used as state name
- Return type:
- classmethod jsonata(scope, id, *, cause=None, error=None, comment=None, query_language=None, state_name=None)
Define a Fail state using JSONata in the state machine.
Reaching a Fail state terminates the state execution in failure.
- Parameters:
scope (
Construct)id (
str)cause (
Optional[str]) – A description for the cause of the failure. Default: - No descriptionerror (
Optional[str]) – Error code used to represent this failure. Default: - No error codecomment (
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 aqueryLanguagefield, then it will use the query language specified in the top-levelqueryLanguagefield. Default: - JSONPathstate_name (
Optional[str]) – Optional name for this state. Default: - The construct ID will be used as state name
- 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