Skip to content

Commit 31a78be

Browse files
author
awstools
committed
feat(client-sfn): This release adds support for the AWS Step Functions Map state in Distributed mode. The changes include a new MapRun resource and several new and modified APIs.
1 parent c2e00d5 commit 31a78be

21 files changed

+2115
-60
lines changed

clients/client-sfn/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@aws-sdk/util-defaults-mode-browser": "*",
4848
"@aws-sdk/util-defaults-mode-node": "*",
4949
"@aws-sdk/util-endpoints": "*",
50+
"@aws-sdk/util-retry": "*",
5051
"@aws-sdk/util-user-agent-browser": "*",
5152
"@aws-sdk/util-user-agent-node": "*",
5253
"@aws-sdk/util-utf8-browser": "*",

clients/client-sfn/src/SFN.ts

Lines changed: 121 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ import {
3131
DescribeExecutionCommandInput,
3232
DescribeExecutionCommandOutput,
3333
} from "./commands/DescribeExecutionCommand";
34+
import {
35+
DescribeMapRunCommand,
36+
DescribeMapRunCommandInput,
37+
DescribeMapRunCommandOutput,
38+
} from "./commands/DescribeMapRunCommand";
3439
import {
3540
DescribeStateMachineCommand,
3641
DescribeStateMachineCommandInput,
@@ -61,6 +66,7 @@ import {
6166
ListExecutionsCommandInput,
6267
ListExecutionsCommandOutput,
6368
} from "./commands/ListExecutionsCommand";
69+
import { ListMapRunsCommand, ListMapRunsCommandInput, ListMapRunsCommandOutput } from "./commands/ListMapRunsCommand";
6470
import {
6571
ListStateMachinesCommand,
6672
ListStateMachinesCommandInput,
@@ -107,6 +113,11 @@ import {
107113
UntagResourceCommandInput,
108114
UntagResourceCommandOutput,
109115
} from "./commands/UntagResourceCommand";
116+
import {
117+
UpdateMapRunCommand,
118+
UpdateMapRunCommandInput,
119+
UpdateMapRunCommandOutput,
120+
} from "./commands/UpdateMapRunCommand";
110121
import {
111122
UpdateStateMachineCommand,
112123
UpdateStateMachineCommandInput,
@@ -267,6 +278,11 @@ export class SFN extends SFNClient {
267278
/**
268279
* <p>Deletes a state machine. This is an asynchronous operation: It sets the state machine's
269280
* status to <code>DELETING</code> and begins the deletion process. </p>
281+
*
282+
* <p>If the given state machine Amazon Resource Name (ARN) is a qualified state machine ARN, it will fail with ValidationException.</p>
283+
*
284+
* <p>A qualified state machine ARN refers to a <i>Distributed Map state</i> defined within a state machine. For example, the qualified state machine ARN <code>arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel</code> refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in the state machine named <code>stateMachineName</code>.</p>
285+
*
270286
* <note>
271287
* <p>For <code>EXPRESS</code> state machines, the deletion will happen eventually (usually
272288
* less than a minute). Running executions may emit logs after <code>DeleteStateMachine</code>
@@ -338,11 +354,11 @@ export class SFN extends SFNClient {
338354
}
339355

340356
/**
341-
* <p>Describes an execution.</p>
357+
* <p>Provides all information about a state machine execution, such as the state machine associated with the execution, the execution input and output, and relevant execution metadata. Use this API action to return the Map Run ARN if the execution was dispatched by a Map Run.</p>
342358
* <note>
343359
* <p>This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.</p>
344360
* </note>
345-
* <p>This API action is not supported by <code>EXPRESS</code> state machines.</p>
361+
* <p>This API action is not supported by <code>EXPRESS</code> state machine executions unless they were dispatched by a Map Run.</p>
346362
*/
347363
public describeExecution(
348364
args: DescribeExecutionCommandInput,
@@ -374,7 +390,42 @@ export class SFN extends SFNClient {
374390
}
375391

376392
/**
377-
* <p>Describes a state machine.</p>
393+
* <p>Provides information about a Map Run's configuration, progress, and results. For more information, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-examine-map-run.html">Examining Map Run</a> in the <i>Step Functions Developer Guide</i>.</p>
394+
*/
395+
public describeMapRun(
396+
args: DescribeMapRunCommandInput,
397+
options?: __HttpHandlerOptions
398+
): Promise<DescribeMapRunCommandOutput>;
399+
public describeMapRun(
400+
args: DescribeMapRunCommandInput,
401+
cb: (err: any, data?: DescribeMapRunCommandOutput) => void
402+
): void;
403+
public describeMapRun(
404+
args: DescribeMapRunCommandInput,
405+
options: __HttpHandlerOptions,
406+
cb: (err: any, data?: DescribeMapRunCommandOutput) => void
407+
): void;
408+
public describeMapRun(
409+
args: DescribeMapRunCommandInput,
410+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DescribeMapRunCommandOutput) => void),
411+
cb?: (err: any, data?: DescribeMapRunCommandOutput) => void
412+
): Promise<DescribeMapRunCommandOutput> | void {
413+
const command = new DescribeMapRunCommand(args);
414+
if (typeof optionsOrCb === "function") {
415+
this.send(command, optionsOrCb);
416+
} else if (typeof cb === "function") {
417+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
418+
this.send(command, optionsOrCb || {}, cb);
419+
} else {
420+
return this.send(command, optionsOrCb);
421+
}
422+
}
423+
424+
/**
425+
* <p>Provides information about a state machine's definition, its IAM role Amazon Resource Name (ARN), and configuration. If the state machine ARN is a qualified state machine ARN, the response returned includes the <code>Map</code> state's label.</p>
426+
*
427+
* <p>A qualified state machine ARN refers to a <i>Distributed Map state</i> defined within a state machine. For example, the qualified state machine ARN <code>arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel</code> refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in the state machine named <code>stateMachineName</code>.</p>
428+
*
378429
* <note>
379430
* <p>This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.</p>
380431
* </note>
@@ -409,7 +460,7 @@ export class SFN extends SFNClient {
409460
}
410461

411462
/**
412-
* <p>Describes the state machine associated with a specific execution.</p>
463+
* <p>Provides information about a state machine's definition, its execution role ARN, and configuration. If an execution was dispatched by a Map Run, the Map Run is returned in the response. Additionally, the state machine returned will be the state machine associated with the Map Run.</p>
413464
* <note>
414465
* <p>This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.</p>
415466
* </note>
@@ -568,7 +619,8 @@ export class SFN extends SFNClient {
568619
}
569620

570621
/**
571-
* <p>Lists the executions of a state machine that meet the filtering criteria. Results are
622+
* <p>Lists all executions of a state machine or a Map Run. You can list all executions related to a state machine by specifying a state machine Amazon Resource Name (ARN), or those related to a Map Run by specifying a Map Run ARN.</p>
623+
* <p>Results are
572624
* sorted by time, with the most recent execution first.</p>
573625
* <p>If <code>nextToken</code> is returned, there are more results available. The value of <code>nextToken</code> is a unique pagination token for each page.
574626
* Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an <i>HTTP 400 InvalidToken</i> error.</p>
@@ -606,6 +658,32 @@ export class SFN extends SFNClient {
606658
}
607659
}
608660

661+
/**
662+
* <p>Lists all Map Runs that were started by a given state machine execution. Use this API action to obtain Map Run ARNs, and then call <code>DescribeMapRun</code> to obtain more information, if needed.</p>
663+
*/
664+
public listMapRuns(args: ListMapRunsCommandInput, options?: __HttpHandlerOptions): Promise<ListMapRunsCommandOutput>;
665+
public listMapRuns(args: ListMapRunsCommandInput, cb: (err: any, data?: ListMapRunsCommandOutput) => void): void;
666+
public listMapRuns(
667+
args: ListMapRunsCommandInput,
668+
options: __HttpHandlerOptions,
669+
cb: (err: any, data?: ListMapRunsCommandOutput) => void
670+
): void;
671+
public listMapRuns(
672+
args: ListMapRunsCommandInput,
673+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListMapRunsCommandOutput) => void),
674+
cb?: (err: any, data?: ListMapRunsCommandOutput) => void
675+
): Promise<ListMapRunsCommandOutput> | void {
676+
const command = new ListMapRunsCommand(args);
677+
if (typeof optionsOrCb === "function") {
678+
this.send(command, optionsOrCb);
679+
} else if (typeof cb === "function") {
680+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
681+
this.send(command, optionsOrCb || {}, cb);
682+
} else {
683+
return this.send(command, optionsOrCb);
684+
}
685+
}
686+
609687
/**
610688
* <p>Lists the existing state machines.</p>
611689
* <p>If <code>nextToken</code> is returned, there are more results available. The value of <code>nextToken</code> is a unique pagination token for each page.
@@ -790,7 +868,10 @@ export class SFN extends SFNClient {
790868
}
791869

792870
/**
793-
* <p>Starts a state machine execution.</p>
871+
* <p>Starts a state machine execution. If the given state machine Amazon Resource Name (ARN) is a qualified state machine ARN, it will fail with ValidationException.</p>
872+
*
873+
* <p>A qualified state machine ARN refers to a <i>Distributed Map state</i> defined within a state machine. For example, the qualified state machine ARN <code>arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel</code> refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in the state machine named <code>stateMachineName</code>.</p>
874+
*
794875
* <note>
795876
* <p>
796877
* <code>StartExecution</code> is idempotent for <code>STANDARD</code> workflows. For a
@@ -971,12 +1052,46 @@ export class SFN extends SFNClient {
9711052
}
9721053
}
9731054

1055+
/**
1056+
* <p>Updates an in-progress Map Run's configuration to include changes to the settings that control maximum concurrency and Map Run failure.</p>
1057+
*/
1058+
public updateMapRun(
1059+
args: UpdateMapRunCommandInput,
1060+
options?: __HttpHandlerOptions
1061+
): Promise<UpdateMapRunCommandOutput>;
1062+
public updateMapRun(args: UpdateMapRunCommandInput, cb: (err: any, data?: UpdateMapRunCommandOutput) => void): void;
1063+
public updateMapRun(
1064+
args: UpdateMapRunCommandInput,
1065+
options: __HttpHandlerOptions,
1066+
cb: (err: any, data?: UpdateMapRunCommandOutput) => void
1067+
): void;
1068+
public updateMapRun(
1069+
args: UpdateMapRunCommandInput,
1070+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UpdateMapRunCommandOutput) => void),
1071+
cb?: (err: any, data?: UpdateMapRunCommandOutput) => void
1072+
): Promise<UpdateMapRunCommandOutput> | void {
1073+
const command = new UpdateMapRunCommand(args);
1074+
if (typeof optionsOrCb === "function") {
1075+
this.send(command, optionsOrCb);
1076+
} else if (typeof cb === "function") {
1077+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1078+
this.send(command, optionsOrCb || {}, cb);
1079+
} else {
1080+
return this.send(command, optionsOrCb);
1081+
}
1082+
}
1083+
9741084
/**
9751085
* <p>Updates an existing state machine by modifying its <code>definition</code>,
9761086
* <code>roleArn</code>, or <code>loggingConfiguration</code>. Running executions will continue
9771087
* to use the previous <code>definition</code> and <code>roleArn</code>. You must include at
9781088
* least one of <code>definition</code> or <code>roleArn</code> or you will receive a
9791089
* <code>MissingRequiredParameter</code> error.</p>
1090+
*
1091+
* <p>If the given state machine Amazon Resource Name (ARN) is a qualified state machine ARN, it will fail with ValidationException.</p>
1092+
*
1093+
* <p>A qualified state machine ARN refers to a <i>Distributed Map state</i> defined within a state machine. For example, the qualified state machine ARN <code>arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel</code> refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in the state machine named <code>stateMachineName</code>.</p>
1094+
*
9801095
* <note>
9811096
* <p>All <code>StartExecution</code> calls within a few seconds will use the updated
9821097
* <code>definition</code> and <code>roleArn</code>. Executions started immediately after

clients/client-sfn/src/SFNClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import { DeleteActivityCommandInput, DeleteActivityCommandOutput } from "./comma
5353
import { DeleteStateMachineCommandInput, DeleteStateMachineCommandOutput } from "./commands/DeleteStateMachineCommand";
5454
import { DescribeActivityCommandInput, DescribeActivityCommandOutput } from "./commands/DescribeActivityCommand";
5555
import { DescribeExecutionCommandInput, DescribeExecutionCommandOutput } from "./commands/DescribeExecutionCommand";
56+
import { DescribeMapRunCommandInput, DescribeMapRunCommandOutput } from "./commands/DescribeMapRunCommand";
5657
import {
5758
DescribeStateMachineCommandInput,
5859
DescribeStateMachineCommandOutput,
@@ -68,6 +69,7 @@ import {
6869
} from "./commands/GetExecutionHistoryCommand";
6970
import { ListActivitiesCommandInput, ListActivitiesCommandOutput } from "./commands/ListActivitiesCommand";
7071
import { ListExecutionsCommandInput, ListExecutionsCommandOutput } from "./commands/ListExecutionsCommand";
72+
import { ListMapRunsCommandInput, ListMapRunsCommandOutput } from "./commands/ListMapRunsCommand";
7173
import { ListStateMachinesCommandInput, ListStateMachinesCommandOutput } from "./commands/ListStateMachinesCommand";
7274
import {
7375
ListTagsForResourceCommandInput,
@@ -81,6 +83,7 @@ import { StartSyncExecutionCommandInput, StartSyncExecutionCommandOutput } from
8183
import { StopExecutionCommandInput, StopExecutionCommandOutput } from "./commands/StopExecutionCommand";
8284
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
8385
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
86+
import { UpdateMapRunCommandInput, UpdateMapRunCommandOutput } from "./commands/UpdateMapRunCommand";
8487
import { UpdateStateMachineCommandInput, UpdateStateMachineCommandOutput } from "./commands/UpdateStateMachineCommand";
8588
import {
8689
ClientInputEndpointParameters,
@@ -97,12 +100,14 @@ export type ServiceInputTypes =
97100
| DeleteStateMachineCommandInput
98101
| DescribeActivityCommandInput
99102
| DescribeExecutionCommandInput
103+
| DescribeMapRunCommandInput
100104
| DescribeStateMachineCommandInput
101105
| DescribeStateMachineForExecutionCommandInput
102106
| GetActivityTaskCommandInput
103107
| GetExecutionHistoryCommandInput
104108
| ListActivitiesCommandInput
105109
| ListExecutionsCommandInput
110+
| ListMapRunsCommandInput
106111
| ListStateMachinesCommandInput
107112
| ListTagsForResourceCommandInput
108113
| SendTaskFailureCommandInput
@@ -113,6 +118,7 @@ export type ServiceInputTypes =
113118
| StopExecutionCommandInput
114119
| TagResourceCommandInput
115120
| UntagResourceCommandInput
121+
| UpdateMapRunCommandInput
116122
| UpdateStateMachineCommandInput;
117123

118124
export type ServiceOutputTypes =
@@ -122,12 +128,14 @@ export type ServiceOutputTypes =
122128
| DeleteStateMachineCommandOutput
123129
| DescribeActivityCommandOutput
124130
| DescribeExecutionCommandOutput
131+
| DescribeMapRunCommandOutput
125132
| DescribeStateMachineCommandOutput
126133
| DescribeStateMachineForExecutionCommandOutput
127134
| GetActivityTaskCommandOutput
128135
| GetExecutionHistoryCommandOutput
129136
| ListActivitiesCommandOutput
130137
| ListExecutionsCommandOutput
138+
| ListMapRunsCommandOutput
131139
| ListStateMachinesCommandOutput
132140
| ListTagsForResourceCommandOutput
133141
| SendTaskFailureCommandOutput
@@ -138,6 +146,7 @@ export type ServiceOutputTypes =
138146
| StopExecutionCommandOutput
139147
| TagResourceCommandOutput
140148
| UntagResourceCommandOutput
149+
| UpdateMapRunCommandOutput
141150
| UpdateStateMachineCommandOutput;
142151

143152
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {

clients/client-sfn/src/commands/DeleteStateMachineCommand.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export interface DeleteStateMachineCommandOutput extends DeleteStateMachineOutpu
3131
/**
3232
* <p>Deletes a state machine. This is an asynchronous operation: It sets the state machine's
3333
* status to <code>DELETING</code> and begins the deletion process. </p>
34+
*
35+
* <p>If the given state machine Amazon Resource Name (ARN) is a qualified state machine ARN, it will fail with ValidationException.</p>
36+
*
37+
* <p>A qualified state machine ARN refers to a <i>Distributed Map state</i> defined within a state machine. For example, the qualified state machine ARN <code>arn:partition:states:region:account-id:stateMachine:stateMachineName/mapStateLabel</code> refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in the state machine named <code>stateMachineName</code>.</p>
38+
*
3439
* <note>
3540
* <p>For <code>EXPRESS</code> state machines, the deletion will happen eventually (usually
3641
* less than a minute). Running executions may emit logs after <code>DeleteStateMachine</code>

clients/client-sfn/src/commands/DescribeExecutionCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export interface DescribeExecutionCommandInput extends DescribeExecutionInput {}
2929
export interface DescribeExecutionCommandOutput extends DescribeExecutionOutput, __MetadataBearer {}
3030

3131
/**
32-
* <p>Describes an execution.</p>
32+
* <p>Provides all information about a state machine execution, such as the state machine associated with the execution, the execution input and output, and relevant execution metadata. Use this API action to return the Map Run ARN if the execution was dispatched by a Map Run.</p>
3333
* <note>
3434
* <p>This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.</p>
3535
* </note>
36-
* <p>This API action is not supported by <code>EXPRESS</code> state machines.</p>
36+
* <p>This API action is not supported by <code>EXPRESS</code> state machine executions unless they were dispatched by a Map Run.</p>
3737
* @example
3838
* Use a bare-bones client and the command you need to make an API call.
3939
* ```javascript

0 commit comments

Comments
 (0)