Skip to content

Commit 803cfe3

Browse files
authored
docs(stepfunctions): multi-state example for map state (#26870)
Closes #26707. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 53d61bb commit 803cfe3

File tree

1 file changed

+20
-1
lines changed
  • packages/aws-cdk-lib/aws-stepfunctions

1 file changed

+20
-1
lines changed

packages/aws-cdk-lib/aws-stepfunctions/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,27 @@ execute the same steps for multiple entries of an array in the state input.
467467
const map = new sfn.Map(this, 'Map State', {
468468
maxConcurrency: 1,
469469
itemsPath: sfn.JsonPath.stringAt('$.inputForMap'),
470+
parameters: {
471+
item: sfn.JsonPath.stringAt('$$.Map.Item.Value'),
472+
},
473+
resultPath: '$.mapOutput',
470474
});
471-
map.iterator(new sfn.Pass(this, 'Pass State'));
475+
476+
// The Map iterator can contain a IChainable, which can be an individual or multiple steps chained together.
477+
// Below example is with a Choice and Pass step
478+
const choice = new sfn.Choice(this, 'Choice');
479+
const condition1 = sfn.Condition.stringEquals('$.item.status', 'SUCCESS');
480+
const step1 = new sfn.Pass(this, 'Step1');
481+
const step2 = new sfn.Pass(this, 'Step2');
482+
const finish = new sfn.Pass(this, 'Finish');
483+
484+
const definition = choice
485+
.when(condition1, step1)
486+
.otherwise(step2)
487+
.afterwards()
488+
.next(finish);
489+
490+
map.iterator(definition);
472491
```
473492

474493
### Custom State

0 commit comments

Comments
 (0)