class Map (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.StepFunctions.Map |
Java | software.amazon.awscdk.services.stepfunctions.Map |
Python | aws_cdk.aws_stepfunctions.Map |
TypeScript (source) | @aws-cdk/aws-stepfunctions » Map |
Implements
IConstruct
, IConstruct
, IDependable
, IChainable
, INextable
Define a Map state in the state machine.
A Map
state can be used to run a set of steps for each element of an input array.
A Map state will execute the same steps for multiple entries of an array in the state input.
While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input.
Example
const map = new sfn.Map(this, 'Map State', {
maxConcurrency: 1,
itemsPath: sfn.JsonPath.stringAt('$.inputForMap'),
});
map.iterator(new sfn.Pass(this, 'Pass State'));
Initializer
new Map(scope: Construct, id: string, props?: MapProps)
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. |
items | string | JSONPath expression to select the array to iterate over. |
max | number | MaxConcurrency. |
output | string | JSONPath expression to select part of the state to be the output to this state. |
parameters? | { [string]: any } | The JSON that you want to override your default iteration input. |
result | string | JSONPath expression to indicate where to inject the state's output. |
result | { [string]: any } | The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. |
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 {}.
itemsPath?
Type:
string
(optional, default: $)
JSONPath expression to select the array to iterate over.
maxConcurrency?
Type:
number
(optional, default: full concurrency)
MaxConcurrency.
An upper bound on the number of iterations you want running at once.
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: $)
The JSON that you want to override your default iteration input.
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.
resultSelector?
Type:
{ [string]: any }
(optional, default: None)
The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.
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 recovery handler for this state. |
add | Add a prefix to the stateId of this state. |
add | Add retry configuration for this state. |
bind | Register this state as part of the given graph. |
iterator(iterator) | Define iterator state machine in Map. |
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. |
protected validate() | Validate this state. |
Catch(handler, props?)
addpublic addCatch(handler: IChainable, props?: CatchProps): Map
Parameters
- handler
IChainable
- props
Catch
Props
Returns
Add a recovery handler for this state.
When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.
Prefix(x)
addpublic addPrefix(x: string): void
Parameters
- x
string
Add a prefix to the stateId of this state.
Retry(props?)
addpublic addRetry(props?: RetryProps): Map
Parameters
- props
Retry
Props
Returns
Add retry configuration for this state.
This controls if and how the execution will be retried if a particular error occurs.
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.
iterator(iterator)
public iterator(iterator: IChainable): Map
Parameters
- iterator
IChainable
Returns
Define iterator state machine in Map.
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.
protected validate()
protected validate(): string[]
Returns
string[]
Validate this state.