1import type * as glue from "@distilled.cloud/aws/glue";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Table } from "./Table.ts";
5
6export interface CreatePartitionRequest extends Omit<
7 glue.CreatePartitionRequest,
8 "DatabaseName" | "TableName" | "CatalogId"
9> {}
10
11/**
12 * Runtime binding for `glue:CreatePartition`.
13 *
14 * Registers a new partition on the bound {@link Table} — the write half of
15 * the classic "data landed in S3, register the partition so Athena sees it"
16 * pipeline. Fails with the typed `AlreadyExistsException` if the partition
17 * is already registered. The database/table names and catalog id are
18 * injected from the binding. Provide the implementation with
19 * `Effect.provide(AWS.Glue.CreatePartitionHttp)`.
20 * ### Managing Partitions
21 * **Example:** Register a New Partition
22 * ```typescript
23 * // init
24 * const createPartition = yield* AWS.Glue.CreatePartition(table);
25 *
26 * // runtime — idempotent registration
27 * yield* createPartition({
28 * PartitionInput: {
29 * Values: ["2026-01-01"],
30 * StorageDescriptor: { Location: "s3://my-data-lake/events/dt=2026-01-01/" },
31 * },
32 * }).pipe(Effect.catchTag("AlreadyExistsException", () => Effect.void));
33 * ```
34 *
35 * @binding
36 */
37export interface CreatePartition extends Binding.Service<
38 CreatePartition,
39 "AWS.Glue.CreatePartition",
40 (
41 table: Table,
42 ) => Effect.Effect<
43 (
44 request: CreatePartitionRequest,
45 ) => Effect.Effect<glue.CreatePartitionResponse, glue.CreatePartitionError>
46 >
47> {}
48
49export const CreatePartition = Binding.Service<CreatePartition>(
50 "AWS.Glue.CreatePartition",
51);