| 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 StopExecutionRequest extends sfn.StopExecutionInput {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `states:StopExecution`. |
| 10 | * |
| 11 | * Bind this operation to a {@link StateMachine} inside a function runtime to |
| 12 | * cancel that machine's running executions. Not supported by `EXPRESS` |
| 13 | * workflows. |
| 14 | * ### Stopping Executions |
| 15 | * **Example:** Cancel a running execution |
| 16 | * ```typescript |
| 17 | * const stopExecution = yield* StepFunctions.StopExecution(machine); |
| 18 | * |
| 19 | * yield* stopExecution({ |
| 20 | * executionArn, |
| 21 | * error: "OrderCancelled", |
| 22 | * cause: "user requested cancellation", |
| 23 | * }); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface StopExecution extends Binding.Service< |
| 29 | StopExecution, |
| 30 | "AWS.StepFunctions.StopExecution", |
| 31 | ( |
| 32 | stateMachine: StateMachine, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request: StopExecutionRequest, |
| 36 | ) => Effect.Effect<sfn.StopExecutionOutput, sfn.StopExecutionError> |
| 37 | > |
| 38 | > {} |
| 39 | export const StopExecution = Binding.Service<StopExecution>( |
| 40 | "AWS.StepFunctions.StopExecution", |
| 41 | ); |