Skip to content

Commit

Permalink
feat(client-sfn): This release adds support to redrive executions in …
Browse files Browse the repository at this point in the history
…AWS Step Functions with a new RedriveExecution operation.
  • Loading branch information
awstools committed Nov 14, 2023
1 parent 5319e55 commit 0627029
Show file tree
Hide file tree
Showing 18 changed files with 960 additions and 53 deletions.
11 changes: 11 additions & 0 deletions clients/client-sfn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ access to Amazon Web Services. You can access and use Step Functions using the c
For more information about Step Functions, see the <i>
<a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html">Step Functions Developer Guide</a>
</i>.</p>
<important>
<p>If you use the Step Functions API actions using Amazon Web Services SDK integrations, make sure the API actions are in camel case and parameter names are in Pascal case. For example, you could use Step Functions API action <code>startSyncExecution</code> and specify its parameter as <code>StateMachineArn</code>.</p>
</important>

## Installing

Expand Down Expand Up @@ -402,6 +405,14 @@ PublishStateMachineVersion

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/classes/publishstatemachineversioncommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/interfaces/publishstatemachineversioncommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/interfaces/publishstatemachineversioncommandoutput.html)

</details>
<details>
<summary>
RedriveExecution
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/classes/redriveexecutioncommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/interfaces/redriveexecutioncommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sfn/interfaces/redriveexecutioncommandoutput.html)

</details>
<details>
<summary>
Expand Down
4 changes: 3 additions & 1 deletion clients/client-sfn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@
"@smithy/util-endpoints": "^1.0.4",
"@smithy/util-retry": "^2.0.6",
"@smithy/util-utf8": "^2.0.2",
"tslib": "^2.5.0"
"tslib": "^2.5.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@smithy/service-client-documentation-generator": "^2.0.0",
"@tsconfig/node14": "1.0.3",
"@types/node": "^14.14.31",
"@types/uuid": "^8.3.0",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"rimraf": "3.0.2",
Expand Down
26 changes: 26 additions & 0 deletions clients/client-sfn/src/SFN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ import {
PublishStateMachineVersionCommandInput,
PublishStateMachineVersionCommandOutput,
} from "./commands/PublishStateMachineVersionCommand";
import {
RedriveExecutionCommand,
RedriveExecutionCommandInput,
RedriveExecutionCommandOutput,
} from "./commands/RedriveExecutionCommand";
import {
SendTaskFailureCommand,
SendTaskFailureCommandInput,
Expand Down Expand Up @@ -190,6 +195,7 @@ const commands = {
ListStateMachineVersionsCommand,
ListTagsForResourceCommand,
PublishStateMachineVersionCommand,
RedriveExecutionCommand,
SendTaskFailureCommand,
SendTaskHeartbeatCommand,
SendTaskSuccessCommand,
Expand Down Expand Up @@ -571,6 +577,23 @@ export interface SFN {
cb: (err: any, data?: PublishStateMachineVersionCommandOutput) => void
): void;

/**
* @see {@link RedriveExecutionCommand}
*/
redriveExecution(
args: RedriveExecutionCommandInput,
options?: __HttpHandlerOptions
): Promise<RedriveExecutionCommandOutput>;
redriveExecution(
args: RedriveExecutionCommandInput,
cb: (err: any, data?: RedriveExecutionCommandOutput) => void
): void;
redriveExecution(
args: RedriveExecutionCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: RedriveExecutionCommandOutput) => void
): void;

/**
* @see {@link SendTaskFailureCommand}
*/
Expand Down Expand Up @@ -744,6 +767,9 @@ export interface SFN {
* For more information about Step Functions, see the <i>
* <a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html">Step Functions Developer Guide</a>
* </i>.</p>
* <important>
* <p>If you use the Step Functions API actions using Amazon Web Services SDK integrations, make sure the API actions are in camel case and parameter names are in Pascal case. For example, you could use Step Functions API action <code>startSyncExecution</code> and specify its parameter as <code>StateMachineArn</code>.</p>
* </important>
*/
export class SFN extends SFNClient implements SFN {}
createAggregatedClient(commands, SFN);
6 changes: 6 additions & 0 deletions clients/client-sfn/src/SFNClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import {
PublishStateMachineVersionCommandInput,
PublishStateMachineVersionCommandOutput,
} from "./commands/PublishStateMachineVersionCommand";
import { RedriveExecutionCommandInput, RedriveExecutionCommandOutput } from "./commands/RedriveExecutionCommand";
import { SendTaskFailureCommandInput, SendTaskFailureCommandOutput } from "./commands/SendTaskFailureCommand";
import { SendTaskHeartbeatCommandInput, SendTaskHeartbeatCommandOutput } from "./commands/SendTaskHeartbeatCommand";
import { SendTaskSuccessCommandInput, SendTaskSuccessCommandOutput } from "./commands/SendTaskSuccessCommand";
Expand Down Expand Up @@ -158,6 +159,7 @@ export type ServiceInputTypes =
| ListStateMachinesCommandInput
| ListTagsForResourceCommandInput
| PublishStateMachineVersionCommandInput
| RedriveExecutionCommandInput
| SendTaskFailureCommandInput
| SendTaskHeartbeatCommandInput
| SendTaskSuccessCommandInput
Expand Down Expand Up @@ -197,6 +199,7 @@ export type ServiceOutputTypes =
| ListStateMachinesCommandOutput
| ListTagsForResourceCommandOutput
| PublishStateMachineVersionCommandOutput
| RedriveExecutionCommandOutput
| SendTaskFailureCommandOutput
| SendTaskHeartbeatCommandOutput
| SendTaskSuccessCommandOutput
Expand Down Expand Up @@ -397,6 +400,9 @@ export interface SFNClientResolvedConfig extends SFNClientResolvedConfigType {}
* For more information about Step Functions, see the <i>
* <a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html">Step Functions Developer Guide</a>
* </i>.</p>
* <important>
* <p>If you use the Step Functions API actions using Amazon Web Services SDK integrations, make sure the API actions are in camel case and parameter names are in Pascal case. For example, you could use Step Functions API action <code>startSyncExecution</code> and specify its parameter as <code>StateMachineArn</code>.</p>
* </important>
*/
export class SFNClient extends __Client<
__HttpHandlerOptions,
Expand Down
4 changes: 2 additions & 2 deletions clients/client-sfn/src/commands/DeleteStateMachineCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface DeleteStateMachineCommandOutput extends DeleteStateMachineOutpu

/**
* @public
* <p>Deletes a state machine. This is an asynchronous operation: It sets the state machine's
* status to <code>DELETING</code> and begins the deletion process. </p>
* <p>Deletes a state machine. This is an asynchronous operation. It sets the state machine's
* status to <code>DELETING</code> and begins the deletion process. A state machine is deleted only when all its executions are completed. On the next state transition, the state machine's executions are terminated.</p>
* <p>A qualified state machine ARN can either refer to a <i>Distributed Map state</i> defined within a state machine, a version ARN, or an alias ARN.</p>
* <p>The following are some examples of qualified and unqualified state machine ARNs:</p>
* <ul>
Expand Down
13 changes: 7 additions & 6 deletions clients/client-sfn/src/commands/DescribeExecutionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ export interface DescribeExecutionCommandOutput extends DescribeExecutionOutput,

/**
* @public
* <p>Provides 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 Amazon Resource Name (ARN) if the execution was
* dispatched by a Map Run.</p>
* <p>Provides information about a state machine execution, such as the state machine associated with the execution, the execution input and output, and relevant execution metadata. If you've <a href="https://docs.aws.amazon.com/step-functions/latest/dg/redrive-executions.html">redriven</a> an execution, you can use this API action to return information about the redrives of that execution. In addition, you can use this API action to return the Map Run Amazon Resource Name (ARN) if the execution was dispatched by a Map Run.</p>
* <p>If you specify a version or alias ARN when you call the <a>StartExecution</a>
* API action, <code>DescribeExecution</code> returns that ARN.</p>
* <note>
* <p>This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.</p>
* </note>
* <p>Executions of an <code>EXPRESS</code> state machinearen't supported by <code>DescribeExecution</code> unless a Map Run dispatched them.</p>
* <p>Executions of an <code>EXPRESS</code> state machine aren't supported by <code>DescribeExecution</code> unless a Map Run dispatched them.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -66,7 +63,7 @@ export interface DescribeExecutionCommandOutput extends DescribeExecutionOutput,
* // executionArn: "STRING_VALUE", // required
* // stateMachineArn: "STRING_VALUE", // required
* // name: "STRING_VALUE",
* // status: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED", // required
* // status: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED" || "PENDING_REDRIVE", // required
* // startDate: new Date("TIMESTAMP"), // required
* // stopDate: new Date("TIMESTAMP"),
* // input: "STRING_VALUE",
Expand All @@ -83,6 +80,10 @@ export interface DescribeExecutionCommandOutput extends DescribeExecutionOutput,
* // cause: "STRING_VALUE",
* // stateMachineVersionArn: "STRING_VALUE",
* // stateMachineAliasArn: "STRING_VALUE",
* // redriveCount: Number("int"),
* // redriveDate: new Date("TIMESTAMP"),
* // redriveStatus: "REDRIVABLE" || "NOT_REDRIVABLE" || "REDRIVABLE_BY_MAP_RUN",
* // redriveStatusReason: "STRING_VALUE",
* // };
*
* ```
Expand Down
8 changes: 7 additions & 1 deletion clients/client-sfn/src/commands/DescribeMapRunCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface DescribeMapRunCommandOutput extends DescribeMapRunOutput, __Met

/**
* @public
* <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>
* <p>Provides information about a Map Run's configuration, progress, and results. If you've <a href="https://docs.aws.amazon.com/step-functions/latest/dg/redrive-map-run.html">redriven</a> a Map Run, this API action also returns information about the redrives of that Map Run. 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>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down Expand Up @@ -67,6 +67,8 @@ export interface DescribeMapRunCommandOutput extends DescribeMapRunOutput, __Met
* // aborted: Number("long"), // required
* // total: Number("long"), // required
* // resultsWritten: Number("long"), // required
* // failuresNotRedrivable: Number("long"),
* // pendingRedrive: Number("long"),
* // },
* // executionCounts: { // MapRunExecutionCounts
* // pending: Number("long"), // required
Expand All @@ -77,7 +79,11 @@ export interface DescribeMapRunCommandOutput extends DescribeMapRunOutput, __Met
* // aborted: Number("long"), // required
* // total: Number("long"), // required
* // resultsWritten: Number("long"), // required
* // failuresNotRedrivable: Number("long"),
* // pendingRedrive: Number("long"),
* // },
* // redriveCount: Number("int"),
* // redriveDate: new Date("TIMESTAMP"),
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface GetExecutionHistoryCommandOutput extends GetExecutionHistoryOut
* // events: [ // HistoryEventList // required
* // { // HistoryEvent
* // timestamp: new Date("TIMESTAMP"), // required
* // type: "ActivityFailed" || "ActivityScheduled" || "ActivityScheduleFailed" || "ActivityStarted" || "ActivitySucceeded" || "ActivityTimedOut" || "ChoiceStateEntered" || "ChoiceStateExited" || "ExecutionAborted" || "ExecutionFailed" || "ExecutionStarted" || "ExecutionSucceeded" || "ExecutionTimedOut" || "FailStateEntered" || "LambdaFunctionFailed" || "LambdaFunctionScheduled" || "LambdaFunctionScheduleFailed" || "LambdaFunctionStarted" || "LambdaFunctionStartFailed" || "LambdaFunctionSucceeded" || "LambdaFunctionTimedOut" || "MapIterationAborted" || "MapIterationFailed" || "MapIterationStarted" || "MapIterationSucceeded" || "MapStateAborted" || "MapStateEntered" || "MapStateExited" || "MapStateFailed" || "MapStateStarted" || "MapStateSucceeded" || "ParallelStateAborted" || "ParallelStateEntered" || "ParallelStateExited" || "ParallelStateFailed" || "ParallelStateStarted" || "ParallelStateSucceeded" || "PassStateEntered" || "PassStateExited" || "SucceedStateEntered" || "SucceedStateExited" || "TaskFailed" || "TaskScheduled" || "TaskStarted" || "TaskStartFailed" || "TaskStateAborted" || "TaskStateEntered" || "TaskStateExited" || "TaskSubmitFailed" || "TaskSubmitted" || "TaskSucceeded" || "TaskTimedOut" || "WaitStateAborted" || "WaitStateEntered" || "WaitStateExited" || "MapRunAborted" || "MapRunFailed" || "MapRunStarted" || "MapRunSucceeded", // required
* // type: "ActivityFailed" || "ActivityScheduled" || "ActivityScheduleFailed" || "ActivityStarted" || "ActivitySucceeded" || "ActivityTimedOut" || "ChoiceStateEntered" || "ChoiceStateExited" || "ExecutionAborted" || "ExecutionFailed" || "ExecutionStarted" || "ExecutionSucceeded" || "ExecutionTimedOut" || "FailStateEntered" || "LambdaFunctionFailed" || "LambdaFunctionScheduled" || "LambdaFunctionScheduleFailed" || "LambdaFunctionStarted" || "LambdaFunctionStartFailed" || "LambdaFunctionSucceeded" || "LambdaFunctionTimedOut" || "MapIterationAborted" || "MapIterationFailed" || "MapIterationStarted" || "MapIterationSucceeded" || "MapStateAborted" || "MapStateEntered" || "MapStateExited" || "MapStateFailed" || "MapStateStarted" || "MapStateSucceeded" || "ParallelStateAborted" || "ParallelStateEntered" || "ParallelStateExited" || "ParallelStateFailed" || "ParallelStateStarted" || "ParallelStateSucceeded" || "PassStateEntered" || "PassStateExited" || "SucceedStateEntered" || "SucceedStateExited" || "TaskFailed" || "TaskScheduled" || "TaskStarted" || "TaskStartFailed" || "TaskStateAborted" || "TaskStateEntered" || "TaskStateExited" || "TaskSubmitFailed" || "TaskSubmitted" || "TaskSucceeded" || "TaskTimedOut" || "WaitStateAborted" || "WaitStateEntered" || "WaitStateExited" || "MapRunAborted" || "MapRunFailed" || "MapRunStarted" || "MapRunSucceeded" || "ExecutionRedriven" || "MapRunRedriven", // required
* // id: Number("long"), // required
* // previousEventId: Number("long"),
* // activityFailedEventDetails: { // ActivityFailedEventDetails
Expand Down Expand Up @@ -179,6 +179,9 @@ export interface GetExecutionHistoryCommandOutput extends GetExecutionHistoryOut
* // error: "STRING_VALUE",
* // cause: "STRING_VALUE",
* // },
* // executionRedrivenEventDetails: { // ExecutionRedrivenEventDetails
* // redriveCount: Number("int"),
* // },
* // mapStateStartedEventDetails: { // MapStateStartedEventDetails
* // length: Number("int"),
* // },
Expand Down Expand Up @@ -244,6 +247,10 @@ export interface GetExecutionHistoryCommandOutput extends GetExecutionHistoryOut
* // error: "STRING_VALUE",
* // cause: "STRING_VALUE",
* // },
* // mapRunRedrivenEventDetails: { // MapRunRedrivenEventDetails
* // mapRunArn: "STRING_VALUE",
* // redriveCount: Number("int"),
* // },
* // },
* // ],
* // nextToken: "STRING_VALUE",
Expand Down
9 changes: 6 additions & 3 deletions clients/client-sfn/src/commands/ListExecutionsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ListExecutionsCommandOutput extends ListExecutionsOutput, __Met

/**
* @public
* <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>
* <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. Using this API action, you can also list all <a href="https://docs.aws.amazon.com/step-functions/latest/dg/redrive-executions.html">redriven</a> executions.</p>
* <p>You can also provide a state machine <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-alias.html">alias</a> ARN or <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-version.html">version</a> ARN to list the executions associated with a specific alias or version.</p>
* <p>Results are
* sorted by time, with the most recent execution first.</p>
Expand All @@ -55,10 +55,11 @@ export interface ListExecutionsCommandOutput extends ListExecutionsOutput, __Met
* const client = new SFNClient(config);
* const input = { // ListExecutionsInput
* stateMachineArn: "STRING_VALUE",
* statusFilter: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED",
* statusFilter: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED" || "PENDING_REDRIVE",
* maxResults: Number("int"),
* nextToken: "STRING_VALUE",
* mapRunArn: "STRING_VALUE",
* redriveFilter: "REDRIVEN" || "NOT_REDRIVEN",
* };
* const command = new ListExecutionsCommand(input);
* const response = await client.send(command);
Expand All @@ -68,13 +69,15 @@ export interface ListExecutionsCommandOutput extends ListExecutionsOutput, __Met
* // executionArn: "STRING_VALUE", // required
* // stateMachineArn: "STRING_VALUE", // required
* // name: "STRING_VALUE", // required
* // status: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED", // required
* // status: "RUNNING" || "SUCCEEDED" || "FAILED" || "TIMED_OUT" || "ABORTED" || "PENDING_REDRIVE", // required
* // startDate: new Date("TIMESTAMP"), // required
* // stopDate: new Date("TIMESTAMP"),
* // mapRunArn: "STRING_VALUE",
* // itemCount: Number("int"),
* // stateMachineVersionArn: "STRING_VALUE",
* // stateMachineAliasArn: "STRING_VALUE",
* // redriveCount: Number("int"),
* // redriveDate: new Date("TIMESTAMP"),
* // },
* // ],
* // nextToken: "STRING_VALUE",
Expand Down
Loading

0 comments on commit 0627029

Please sign in to comment.