| 1 | import type * as ga from "@distilled.cloud/aws/global-accelerator"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { EndpointGroup } from "./EndpointGroup.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `globalaccelerator:DescribeEndpointGroup`. |
| 8 | * |
| 9 | * Reads the bound {@link EndpointGroup}'s live state — most usefully the |
| 10 | * observed per-endpoint health (`HEALTHY` / `UNHEALTHY` / `INITIAL`) — so a |
| 11 | * function can monitor regional endpoint health or verify an endpoint it |
| 12 | * just registered. The endpoint group ARN is injected from the binding. |
| 13 | * Provide the implementation with |
| 14 | * `Effect.provide(AWS.GlobalAccelerator.DescribeEndpointGroupHttp)`. |
| 15 | * ### Observing Endpoint Groups |
| 16 | * **Example:** Check Endpoint Health |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the endpoint group |
| 19 | * const describeEndpointGroup = |
| 20 | * yield* AWS.GlobalAccelerator.DescribeEndpointGroup(group); |
| 21 | * |
| 22 | * // runtime |
| 23 | * const { EndpointGroup } = yield* describeEndpointGroup({}); |
| 24 | * const unhealthy = (EndpointGroup?.EndpointDescriptions ?? []).filter( |
| 25 | * (endpoint) => endpoint.HealthState === "UNHEALTHY", |
| 26 | * ); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface DescribeEndpointGroup extends Binding.Service< |
| 32 | DescribeEndpointGroup, |
| 33 | "AWS.GlobalAccelerator.DescribeEndpointGroup", |
| 34 | ( |
| 35 | endpointGroup: EndpointGroup, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: Omit<ga.DescribeEndpointGroupRequest, "EndpointGroupArn">, |
| 39 | ) => Effect.Effect< |
| 40 | ga.DescribeEndpointGroupResponse, |
| 41 | ga.DescribeEndpointGroupError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | export const DescribeEndpointGroup = Binding.Service<DescribeEndpointGroup>( |
| 46 | "AWS.GlobalAccelerator.DescribeEndpointGroup", |
| 47 | ); |