1import type * as kvs from "@distilled.cloud/aws/cloudfront-keyvaluestore";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { KeyValueStore } from "./KeyValueStore.ts";
5
6export interface GetKeyRequest extends Omit<kvs.GetKeyRequest, "KvsARN"> {}
7
8/**
9 * Runtime binding for `cloudfront-keyvaluestore:GetKey`.
10 *
11 * Reads a single key's value from the bound KeyValueStore's data plane.
12 * Values are sensitive — distilled decodes them as `Redacted<string>`;
13 * unwrap with `Redacted.value`. Provide the implementation with
14 * `Effect.provide(AWS.CloudFront.GetKeyHttp)`.
15 * ### Reading KeyValueStore Data
16 * **Example:** Read a Key
17 * ```typescript
18 * // init — bind the operation to the store
19 * const getKey = yield* CloudFront.GetKey(store);
20 *
21 * // runtime
22 * const res = yield* getKey({ Key: "routes:/about" });
23 * const value = typeof res.Value === "string" ? res.Value : Redacted.value(res.Value);
24 * ```
25 *
26 * @binding
27 */
28export interface GetKey extends Binding.Service<
29 GetKey,
30 "AWS.CloudFront.GetKey",
31 (
32 store: KeyValueStore,
33 ) => Effect.Effect<
34 (
35 request: GetKeyRequest,
36 ) => Effect.Effect<kvs.GetKeyResponse, kvs.GetKeyError>
37 >
38> {}
39
40export const GetKey = Binding.Service<GetKey>("AWS.CloudFront.GetKey");