| 1 | import * as DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export interface DescribeTableRequest extends Omit< |
| 7 | DynamoDB.DescribeTableInput, |
| 8 | "TableName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `dynamodb:DescribeTable`. |
| 13 | * |
| 14 | * Bind this operation to a `Table` inside a function runtime to get a callable |
| 15 | * that reads the table's metadata (key schema, indexes, status, throughput). |
| 16 | * Provide the `DescribeTableHttp` layer on the Function to satisfy the binding. |
| 17 | * ### Table Metadata |
| 18 | * **Example:** Describe the Bound Table |
| 19 | * ```typescript |
| 20 | * const describeTable = yield* AWS.DynamoDB.DescribeTable(table); |
| 21 | * |
| 22 | * const response = yield* describeTable(); |
| 23 | * const status = response.Table?.TableStatus; |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface DescribeTable extends Binding.Service< |
| 29 | DescribeTable, |
| 30 | "AWS.DynamoDB.DescribeTable", |
| 31 | <T extends Table>( |
| 32 | table: T, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request?: DescribeTableRequest, |
| 36 | ) => Effect.Effect< |
| 37 | DynamoDB.DescribeTableOutput, |
| 38 | DynamoDB.DescribeTableError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | |
| 43 | export const DescribeTable = Binding.Service<DescribeTable>( |
| 44 | "AWS.DynamoDB.DescribeTable", |
| 45 | ); |