sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ CloudFront/ DeleteKey.ts

import type * as kvs from "@distilled.cloud/aws/cloudfront-keyvaluestore";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { KeyValueStore } from "./KeyValueStore.ts";

export interface DeleteKeyRequest extends Omit<kvs.DeleteKeyRequest, "KvsARN"> {}

/**
 * Runtime binding for `cloudfront-keyvaluestore:DeleteKey`.
 *
 * Deletes a single key from the bound KeyValueStore's data plane. Writes use
 * optimistic concurrency: pass the store's current `ETag` as `IfMatch` (from
 * {@link DescribeKeyValueStore} or a previous write's response). Provide the
 * implementation with `Effect.provide(AWS.CloudFront.DeleteKeyHttp)`.
 * ### Writing KeyValueStore Data
 * **Example:** Delete a Key
 * ```typescript
 * // init — bind the operations to the store
 * const describeStore = yield* CloudFront.DescribeKeyValueStore(store);
 * const deleteKey = yield* CloudFront.DeleteKey(store);
 *
 * // runtime
 * const meta = yield* describeStore({});
 * yield* deleteKey({ Key: "routes:/about", IfMatch: meta.ETag });
 * ```
 *
 * @binding
 */
export interface DeleteKey extends Binding.Service<
  DeleteKey,
  "AWS.CloudFront.DeleteKey",
  (
    store: KeyValueStore,
  ) => Effect.Effect<
    (request: DeleteKeyRequest) => Effect.Effect<kvs.DeleteKeyResponse, kvs.DeleteKeyError>
  >
> {}

export const DeleteKey = Binding.Service<DeleteKey>("AWS.CloudFront.DeleteKey");