1import type * as elbv2 from "@distilled.cloud/aws/elastic-load-balancing-v2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { TargetGroup } from "./TargetGroup.ts";
5
6/**
7 * `DescribeTargetHealth` request with `TargetGroupArn` injected from the
8 * bound {@link TargetGroup}.
9 */
10export interface DescribeTargetHealthRequest extends Omit<
11 elbv2.DescribeTargetHealthInput,
12 "TargetGroupArn"
13> {}
14
15/**
16 * Runtime binding for the `DescribeTargetHealth` operation (IAM action
17 * `elasticloadbalancing:DescribeTargetHealth`; ELBv2 `Describe*` actions do
18 * not support resource-level permissions, so the grant is on `*`).
19 *
20 * Reads the live health state of the bound target group's targets — e.g. a
21 * readiness gate that waits for a freshly registered target to turn
22 * `healthy` before shifting traffic, or an ops endpoint surfacing fleet
23 * health. Provide the implementation with
24 * `Effect.provide(AWS.ELBv2.DescribeTargetHealthHttp)`.
25 * ### Target Health
26 * **Example:** Check the health of every target
27 * ```typescript
28 * // init — bind the operation to the target group
29 * const describeTargetHealth = yield* AWS.ELBv2.DescribeTargetHealth(targetGroup);
30 *
31 * // runtime — read health states
32 * const health = yield* describeTargetHealth({});
33 * const states = health.TargetHealthDescriptions?.map(
34 * (d) => d.TargetHealth?.State,
35 * );
36 * ```
37 *
38 * @binding
39 */
40export interface DescribeTargetHealth extends Binding.Service<
41 DescribeTargetHealth,
42 "AWS.ELBv2.DescribeTargetHealth",
43 (
44 targetGroup: TargetGroup,
45 ) => Effect.Effect<
46 (
47 request: DescribeTargetHealthRequest,
48 ) => Effect.Effect<
49 elbv2.DescribeTargetHealthOutput,
50 elbv2.DescribeTargetHealthError
51 >
52 >
53> {}
54
55export const DescribeTargetHealth = Binding.Service<DescribeTargetHealth>(
56 "AWS.ELBv2.DescribeTargetHealth",
57);