| 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 | * `ListNamespaces` request with `tableBucketARN` injected from the bound |
| 8 | * {@link TableBucket}. |
| 9 | */ |
| 10 | export interface ListNamespacesRequest extends Omit< |
| 11 | s3tables.ListNamespacesRequest, |
| 12 | "tableBucketARN" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `ListNamespaces` operation (IAM action |
| 17 | * `s3tables:ListNamespaces` on the table bucket ARN). |
| 18 | * |
| 19 | * Lists the namespaces in the bound {@link TableBucket} — the catalog's |
| 20 | * databases. Useful for compute that discovers tables dynamically at |
| 21 | * runtime. Provide the implementation with |
| 22 | * `Effect.provide(AWS.S3Tables.ListNamespacesHttp)`. |
| 23 | * ### Discovering Namespaces and Tables |
| 24 | * **Example:** List the bucket's namespaces |
| 25 | * ```typescript |
| 26 | * const listNamespaces = yield* AWS.S3Tables.ListNamespaces(bucket); |
| 27 | * |
| 28 | * const { namespaces } = yield* listNamespaces(); |
| 29 | * for (const ns of namespaces) { |
| 30 | * yield* Effect.log(`namespace: ${ns.namespace[0]}`); |
| 31 | * } |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface ListNamespaces extends Binding.Service< |
| 37 | ListNamespaces, |
| 38 | "AWS.S3Tables.ListNamespaces", |
| 39 | ( |
| 40 | tableBucket: TableBucket, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request?: ListNamespacesRequest, |
| 44 | ) => Effect.Effect< |
| 45 | s3tables.ListNamespacesResponse, |
| 46 | s3tables.ListNamespacesError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const ListNamespaces = Binding.Service<ListNamespaces>( |
| 51 | "AWS.S3Tables.ListNamespaces", |
| 52 | ); |