sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Glue/ GetPartitions.ts

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

export interface GetPartitionsRequest extends Omit<
  glue.GetPartitionsRequest,
  "DatabaseName" | "TableName" | "CatalogId"
> {}

/**
 * Runtime binding for `glue:GetPartitions`.
 *
 * Lists the bound {@link Table}'s partitions, optionally filtered with a
 * partition-predicate `Expression` (e.g. `dt >= '2026-01-01'`) and paginated
 * via `NextToken`. The database/table names and catalog id are injected from
 * the binding. Provide the implementation with
 * `Effect.provide(AWS.Glue.GetPartitionsHttp)`.
 * ### Managing Partitions
 * **Example:** List Recent Partitions
 * ```typescript
 * // init
 * const getPartitions = yield* AWS.Glue.GetPartitions(table);
 *
 * // runtime
 * const { Partitions } = yield* getPartitions({
 *   Expression: "dt >= '2026-01-01'",
 * });
 * ```
 *
 * @binding
 */
export interface GetPartitions extends Binding.Service<
  GetPartitions,
  "AWS.Glue.GetPartitions",
  (
    table: Table,
  ) => Effect.Effect<
    (
      request?: GetPartitionsRequest,
    ) => Effect.Effect<glue.GetPartitionsResponse, glue.GetPartitionsError>
  >
> {}

export const GetPartitions = Binding.Service<GetPartitions>("AWS.Glue.GetPartitions");