1import type * as s3tables from "@distilled.cloud/aws/s3tables";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Table } from "./Table.ts";
5
6/**
7 * Runtime binding for the `GetTableMetadataLocation` operation (IAM action
8 * `s3tables:GetTableMetadataLocation` on the table ARN).
9 *
10 * Reads the bound {@link Table}'s current metadata location and version
11 * token — the read half of the Iceberg commit protocol: read the current
12 * metadata, write a new metadata file to the warehouse, then commit it with
13 * {@link UpdateTableMetadataLocation}. Provide the implementation with
14 * `Effect.provide(AWS.S3Tables.GetTableMetadataLocationHttp)`.
15 * ### The Iceberg Commit Protocol
16 * **Example:** Read the current metadata location
17 * ```typescript
18 * const getTableMetadataLocation =
19 * yield* AWS.S3Tables.GetTableMetadataLocation(table);
20 *
21 * const { versionToken, metadataLocation, warehouseLocation } =
22 * yield* getTableMetadataLocation();
23 * ```
24 *
25 * @binding
26 */
27export interface GetTableMetadataLocation extends Binding.Service<
28 GetTableMetadataLocation,
29 "AWS.S3Tables.GetTableMetadataLocation",
30 (
31 table: Table,
32 ) => Effect.Effect<
33 () => Effect.Effect<
34 s3tables.GetTableMetadataLocationResponse,
35 s3tables.GetTableMetadataLocationError
36 >
37 >
38> {}
39export const GetTableMetadataLocation =
40 Binding.Service<GetTableMetadataLocation>(
41 "AWS.S3Tables.GetTableMetadataLocation",
42 );