class Pass (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.StepFunctions.Pass |
Java | software.amazon.awscdk.services.stepfunctions.Pass |
Python | aws_cdk.aws_stepfunctions.Pass |
TypeScript (source) | @aws-cdk/aws-stepfunctions » Pass |
Implements
IConstruct
, IConstruct
, IDependable
, IChainable
, INextable
Define a Pass in the state machine.
A Pass state can be used to transform the current execution's state.
Example
const choice = new sfn.Choice(this, 'Did it work?');
// Add conditions with .when()
const successState = new sfn.Pass(this, 'SuccessState');
const failureState = new sfn.Pass(this, 'FailureState');
choice.when(sfn.Condition.stringEquals('$.status', 'SUCCESS'), successState);
choice.when(sfn.Condition.numberGreaterThan('$.attempts', 5), failureState);
// Use .otherwise() to indicate what should be done if none of the conditions match
const tryAgainState = new sfn.Pass(this, 'TryAgainState');
choice.otherwise(tryAgainState);
Initializer
new Pass(scope: Construct, id: string, props?: PassProps)
Parameters
Construct Props
Name | Type | Description |
---|---|---|
comment? | string | An optional description for this state. |
input | string | JSONPath expression to select part of the state to be the input to this state. |
output | string | JSONPath expression to select part of the state to be the output to this state. |
parameters? | { [string]: any } | Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. |
result? | Result | If given, treat as the result of this operation. |
result | string | JSONPath expression to indicate where to inject the state's output. |
comment?
Type:
string
(optional, default: No comment)
An optional description for this state.
inputPath?
Type:
string
(optional, default: $)
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 {}.
outputPath?
Type:
string
(optional, default: $)
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 {}.
parameters?
Type:
{ [string]: any }
(optional, default: No parameters)
Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
result?
Type:
Result
(optional, default: No injected result)
If given, treat as the result of this operation.
Can be used to inject or replace the current execution state.
resultPath?
Type:
string
(optional, default: $)
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.
Properties
Name | Type | Description |
---|---|---|
end | INextable [] | Continuable states of this Chainable. |
id | string | Descriptive identifier for this chainable. |
node | Construct | The construct tree node associated with this construct. |
start | State | First state of this Chainable. |
state | string | Tokenized string that evaluates to the state's ID. |
endStates
Type:
INextable
[]
Continuable states of this Chainable.
id
Type:
string
Descriptive identifier for this chainable.
node
Type:
Construct
The construct tree node associated with this construct.
startState
Type:
State
First state of this Chainable.
stateId
Type:
string
Tokenized string that evaluates to the state's ID.
Methods
Name | Description |
---|---|
add | Add a prefix to the stateId of this state. |
bind | Register this state as part of the given graph. |
next(next) | Continue normal execution with the given state. |
to | Return the Amazon States Language object for this state. |
to | Returns a string representation of this construct. |
Prefix(x)
addpublic addPrefix(x: string): void
Parameters
- x
string
Add a prefix to the stateId of this state.
ToGraph(graph)
bindpublic bindToGraph(graph: StateGraph): void
Parameters
- graph
State
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.
next(next)
public next(next: IChainable): Chain
Parameters
- next
IChainable
Returns
Continue normal execution with the given state.
StateJson()
topublic toStateJson(): json
Returns
json
Return the Amazon States Language object for this state.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.