sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ S3Tables/ GetTable.ts

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

/**
 * Runtime binding for the `GetTable` operation (IAM action
 * `s3tables:GetTable` on the table ARN).
 *
 * Reads the bound {@link Table}'s details — its current `versionToken`,
 * `metadataLocation`, `warehouseLocation`, and format. The version token and
 * metadata location are the inputs to the Iceberg commit protocol (see
 * {@link UpdateTableMetadataLocation}). Provide the implementation with
 * `Effect.provide(AWS.S3Tables.GetTableHttp)`.
 * ### Reading Table Metadata
 * **Example:** Read the table's current version
 * ```typescript
 * const getTable = yield* AWS.S3Tables.GetTable(table);
 *
 * const { versionToken, metadataLocation, warehouseLocation } =
 *   yield* getTable();
 * ```
 *
 * @binding
 */
export interface GetTable extends Binding.Service<
  GetTable,
  "AWS.S3Tables.GetTable",
  (
    table: Table,
  ) => Effect.Effect<() => Effect.Effect<s3tables.GetTableResponse, s3tables.GetTableError>>
> {}
export const GetTable = Binding.Service<GetTable>("AWS.S3Tables.GetTable");