| 1 | import type * as kvs from "@distilled.cloud/aws/cloudfront-keyvaluestore"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { KeyValueStore } from "./KeyValueStore.ts"; |
| 5 | |
| 6 | export interface DeleteKeyRequest extends Omit< |
| 7 | kvs.DeleteKeyRequest, |
| 8 | "KvsARN" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `cloudfront-keyvaluestore:DeleteKey`. |
| 13 | * |
| 14 | * Deletes a single key from the bound KeyValueStore's data plane. Writes use |
| 15 | * optimistic concurrency: pass the store's current `ETag` as `IfMatch` (from |
| 16 | * {@link DescribeKeyValueStore} or a previous write's response). Provide the |
| 17 | * implementation with `Effect.provide(AWS.CloudFront.DeleteKeyHttp)`. |
| 18 | * ### Writing KeyValueStore Data |
| 19 | * **Example:** Delete a Key |
| 20 | * ```typescript |
| 21 | * // init — bind the operations to the store |
| 22 | * const describeStore = yield* CloudFront.DescribeKeyValueStore(store); |
| 23 | * const deleteKey = yield* CloudFront.DeleteKey(store); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const meta = yield* describeStore({}); |
| 27 | * yield* deleteKey({ Key: "routes:/about", IfMatch: meta.ETag }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface DeleteKey extends Binding.Service< |
| 33 | DeleteKey, |
| 34 | "AWS.CloudFront.DeleteKey", |
| 35 | ( |
| 36 | store: KeyValueStore, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: DeleteKeyRequest, |
| 40 | ) => Effect.Effect<kvs.DeleteKeyResponse, kvs.DeleteKeyError> |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const DeleteKey = Binding.Service<DeleteKey>("AWS.CloudFront.DeleteKey"); |