| 1 | import type * as appflow from "@distilled.cloud/aws/appflow"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Flow } from "./Flow.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `appflow:StopFlow`. |
| 8 | * |
| 9 | * Bind this operation to a {@link Flow} in the function's init phase to get a |
| 10 | * callable that deactivates a schedule or event-triggered flow. On-demand |
| 11 | * flows cannot be stopped — AppFlow rejects them with a typed |
| 12 | * `UnsupportedOperationException`. The flow name is injected automatically |
| 13 | * and `appflow:StopFlow` is granted on the flow. Provide the implementation |
| 14 | * with `Effect.provide(AWS.AppFlow.StopFlowHttp)`. |
| 15 | * ### Running Flows |
| 16 | * **Example:** Deactivate a Scheduled Flow from a Handler |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the flow |
| 19 | * const stopFlow = yield* AWS.AppFlow.StopFlow(flow); |
| 20 | * |
| 21 | * // runtime — deactivate the flow |
| 22 | * const result = yield* stopFlow(); |
| 23 | * // result.flowStatus === "Suspended" |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface StopFlow extends Binding.Service< |
| 29 | StopFlow, |
| 30 | "AWS.AppFlow.StopFlow", |
| 31 | ( |
| 32 | flow: Flow, |
| 33 | ) => Effect.Effect< |
| 34 | () => Effect.Effect<appflow.StopFlowResponse, appflow.StopFlowError> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const StopFlow = Binding.Service<StopFlow>("AWS.AppFlow.StopFlow"); |