class State
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.StepFunctions.State |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#State |
Java | software.amazon.awscdk.services.stepfunctions.State |
Python | aws_cdk.aws_stepfunctions.State |
TypeScript (source) | aws-cdk-lib » aws_stepfunctions » State |
Implements
IConstruct, IDependable, IChainable
Extends
Construct
Implemented by
Choice, Custom, Distributed, Fail, Map, Parallel, Pass, Succeed, Wait, Athena, Athena, Athena, Athena, Batch, Bedrock, Bedrock, Call, Call, Call, Call, Code, Code, Dynamo, Dynamo, Dynamo, Dynamo, Ecs, Eks, Emr, Emr, Emr, Emr, Emr, Emr, Emr, Emr, Emr, Emr, Evaluate, Event, Event, Glue, Glue, Glue, Http, Lambda, Media, Sage, Sage, Sage, Sage, Sage, Sage, Sns, Sqs, Step, Step
Base class for all other state classes.
Initializer
new State(scope: Construct, id: string, props: StateProps)
Parameters
- scope
Construct - id
string— Descriptive identifier for this chainable. - props
StateProps
Properties
| Name | Type | Description |
|---|---|---|
| branches | State[] | |
| end | INextable[] | Continuable states of this Chainable. |
| id | string | Descriptive identifier for this chainable. |
| node | Node | The tree node. |
| start | State | First state of this Chainable. |
| state | string | Tokenized string that evaluates to the state's ID. |
| arguments? | json | |
| assign? | json | |
| comment? | string | |
| default | State | |
| input | string | |
| iteration? | State | |
| output | string | |
| outputs? | json | |
| parameters? | json | |
| processor? | State | |
| processor | Processor | |
| processor | Processor | |
| query | Query | |
| result | string | |
| result | json | |
| state | string |
branches
Type:
State[]
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.
arguments?
Type:
json
(optional)
assign?
Type:
json
(optional)
comment?
Type:
string
(optional)
defaultChoice?
Type:
State
(optional)
inputPath?
Type:
string
(optional)
iteration?
Type:
State
(optional)
outputPath?
Type:
string
(optional)
outputs?
Type:
json
(optional)
parameters?
Type:
json
(optional)
processor?
Type:
State
(optional)
processorConfig?
Type:
Processor
(optional)
processorMode?
Type:
Processor
(optional)
queryLanguage?
Type:
Query
(optional)
resultPath?
Type:
string
(optional)
resultSelector?
Type:
json
(optional)
stateName?
Type:
string
(optional)
Methods
| Name | Description |
|---|---|
| add | Add a prefix to the stateId of this state. |
| bind | Register this state as part of the given graph. |
| to | Render the state as JSON. |
| to | Returns a string representation of this construct. |
| protected add | Add a parallel branch to this state. |
| protected add | Add a choice branch to this state. |
| protected add | Add a item processor to this state. |
| protected add | Add a map iterator to this state. |
| protected make | Make the indicated state the default choice transition of this state. |
| protected make | Make the indicated state the default transition of this state. |
| protected render | Render the assign in ASL JSON format. |
| protected render | Render parallel branches in ASL JSON format. |
| protected render | Render the choices in ASL JSON format. |
| protected render | Render InputPath/Parameters/OutputPath/Arguments/Output in ASL JSON format. |
| protected render | Render ItemProcessor in ASL JSON format. |
| protected render | Render map iterator in ASL JSON format. |
| protected render | Render the default next state in ASL JSON format. |
| protected render | Render QueryLanguage in ASL JSON format if needed. |
| protected render | Render ResultSelector in ASL JSON format. |
| protected render | Render error recovery options in ASL JSON format. |
| protected validate | Allows the state to validate itself. |
| protected when | Called whenever this state is bound to a graph. |
| static filter | Return only the states that allow chaining from an array of states. |
| static find | Find the set of end states states reachable through transitions from the given start state. |
| static find | Find the set of states reachable through transitions from the given start state. |
| static prefix | Add a prefix to the stateId of all States found in a construct tree. |
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.
toStateJson(stateMachineQueryLanguage?)
public toStateJson(stateMachineQueryLanguage?: QueryLanguage): json
Parameters
- stateMachineQueryLanguage
QueryLanguage
Returns
json
Render the state as JSON.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
protected addBranch(branch)
protected addBranch(branch: StateGraph): void
Parameters
- branch
StateGraph
Add a parallel branch to this state.
protected addChoice(condition, next, options?)
protected addChoice(condition: Condition, next: State, options?: ChoiceTransitionOptions): void
Parameters
- condition
Condition - next
State - options
ChoiceTransition Options
Add a choice branch to this state.
protected addItemProcessor(processor, config?)
protected addItemProcessor(processor: StateGraph, config?: ProcessorConfig): void
Parameters
- processor
StateGraph - config
ProcessorConfig
Add a item processor to this state.
protected addIterator(iteration)
protected addIterator(iteration: StateGraph): void
Parameters
- iteration
StateGraph
Add a map iterator to this state.
protected makeDefault(def)
protected makeDefault(def: State): void
Parameters
- def
State
Make the indicated state the default choice transition of this state.
protected makeNext(next)
protected makeNext(next: State): void
Parameters
- next
State
Make the indicated state the default transition of this state.
protected renderAssign(topLevelQueryLanguage?)
protected renderAssign(topLevelQueryLanguage?: QueryLanguage): any
Parameters
- topLevelQueryLanguage
QueryLanguage
Returns
any
Render the assign in ASL JSON format.
protected renderBranches()
protected renderBranches(): any
Returns
any
Render parallel branches in ASL JSON format.
protected renderChoices(topLevelQueryLanguage?)
protected renderChoices(topLevelQueryLanguage?: QueryLanguage): any
Parameters
- topLevelQueryLanguage
QueryLanguage
Returns
any
Render the choices in ASL JSON format.
protected renderInputOutput()
protected renderInputOutput(): any
Returns
any
Render InputPath/Parameters/OutputPath/Arguments/Output in ASL JSON format.
protected renderItemProcessor()
protected renderItemProcessor(): any
Returns
any
Render ItemProcessor in ASL JSON format.
protected renderIterator()
protected renderIterator(): any
Returns
any
Render map iterator in ASL JSON format.
protected renderNextEnd()
protected renderNextEnd(): any
Returns
any
Render the default next state in ASL JSON format.
protected renderQueryLanguage(topLevelQueryLanguage?)
protected renderQueryLanguage(topLevelQueryLanguage?: QueryLanguage): any
Parameters
- topLevelQueryLanguage
QueryLanguage
Returns
any
Render QueryLanguage in ASL JSON format if needed.
protected renderResultSelector()
protected renderResultSelector(): any
Returns
any
Render ResultSelector in ASL JSON format.
protected renderRetryCatch(topLevelQueryLanguage?)
protected renderRetryCatch(topLevelQueryLanguage?: QueryLanguage): any
Parameters
- topLevelQueryLanguage
QueryLanguage
Returns
any
Render error recovery options in ASL JSON format.
protected validateState()
protected validateState(): string[]
Returns
string[]
Allows the state to validate itself.
protected whenBoundToGraph(graph)
protected whenBoundToGraph(graph: StateGraph): void
Parameters
- graph
StateGraph
Called whenever this state is bound to a graph.
Can be overridden by subclasses.
static filterNextables(states)
public static filterNextables(states: State[]): INextable[]
Parameters
- states
State[]
Returns
Return only the states that allow chaining from an array of states.
static findReachableEndStates(start, options?)
public static findReachableEndStates(start: State, options?: FindStateOptions): State[]
Parameters
- start
State - options
FindState Options
Returns
State[]
Find the set of end states states reachable through transitions from the given start state.
static findReachableStates(start, options?)
public static findReachableStates(start: State, options?: FindStateOptions): State[]
Parameters
- start
State - options
FindState Options
Returns
State[]
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.
static prefixStates(root, prefix)
public static prefixStates(root: IConstruct, prefix: string): void
Parameters
- root
IConstruct - prefix
string
Add a prefix to the stateId of all States found in a construct tree.

.NET
Go
Java
Python
TypeScript (