| 1 | import type * as sfn from "@distilled.cloud/aws/sfn"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { StateMachine } from "./StateMachine.ts"; |
| 5 | |
| 6 | export interface RedriveExecutionRequest extends sfn.RedriveExecutionInput {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `states:RedriveExecution`. |
| 10 | * |
| 11 | * Restarts a failed, aborted, or timed-out `STANDARD` execution from its |
| 12 | * failure point, reusing the same input and execution ARN. IAM access is |
| 13 | * scoped to executions of the bound {@link StateMachine}. Executions that |
| 14 | * are still running (or succeeded) fail with the typed |
| 15 | * `ExecutionNotRedrivable` error. |
| 16 | * ### Redriving Executions |
| 17 | * **Example:** Redrive a failed execution |
| 18 | * ```typescript |
| 19 | * const redriveExecution = yield* StepFunctions.RedriveExecution(machine); |
| 20 | * |
| 21 | * yield* redriveExecution({ executionArn }).pipe( |
| 22 | * Effect.catchTag("ExecutionNotRedrivable", () => Effect.void), |
| 23 | * ); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface RedriveExecution extends Binding.Service< |
| 29 | RedriveExecution, |
| 30 | "AWS.StepFunctions.RedriveExecution", |
| 31 | ( |
| 32 | stateMachine: StateMachine, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request: RedriveExecutionRequest, |
| 36 | ) => Effect.Effect<sfn.RedriveExecutionOutput, sfn.RedriveExecutionError> |
| 37 | > |
| 38 | > {} |
| 39 | export const RedriveExecution = Binding.Service<RedriveExecution>( |
| 40 | "AWS.StepFunctions.RedriveExecution", |
| 41 | ); |