| 1 | import type * as glue from "@distilled.cloud/aws/glue"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Database } from "./Database.ts"; |
| 5 | |
| 6 | export interface GetTablesRequest extends Omit< |
| 7 | glue.GetTablesRequest, |
| 8 | "DatabaseName" | "CatalogId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `glue:GetTables`. |
| 13 | * |
| 14 | * Lists the table definitions of the bound {@link Database} (optionally |
| 15 | * filtered by an `Expression` pattern, paginated via `NextToken`) — runtime |
| 16 | * schema discovery over the Data Catalog. The database name and catalog id |
| 17 | * are injected from the binding. Provide the implementation with |
| 18 | * `Effect.provide(AWS.Glue.GetTablesHttp)`. |
| 19 | * ### Reading the Data Catalog |
| 20 | * **Example:** Enumerate a Database's Tables |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const getTables = yield* AWS.Glue.GetTables(database); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const { TableList } = yield* getTables({ Expression: "events_*" }); |
| 27 | * const names = (TableList ?? []).map((t) => t.Name); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetTables extends Binding.Service< |
| 33 | GetTables, |
| 34 | "AWS.Glue.GetTables", |
| 35 | ( |
| 36 | database: Database, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: GetTablesRequest, |
| 40 | ) => Effect.Effect<glue.GetTablesResponse, glue.GetTablesError> |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const GetTables = Binding.Service<GetTables>("AWS.Glue.GetTables"); |