1import type * as athena from "@distilled.cloud/aws/athena";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { DataCatalog } from "./DataCatalog.ts";
5
6/**
7 * Runtime binding for `athena:GetTableMetadata`.
8 *
9 * Reads a single table's metadata (columns, partition keys, table type) from
10 * the bound data catalog — the catalog name is injected automatically.
11 * Provide the implementation with
12 * `Effect.provide(AWS.Athena.GetTableMetadataHttp)`.
13 * ### Browsing Catalog Metadata
14 * **Example:** Read a Table's Columns
15 * ```typescript
16 * // init — bind the operation to the data catalog
17 * const getTableMetadata = yield* AWS.Athena.GetTableMetadata(catalog);
18 *
19 * // runtime
20 * const res = yield* getTableMetadata({
21 * DatabaseName: "analytics",
22 * TableName: "orders",
23 * });
24 * console.log(res.TableMetadata?.Columns?.map((c) => c.Name));
25 * ```
26 *
27 * @binding
28 */
29export interface GetTableMetadata extends Binding.Service<
30 GetTableMetadata,
31 "AWS.Athena.GetTableMetadata",
32 (
33 catalog: DataCatalog,
34 ) => Effect.Effect<
35 (
36 request: Omit<athena.GetTableMetadataInput, "CatalogName">,
37 ) => Effect.Effect<
38 athena.GetTableMetadataOutput,
39 athena.GetTableMetadataError
40 >
41 >
42> {}
43
44export const GetTableMetadata = Binding.Service<GetTableMetadata>(
45 "AWS.Athena.GetTableMetadata",
46);