sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ ApiGateway/ UpdateApiKey.ts

import type * as ag from "@distilled.cloud/aws/api-gateway";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

export interface UpdateApiKeyRequest extends ag.UpdateApiKeyRequest {}

/**
 * Runtime binding for patching an API Gateway API key
 * (`apigateway:PATCH` on `/apikeys/{id}`). Account-scoped — takes no
 * resource.
 *
 * Provide `ApiGateway.UpdateApiKeyHttp` on the Function effect to
 * implement the binding.
 *
 * ### Managing API keys
 * **Example:** Disable a key
 * ```typescript
 * // init
 * const updateApiKey = yield* ApiGateway.UpdateApiKey();
 *
 * // runtime
 * yield* updateApiKey({
 *   apiKey: keyId,
 *   patchOperations: [{ op: "replace", path: "/enabled", value: "false" }],
 * });
 * ```
 *
 * @binding
 */
export interface UpdateApiKey extends Binding.Service<
  UpdateApiKey,
  "AWS.ApiGateway.UpdateApiKey",
  () => Effect.Effect<
    (request: UpdateApiKeyRequest) => Effect.Effect<ag.ApiKey, ag.UpdateApiKeyError>
  >
> {}
export const UpdateApiKey = Binding.Service<UpdateApiKey>("AWS.ApiGateway.UpdateApiKey");