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 GetTaskProtectionRequest extends Omit<
7 ECS.GetTaskProtectionRequest,
8 "cluster"
9> {}
10
11/**
12 * Runtime binding for `ecs:GetTaskProtection`.
13 *
14 * Bind this operation to a `Cluster` inside a function runtime to get a
15 * callable that reads the scale-in protection status of service-managed tasks
16 * in the bound cluster. The cluster ARN is injected automatically and the
17 * host is granted `ecs:GetTaskProtection` on the cluster's tasks.
18 * ### Task Protection
19 * **Example:** Read a Task's Protection Status
20 * ```typescript
21 * const getTaskProtection = yield* AWS.ECS.GetTaskProtection(cluster);
22 *
23 * const response = yield* getTaskProtection({ tasks: [taskArn] });
24 * const protected_ = response.protectedTasks?.[0]?.protectionEnabled;
25 * ```
26 *
27 * @binding
28 */
29export interface GetTaskProtection extends Binding.Service<
30 GetTaskProtection,
31 "AWS.ECS.GetTaskProtection",
32 (
33 cluster: Cluster,
34 ) => Effect.Effect<
35 (
36 request: GetTaskProtectionRequest,
37 ) => Effect.Effect<
38 ECS.GetTaskProtectionResponse,
39 ECS.GetTaskProtectionError
40 >
41 >
42> {}
43export const GetTaskProtection = Binding.Service<GetTaskProtection>(
44 "AWS.ECS.GetTaskProtection",
45);