| 1 | import type * as elbv2 from "@distilled.cloud/aws/elastic-load-balancing-v2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { LoadBalancer } from "./LoadBalancer.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `ModifyCapacityReservation` request with `LoadBalancerArn` injected from |
| 8 | * the bound {@link LoadBalancer}. |
| 9 | */ |
| 10 | export interface ModifyCapacityReservationRequest extends Omit< |
| 11 | elbv2.ModifyCapacityReservationInput, |
| 12 | "LoadBalancerArn" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `ModifyCapacityReservation` operation (IAM action |
| 17 | * `elasticloadbalancing:ModifyCapacityReservation` scoped to the |
| 18 | * load-balancer ARN). |
| 19 | * |
| 20 | * Sets or resets the bound load balancer's minimum LCU capacity reservation |
| 21 | * at runtime — e.g. a Lambda that pre-provisions capacity ahead of a known |
| 22 | * traffic spike (product launch, ticket sale) and resets it afterwards, the |
| 23 | * ELBv2 analogue of Auto Scaling's `SetDesiredCapacity`. Provide the |
| 24 | * implementation with |
| 25 | * `Effect.provide(AWS.ELBv2.ModifyCapacityReservationHttp)`. |
| 26 | * ### Capacity Reservation |
| 27 | * **Example:** Reserve capacity ahead of a spike |
| 28 | * ```typescript |
| 29 | * // init — bind the operation to the load balancer |
| 30 | * const modifyCapacityReservation = |
| 31 | * yield* AWS.ELBv2.ModifyCapacityReservation(loadBalancer); |
| 32 | * |
| 33 | * // runtime — reserve 100 LCUs per Availability Zone |
| 34 | * yield* modifyCapacityReservation({ |
| 35 | * MinimumLoadBalancerCapacity: { CapacityUnits: 100 }, |
| 36 | * }); |
| 37 | * |
| 38 | * // later — release the reservation |
| 39 | * yield* modifyCapacityReservation({ ResetCapacityReservation: true }); |
| 40 | * ``` |
| 41 | * |
| 42 | * @binding |
| 43 | */ |
| 44 | export interface ModifyCapacityReservation extends Binding.Service< |
| 45 | ModifyCapacityReservation, |
| 46 | "AWS.ELBv2.ModifyCapacityReservation", |
| 47 | ( |
| 48 | loadBalancer: LoadBalancer, |
| 49 | ) => Effect.Effect< |
| 50 | ( |
| 51 | request: ModifyCapacityReservationRequest, |
| 52 | ) => Effect.Effect< |
| 53 | elbv2.ModifyCapacityReservationOutput, |
| 54 | elbv2.ModifyCapacityReservationError |
| 55 | > |
| 56 | > |
| 57 | > {} |
| 58 | |
| 59 | export const ModifyCapacityReservation = |
| 60 | Binding.Service<ModifyCapacityReservation>( |
| 61 | "AWS.ELBv2.ModifyCapacityReservation", |
| 62 | ); |