| 1 | import type * as autoscaling from "@distilled.cloud/aws/auto-scaling"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { AutoScalingGroup } from "./AutoScalingGroup.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `SetDesiredCapacity` request with `AutoScalingGroupName` injected from the |
| 8 | * bound {@link AutoScalingGroup}. |
| 9 | */ |
| 10 | export interface SetDesiredCapacityRequest extends Omit< |
| 11 | autoscaling.SetDesiredCapacityType, |
| 12 | "AutoScalingGroupName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `SetDesiredCapacity` operation (IAM action |
| 17 | * `autoscaling:SetDesiredCapacity` scoped to the group ARN). |
| 18 | * |
| 19 | * Manually sets the size of the bound Auto Scaling Group — e.g. a Lambda that |
| 20 | * scales a fleet up ahead of a known traffic spike or down to zero overnight. |
| 21 | * Provide the implementation with |
| 22 | * `Effect.provide(AWS.AutoScaling.SetDesiredCapacityHttp)`. |
| 23 | * ### Manual Scaling |
| 24 | * **Example:** Scale the fleet to a fixed size |
| 25 | * ```typescript |
| 26 | * // init — bind the operation to the group |
| 27 | * const setDesiredCapacity = yield* AWS.AutoScaling.SetDesiredCapacity(group); |
| 28 | * |
| 29 | * // runtime — set the fleet size, honoring the group's cooldown |
| 30 | * yield* setDesiredCapacity({ DesiredCapacity: 4, HonorCooldown: true }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface SetDesiredCapacity extends Binding.Service< |
| 36 | SetDesiredCapacity, |
| 37 | "AWS.AutoScaling.SetDesiredCapacity", |
| 38 | ( |
| 39 | group: AutoScalingGroup, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: SetDesiredCapacityRequest, |
| 43 | ) => Effect.Effect< |
| 44 | autoscaling.SetDesiredCapacityResponse, |
| 45 | autoscaling.SetDesiredCapacityError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | |
| 50 | export const SetDesiredCapacity = Binding.Service<SetDesiredCapacity>( |
| 51 | "AWS.AutoScaling.SetDesiredCapacity", |
| 52 | ); |