sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ DMS/ DescribeTableStatistics.ts

import type * as dms from "@distilled.cloud/aws/database-migration-service";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Runtime binding for `dms:DescribeTableStatistics`.
 *
 * Bind this operation (account-level) to read per-table migration progress
 * for a replication task — rows inserted/updated/deleted, full-load
 * completion, validation state. The data behind migration progress
 * dashboards and cut-over gates. Provide the implementation with
 * `Effect.provide(AWS.DMS.DescribeTableStatisticsHttp)`.
 * ### Monitoring Migration Progress
 * **Example:** Gate a Cut-Over on Full-Load Completion
 * ```typescript
 * // init — account-level, no target resource
 * const describeTableStatistics = yield* AWS.DMS.DescribeTableStatistics();
 *
 * // runtime
 * const { TableStatistics } = yield* describeTableStatistics({
 *   ReplicationTaskArn: taskArn,
 * });
 * const pending = TableStatistics?.filter(
 *   (table) => table.FullLoadEndTime === undefined,
 * );
 * ```
 *
 * @binding
 */
export interface DescribeTableStatistics extends Binding.Service<
  DescribeTableStatistics,
  "AWS.DMS.DescribeTableStatistics",
  () => Effect.Effect<
    (
      request: dms.DescribeTableStatisticsMessage,
    ) => Effect.Effect<dms.DescribeTableStatisticsResponse, dms.DescribeTableStatisticsError>
  >
> {}

export const DescribeTableStatistics = Binding.Service<DescribeTableStatistics>(
  "AWS.DMS.DescribeTableStatistics",
);