| 1 | import type * as kms from "@distilled.cloud/aws/kms"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { AliasName } from "./Alias.ts"; |
| 5 | import type { Key } from "./Key.ts"; |
| 6 | |
| 7 | export interface DescribeKeyRequest extends Omit< |
| 8 | kms.DescribeKeyRequest, |
| 9 | "KeyId" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `kms:DescribeKey`. |
| 14 | * |
| 15 | * Bind this operation to a KMS {@link Key} (or the `alias/...` name of a |
| 16 | * pre-existing key) to get a callable that automatically injects the |
| 17 | * `KeyId`. Useful at runtime to discover a key's state, spec, and supported |
| 18 | * algorithms before choosing a cryptographic operation. |
| 19 | * |
| 20 | * ### Key Metadata |
| 21 | * **Example:** Inspect the Bound Key |
| 22 | * ```typescript |
| 23 | * const describeKey = yield* AWS.KMS.DescribeKey(key); |
| 24 | * |
| 25 | * const { KeyMetadata } = yield* describeKey(); |
| 26 | * // KeyMetadata.KeyState, KeyMetadata.KeySpec, ... |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface DescribeKey extends Binding.Service< |
| 32 | DescribeKey, |
| 33 | "AWS.KMS.DescribeKey", |
| 34 | ( |
| 35 | key: Key | AliasName, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request?: DescribeKeyRequest, |
| 39 | ) => Effect.Effect<kms.DescribeKeyResponse, kms.DescribeKeyError> |
| 40 | > |
| 41 | > {} |
| 42 | |
| 43 | export const DescribeKey = Binding.Service<DescribeKey>("AWS.KMS.DescribeKey"); |