| 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 DescribeKeyValueStoreRequest extends Omit< |
| 7 | kvs.DescribeKeyValueStoreRequest, |
| 8 | "KvsARN" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `cloudfront-keyvaluestore:DescribeKeyValueStore`. |
| 13 | * |
| 14 | * Reads the bound KeyValueStore's data-plane metadata — item count, total |
| 15 | * size, and the current `ETag` that write operations ({@link PutKey}, |
| 16 | * {@link DeleteKey}, {@link UpdateKeys}) require as `IfMatch`. Provide the |
| 17 | * implementation with `Effect.provide(AWS.CloudFront.DescribeKeyValueStoreHttp)`. |
| 18 | * ### Reading KeyValueStore Data |
| 19 | * **Example:** Fetch the Store's ETag Before a Write |
| 20 | * ```typescript |
| 21 | * // init — bind the operation to the store |
| 22 | * const describeStore = yield* CloudFront.DescribeKeyValueStore(store); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const meta = yield* describeStore({}); |
| 26 | * console.log(meta.ETag, meta.ItemCount); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface DescribeKeyValueStore extends Binding.Service< |
| 32 | DescribeKeyValueStore, |
| 33 | "AWS.CloudFront.DescribeKeyValueStore", |
| 34 | ( |
| 35 | store: KeyValueStore, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: DescribeKeyValueStoreRequest, |
| 39 | ) => Effect.Effect< |
| 40 | kvs.DescribeKeyValueStoreResponse, |
| 41 | kvs.DescribeKeyValueStoreError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const DescribeKeyValueStore = Binding.Service<DescribeKeyValueStore>( |
| 47 | "AWS.CloudFront.DescribeKeyValueStore", |
| 48 | ); |