| 1 | import type * as glue from "@distilled.cloud/aws/glue"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export interface GetPartitionsRequest extends Omit< |
| 7 | glue.GetPartitionsRequest, |
| 8 | "DatabaseName" | "TableName" | "CatalogId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `glue:GetPartitions`. |
| 13 | * |
| 14 | * Lists the bound {@link Table}'s partitions, optionally filtered with a |
| 15 | * partition-predicate `Expression` (e.g. `dt >= '2026-01-01'`) and paginated |
| 16 | * via `NextToken`. The database/table names and catalog id are injected from |
| 17 | * the binding. Provide the implementation with |
| 18 | * `Effect.provide(AWS.Glue.GetPartitionsHttp)`. |
| 19 | * ### Managing Partitions |
| 20 | * **Example:** List Recent Partitions |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const getPartitions = yield* AWS.Glue.GetPartitions(table); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const { Partitions } = yield* getPartitions({ |
| 27 | * Expression: "dt >= '2026-01-01'", |
| 28 | * }); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface GetPartitions extends Binding.Service< |
| 34 | GetPartitions, |
| 35 | "AWS.Glue.GetPartitions", |
| 36 | ( |
| 37 | table: Table, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: GetPartitionsRequest, |
| 41 | ) => Effect.Effect<glue.GetPartitionsResponse, glue.GetPartitionsError> |
| 42 | > |
| 43 | > {} |
| 44 | |
| 45 | export const GetPartitions = Binding.Service<GetPartitions>( |
| 46 | "AWS.Glue.GetPartitions", |
| 47 | ); |