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 DescribeTasksRequest extends Omit<
7 ECS.DescribeTasksRequest,
8 "cluster"
9> {}
10
11/**
12 * Runtime binding for `ecs:DescribeTasks`.
13 *
14 * Bind this operation to a `Cluster` inside a function runtime to get a
15 * callable that describes tasks in the bound cluster. The cluster ARN is
16 * injected automatically and the host is granted `ecs:DescribeTasks` on the
17 * cluster's tasks.
18 * ### Describing Tasks
19 * **Example:** Poll a Task Until It Stops
20 * ```typescript
21 * const describeTasks = yield* AWS.ECS.DescribeTasks(cluster);
22 *
23 * const response = yield* describeTasks({ tasks: [taskArn] });
24 * const status = response.tasks?.[0]?.lastStatus;
25 * const exitCode = response.tasks?.[0]?.containers?.[0]?.exitCode;
26 * ```
27 *
28 * @binding
29 */
30export interface DescribeTasks extends Binding.Service<
31 DescribeTasks,
32 "AWS.ECS.DescribeTasks",
33 (
34 cluster: Cluster,
35 ) => Effect.Effect<
36 (
37 request: DescribeTasksRequest,
38 ) => Effect.Effect<ECS.DescribeTasksResponse, ECS.DescribeTasksError>
39 >
40> {}
41export const DescribeTasks = Binding.Service<DescribeTasks>(
42 "AWS.ECS.DescribeTasks",
43);