1import type * as autoscaling from "@distilled.cloud/aws/auto-scaling";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { AutoScalingGroup } from "./AutoScalingGroup.ts";
5
6/**
7 * Runtime binding for the `DescribeAutoScalingGroups` operation scoped to one
8 * group (IAM action `autoscaling:DescribeAutoScalingGroups`; EC2 Auto Scaling
9 * `Describe*` actions do not support resource-level permissions, so the grant
10 * is on `*`).
11 *
12 * Returns the bound group's live description — capacity, instances and their
13 * lifecycle states, suspended processes — or `undefined` if the group no
14 * longer exists. Provide the implementation with
15 * `Effect.provide(AWS.AutoScaling.DescribeAutoScalingGroupHttp)`.
16 * ### Observing the Fleet
17 * **Example:** Inspect live capacity and instances
18 * ```typescript
19 * // init — bind the operation to the group
20 * const describeGroup = yield* AWS.AutoScaling.DescribeAutoScalingGroup(group);
21 *
22 * // runtime — read the group's live state
23 * const live = yield* describeGroup();
24 * const inService = (live?.Instances ?? []).filter(
25 * (i) => i.LifecycleState === "InService",
26 * );
27 * ```
28 *
29 * @binding
30 */
31export interface DescribeAutoScalingGroup extends Binding.Service<
32 DescribeAutoScalingGroup,
33 "AWS.AutoScaling.DescribeAutoScalingGroup",
34 (
35 group: AutoScalingGroup,
36 ) => Effect.Effect<
37 () => Effect.Effect<
38 autoscaling.AutoScalingGroup | undefined,
39 autoscaling.DescribeAutoScalingGroupsError
40 >
41 >
42> {}
43
44export const DescribeAutoScalingGroup =
45 Binding.Service<DescribeAutoScalingGroup>(
46 "AWS.AutoScaling.DescribeAutoScalingGroup",
47 );