1import type * as ag from "@distilled.cloud/aws/api-gateway";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5export interface CreateApiKeyRequest extends ag.CreateApiKeyRequest {}
6
7/**
8 * Runtime binding for issuing API Gateway API keys
9 * (`apigateway:POST` on `/apikeys`). Account-scoped — takes no resource.
10 *
11 * The response's `value` is `Redacted<string>` (distilled marks it
12 * sensitive), so the plaintext key never leaks into logs. Provide
13 * `ApiGateway.CreateApiKeyHttp` on the Function effect to implement the
14 * binding.
15 *
16 * ### Issuing API keys
17 * **Example:** Issue a key for a new customer
18 * ```typescript
19 * import * as Redacted from "effect/Redacted";
20 *
21 * // init — account-level binding takes no resource
22 * const createApiKey = yield* ApiGateway.CreateApiKey();
23 *
24 * // runtime
25 * const key = yield* createApiKey({
26 * name: `customer-${customerId}`,
27 * enabled: true,
28 * });
29 * const plaintext = Redacted.isRedacted(key.value)
30 * ? Redacted.value(key.value)
31 * : key.value;
32 * ```
33 *
34 * @binding
35 */
36export interface CreateApiKey extends Binding.Service<
37 CreateApiKey,
38 "AWS.ApiGateway.CreateApiKey",
39 () => Effect.Effect<
40 (
41 request?: CreateApiKeyRequest,
42 ) => Effect.Effect<ag.ApiKey, ag.CreateApiKeyError>
43 >
44> {}
45export const CreateApiKey = Binding.Service<CreateApiKey>(
46 "AWS.ApiGateway.CreateApiKey",
47);