sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ GlobalAccelerator/ DescribeEndpointGroup.ts

import type * as ga from "@distilled.cloud/aws/global-accelerator";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { EndpointGroup } from "./EndpointGroup.ts";

/**
 * Runtime binding for `globalaccelerator:DescribeEndpointGroup`.
 *
 * Reads the bound {@link EndpointGroup}'s live state — most usefully the
 * observed per-endpoint health (`HEALTHY` / `UNHEALTHY` / `INITIAL`) — so a
 * function can monitor regional endpoint health or verify an endpoint it
 * just registered. The endpoint group ARN is injected from the binding.
 * Provide the implementation with
 * `Effect.provide(AWS.GlobalAccelerator.DescribeEndpointGroupHttp)`.
 * ### Observing Endpoint Groups
 * **Example:** Check Endpoint Health
 * ```typescript
 * // init — bind the operation to the endpoint group
 * const describeEndpointGroup =
 *   yield* AWS.GlobalAccelerator.DescribeEndpointGroup(group);
 *
 * // runtime
 * const { EndpointGroup } = yield* describeEndpointGroup({});
 * const unhealthy = (EndpointGroup?.EndpointDescriptions ?? []).filter(
 *   (endpoint) => endpoint.HealthState === "UNHEALTHY",
 * );
 * ```
 *
 * @binding
 */
export interface DescribeEndpointGroup extends Binding.Service<
  DescribeEndpointGroup,
  "AWS.GlobalAccelerator.DescribeEndpointGroup",
  (
    endpointGroup: EndpointGroup,
  ) => Effect.Effect<
    (
      request: Omit<ga.DescribeEndpointGroupRequest, "EndpointGroupArn">,
    ) => Effect.Effect<ga.DescribeEndpointGroupResponse, ga.DescribeEndpointGroupError>
  >
> {}
export const DescribeEndpointGroup = Binding.Service<DescribeEndpointGroup>(
  "AWS.GlobalAccelerator.DescribeEndpointGroup",
);