1import type * as ECS from "@distilled.cloud/aws/ecs";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Cluster } from "./Cluster.ts";
5
6export interface StopTaskRequest extends Omit<ECS.StopTaskRequest, "cluster"> {}
7
8/**
9 * Runtime binding for `ecs:StopTask`.
10 *
11 * Bind this operation to a `Cluster` inside a function runtime to get a
12 * callable that stops a running task in the bound cluster. The cluster ARN is
13 * injected automatically and the host is granted `ecs:StopTask` on the
14 * cluster's tasks.
15 * ### Stopping Tasks
16 * **Example:** Stop a Running Task
17 * ```typescript
18 * const stopTask = yield* AWS.ECS.StopTask(cluster);
19 *
20 * const response = yield* stopTask({
21 * task: taskArn,
22 * reason: "drained by worker",
23 * });
24 * ```
25 *
26 * @binding
27 */
28export interface StopTask extends Binding.Service<
29 StopTask,
30 "AWS.ECS.StopTask",
31 (
32 cluster: Cluster,
33 ) => Effect.Effect<
34 (
35 request: StopTaskRequest,
36 ) => Effect.Effect<ECS.StopTaskResponse, ECS.StopTaskError>
37 >
38> {}
39export const StopTask = Binding.Service<StopTask>("AWS.ECS.StopTask");