sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Glue/ GetTables.ts

import type * as glue from "@distilled.cloud/aws/glue";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Database } from "./Database.ts";

export interface GetTablesRequest extends Omit<
  glue.GetTablesRequest,
  "DatabaseName" | "CatalogId"
> {}

/**
 * Runtime binding for `glue:GetTables`.
 *
 * Lists the table definitions of the bound {@link Database} (optionally
 * filtered by an `Expression` pattern, paginated via `NextToken`) — runtime
 * schema discovery over the Data Catalog. The database name and catalog id
 * are injected from the binding. Provide the implementation with
 * `Effect.provide(AWS.Glue.GetTablesHttp)`.
 * ### Reading the Data Catalog
 * **Example:** Enumerate a Database's Tables
 * ```typescript
 * // init
 * const getTables = yield* AWS.Glue.GetTables(database);
 *
 * // runtime
 * const { TableList } = yield* getTables({ Expression: "events_*" });
 * const names = (TableList ?? []).map((t) => t.Name);
 * ```
 *
 * @binding
 */
export interface GetTables extends Binding.Service<
  GetTables,
  "AWS.Glue.GetTables",
  (
    database: Database,
  ) => Effect.Effect<
    (request?: GetTablesRequest) => Effect.Effect<glue.GetTablesResponse, glue.GetTablesError>
  >
> {}

export const GetTables = Binding.Service<GetTables>("AWS.Glue.GetTables");