| 1 | import type * as ag from "@distilled.cloud/aws/api-gateway"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { UsagePlan } from "./UsagePlan.ts"; |
| 5 | |
| 6 | export interface DeleteUsagePlanKeyRequest extends Omit< |
| 7 | ag.DeleteUsagePlanKeyRequest, |
| 8 | "usagePlanId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for removing an API key from a {@link UsagePlan} |
| 13 | * (`apigateway:DELETE` on `/usageplans/{id}/keys/{keyId}`). |
| 14 | * |
| 15 | * Provide `ApiGateway.DeleteUsagePlanKeyHttp` on the Function effect to |
| 16 | * implement the binding. |
| 17 | * |
| 18 | * ### Managing plan keys |
| 19 | * **Example:** Unenroll a key on subscription cancellation |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const deleteUsagePlanKey = yield* ApiGateway.DeleteUsagePlanKey(plan); |
| 23 | * |
| 24 | * // runtime |
| 25 | * yield* deleteUsagePlanKey({ keyId }).pipe( |
| 26 | * Effect.catchTag("NotFoundException", () => Effect.void), |
| 27 | * ); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface DeleteUsagePlanKey extends Binding.Service< |
| 33 | DeleteUsagePlanKey, |
| 34 | "AWS.ApiGateway.DeleteUsagePlanKey", |
| 35 | <P extends UsagePlan>( |
| 36 | usagePlan: P, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: DeleteUsagePlanKeyRequest, |
| 40 | ) => Effect.Effect< |
| 41 | ag.DeleteUsagePlanKeyResponse, |
| 42 | ag.DeleteUsagePlanKeyError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const DeleteUsagePlanKey = Binding.Service<DeleteUsagePlanKey>( |
| 47 | "AWS.ApiGateway.DeleteUsagePlanKey", |
| 48 | ); |