aws-cdk-lib.aws_stepfunctions.Pass

class Pass (construct)

LanguageType name
.NETAmazon.CDK.AWS.StepFunctions.Pass
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#Pass
Javasoftware.amazon.awscdk.services.stepfunctions.Pass
Pythonaws_cdk.aws_stepfunctions.Pass
TypeScript (source)aws-cdk-lib » aws_stepfunctions » Pass

Implements 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

  • scope Construct
  • id string — Descriptive identifier for this chainable.
  • props PassProps

Construct Props

NameTypeDescription
comment?stringAn optional description for this state.
inputPath?stringJSONPath expression to select part of the state to be the input to this state.
outputPath?stringJSONPath 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?ResultIf given, treat as the result of this operation.
resultPath?stringJSONPath 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.

See also: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters


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

NameTypeDescription
endStatesINextable[]Continuable states of this Chainable.
idstringDescriptive identifier for this chainable.
nodeNodeThe tree node.
startStateStateFirst state of this Chainable.
stateIdstringTokenized 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: Node

The tree node.


startState

Type: State

First state of this Chainable.


stateId

Type: string

Tokenized string that evaluates to the state's ID.

Methods

NameDescription
addPrefix(x)Add a prefix to the stateId of this state.
bindToGraph(graph)Register this state as part of the given graph.
next(next)Continue normal execution with the given state.
toStateJson()Return the Amazon States Language object for this state.
toString()Returns a string representation of this construct.

addPrefix(x)

public addPrefix(x: string): void

Parameters

  • x string

Add a prefix to the stateId of this state.


bindToGraph(graph)

public bindToGraph(graph: StateGraph): void

Parameters

  • graph StateGraph

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

  • Chain

Continue normal execution with the given state.


toStateJson()

public toStateJson(): json

Returns

  • json

Return the Amazon States Language object for this state.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.