| 1 | import type * as WAFV2 from "@distilled.cloud/aws/wafv2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `wafv2:CreateAPIKey` — mint an API key for the |
| 7 | * CAPTCHA JavaScript integration, scoped to up to 5 token domains (e.g. |
| 8 | * onboarding a new tenant domain in a SaaS). The returned key is embedded |
| 9 | * in client-side JavaScript by design (it is not a secret credential). |
| 10 | * |
| 11 | * Provide `WAFv2.CreateAPIKeyHttp` on the hosting Lambda Function to |
| 12 | * satisfy the requirement. |
| 13 | * ### CAPTCHA API Keys |
| 14 | * **Example:** Mint a CAPTCHA API Key for a Domain |
| 15 | * ```typescript |
| 16 | * // init — grants wafv2:CreateAPIKey |
| 17 | * const createAPIKey = yield* AWS.WAFv2.CreateAPIKey(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { APIKey } = yield* createAPIKey({ |
| 21 | * Scope: "REGIONAL", |
| 22 | * TokenDomains: ["example.com"], |
| 23 | * }); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface CreateAPIKey extends Binding.Service< |
| 29 | CreateAPIKey, |
| 30 | "AWS.WAFv2.CreateAPIKey", |
| 31 | () => Effect.Effect< |
| 32 | ( |
| 33 | request: WAFV2.CreateAPIKeyRequest, |
| 34 | ) => Effect.Effect<WAFV2.CreateAPIKeyResponse, WAFV2.CreateAPIKeyError> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const CreateAPIKey = Binding.Service<CreateAPIKey>( |
| 39 | "AWS.WAFv2.CreateAPIKey", |
| 40 | ); |
| 41 | |
| 42 | /** |
| 43 | * Runtime binding for `wafv2:GetDecryptedAPIKey` — read the token domains |
| 44 | * and creation time encoded in a CAPTCHA API key. |
| 45 | * |
| 46 | * Provide `WAFv2.GetDecryptedAPIKeyHttp` on the hosting Lambda Function to |
| 47 | * satisfy the requirement. |
| 48 | * ### CAPTCHA API Keys |
| 49 | * **Example:** Inspect an API Key |
| 50 | * ```typescript |
| 51 | * // init — grants wafv2:GetDecryptedAPIKey |
| 52 | * const getDecryptedAPIKey = yield* AWS.WAFv2.GetDecryptedAPIKey(); |
| 53 | * |
| 54 | * // runtime |
| 55 | * const { TokenDomains } = yield* getDecryptedAPIKey({ |
| 56 | * Scope: "REGIONAL", |
| 57 | * APIKey: apiKey, |
| 58 | * }); |
| 59 | * ``` |
| 60 | * |
| 61 | * @binding |
| 62 | */ |
| 63 | export interface GetDecryptedAPIKey extends Binding.Service< |
| 64 | GetDecryptedAPIKey, |
| 65 | "AWS.WAFv2.GetDecryptedAPIKey", |
| 66 | () => Effect.Effect< |
| 67 | ( |
| 68 | request: WAFV2.GetDecryptedAPIKeyRequest, |
| 69 | ) => Effect.Effect< |
| 70 | WAFV2.GetDecryptedAPIKeyResponse, |
| 71 | WAFV2.GetDecryptedAPIKeyError |
| 72 | > |
| 73 | > |
| 74 | > {} |
| 75 | |
| 76 | export const GetDecryptedAPIKey = Binding.Service<GetDecryptedAPIKey>( |
| 77 | "AWS.WAFv2.GetDecryptedAPIKey", |
| 78 | ); |
| 79 | |
| 80 | /** |
| 81 | * Runtime binding for `wafv2:ListAPIKeys` — list the CAPTCHA API keys |
| 82 | * defined for a scope (also returns the CAPTCHA JavaScript integration |
| 83 | * URL). |
| 84 | * |
| 85 | * Provide `WAFv2.ListAPIKeysHttp` on the hosting Lambda Function to |
| 86 | * satisfy the requirement. |
| 87 | * ### CAPTCHA API Keys |
| 88 | * **Example:** List API Keys |
| 89 | * ```typescript |
| 90 | * // init — grants wafv2:ListAPIKeys |
| 91 | * const listAPIKeys = yield* AWS.WAFv2.ListAPIKeys(); |
| 92 | * |
| 93 | * // runtime |
| 94 | * const { APIKeySummaries } = yield* listAPIKeys({ Scope: "REGIONAL" }); |
| 95 | * ``` |
| 96 | * |
| 97 | * @binding |
| 98 | */ |
| 99 | export interface ListAPIKeys extends Binding.Service< |
| 100 | ListAPIKeys, |
| 101 | "AWS.WAFv2.ListAPIKeys", |
| 102 | () => Effect.Effect< |
| 103 | ( |
| 104 | request: WAFV2.ListAPIKeysRequest, |
| 105 | ) => Effect.Effect<WAFV2.ListAPIKeysResponse, WAFV2.ListAPIKeysError> |
| 106 | > |
| 107 | > {} |
| 108 | |
| 109 | export const ListAPIKeys = Binding.Service<ListAPIKeys>( |
| 110 | "AWS.WAFv2.ListAPIKeys", |
| 111 | ); |
| 112 | |
| 113 | /** |
| 114 | * Runtime binding for `wafv2:DeleteAPIKey` — delete a CAPTCHA API key |
| 115 | * (e.g. offboarding a tenant domain). |
| 116 | * |
| 117 | * Provide `WAFv2.DeleteAPIKeyHttp` on the hosting Lambda Function to |
| 118 | * satisfy the requirement. |
| 119 | * ### CAPTCHA API Keys |
| 120 | * **Example:** Delete an API Key |
| 121 | * ```typescript |
| 122 | * // init — grants wafv2:DeleteAPIKey |
| 123 | * const deleteAPIKey = yield* AWS.WAFv2.DeleteAPIKey(); |
| 124 | * |
| 125 | * // runtime |
| 126 | * yield* deleteAPIKey({ Scope: "REGIONAL", APIKey: apiKey }); |
| 127 | * ``` |
| 128 | * |
| 129 | * @binding |
| 130 | */ |
| 131 | export interface DeleteAPIKey extends Binding.Service< |
| 132 | DeleteAPIKey, |
| 133 | "AWS.WAFv2.DeleteAPIKey", |
| 134 | () => Effect.Effect< |
| 135 | ( |
| 136 | request: WAFV2.DeleteAPIKeyRequest, |
| 137 | ) => Effect.Effect<WAFV2.DeleteAPIKeyResponse, WAFV2.DeleteAPIKeyError> |
| 138 | > |
| 139 | > {} |
| 140 | |
| 141 | export const DeleteAPIKey = Binding.Service<DeleteAPIKey>( |
| 142 | "AWS.WAFv2.DeleteAPIKey", |
| 143 | ); |