sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ S3Tables/ GetTableMaintenanceJobStatus.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 `GetTableMaintenanceJobStatus` operation (IAM
 * action `s3tables:GetTableMaintenanceJobStatus` on the table ARN).
 *
 * Reads the status of the bound {@link Table}'s managed maintenance jobs —
 * Iceberg compaction and snapshot management — including when each job last
 * ran and whether it succeeded. Useful for compute that monitors table
 * health at runtime. Provide the implementation with
 * `Effect.provide(AWS.S3Tables.GetTableMaintenanceJobStatusHttp)`.
 * ### Monitoring Maintenance
 * **Example:** Inspect maintenance job statuses
 * ```typescript
 * const getTableMaintenanceJobStatus =
 *   yield* AWS.S3Tables.GetTableMaintenanceJobStatus(table);
 *
 * const { status } = yield* getTableMaintenanceJobStatus();
 * for (const [job, state] of Object.entries(status)) {
 *   yield* Effect.log(`${job}: ${state?.status}`);
 * }
 * ```
 *
 * @binding
 */
export interface GetTableMaintenanceJobStatus extends Binding.Service<
  GetTableMaintenanceJobStatus,
  "AWS.S3Tables.GetTableMaintenanceJobStatus",
  (
    table: Table,
  ) => Effect.Effect<
    () => Effect.Effect<
      s3tables.GetTableMaintenanceJobStatusResponse,
      s3tables.GetTableMaintenanceJobStatusError
    >
  >
> {}
export const GetTableMaintenanceJobStatus = Binding.Service<GetTableMaintenanceJobStatus>(
  "AWS.S3Tables.GetTableMaintenanceJobStatus",
);