| 1 | import type * as s3tables from "@distilled.cloud/aws/s3tables"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { TableBucket } from "./TableBucket.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `ListTables` request with `tableBucketARN` injected from the bound |
| 8 | * {@link TableBucket}. |
| 9 | */ |
| 10 | export interface ListTablesRequest extends Omit< |
| 11 | s3tables.ListTablesRequest, |
| 12 | "tableBucketARN" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `ListTables` operation (IAM action |
| 17 | * `s3tables:ListTables` on the table bucket ARN). |
| 18 | * |
| 19 | * Lists the tables in the bound {@link TableBucket}, optionally filtered to |
| 20 | * a namespace or name prefix. Useful for compute that enumerates the |
| 21 | * catalog at runtime. Provide the implementation with |
| 22 | * `Effect.provide(AWS.S3Tables.ListTablesHttp)`. |
| 23 | * ### Discovering Namespaces and Tables |
| 24 | * **Example:** List the tables in a namespace |
| 25 | * ```typescript |
| 26 | * const listTables = yield* AWS.S3Tables.ListTables(bucket); |
| 27 | * |
| 28 | * const { tables } = yield* listTables({ namespace: "events" }); |
| 29 | * for (const table of tables) { |
| 30 | * yield* Effect.log(`table: ${table.name}`); |
| 31 | * } |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface ListTables extends Binding.Service< |
| 37 | ListTables, |
| 38 | "AWS.S3Tables.ListTables", |
| 39 | ( |
| 40 | tableBucket: TableBucket, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request?: ListTablesRequest, |
| 44 | ) => Effect.Effect<s3tables.ListTablesResponse, s3tables.ListTablesError> |
| 45 | > |
| 46 | > {} |
| 47 | export const ListTables = Binding.Service<ListTables>( |
| 48 | "AWS.S3Tables.ListTables", |
| 49 | ); |