| 1 | import type * as ECS from "@distilled.cloud/aws/ecs"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Cluster } from "./Cluster.ts"; |
| 5 | |
| 6 | export interface ListTasksRequest extends Omit< |
| 7 | ECS.ListTasksRequest, |
| 8 | "cluster" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `ecs:ListTasks`. |
| 13 | * |
| 14 | * Bind this operation to a `Cluster` inside a function runtime to get a |
| 15 | * callable that lists task ARNs in the bound cluster. The cluster ARN is |
| 16 | * injected automatically and the grant is conditioned on the bound cluster. |
| 17 | * ### Listing Tasks |
| 18 | * **Example:** List Stopped Tasks |
| 19 | * ```typescript |
| 20 | * const listTasks = yield* AWS.ECS.ListTasks(cluster); |
| 21 | * |
| 22 | * const response = yield* listTasks({ |
| 23 | * desiredStatus: "STOPPED", |
| 24 | * }); |
| 25 | * const taskArns = response.taskArns ?? []; |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ListTasks extends Binding.Service< |
| 31 | ListTasks, |
| 32 | "AWS.ECS.ListTasks", |
| 33 | ( |
| 34 | cluster: Cluster, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: ListTasksRequest, |
| 38 | ) => Effect.Effect<ECS.ListTasksResponse, ECS.ListTasksError> |
| 39 | > |
| 40 | > {} |
| 41 | export const ListTasks = Binding.Service<ListTasks>("AWS.ECS.ListTasks"); |