sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ QuickSight/ DescribeIngestion.ts

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

/**
 * Runtime binding for `quicksight:DescribeIngestion`.
 *
 * Reads the status, row counts, and error info of a SPICE ingestion on the
 * bound {@link DataSet}. `AwsAccountId` and `DataSetId` are injected from
 * the binding. Provide the implementation with
 * `Effect.provide(AWS.QuickSight.DescribeIngestionHttp)`.
 * ### Refreshing SPICE Data
 * **Example:** Poll An Ingestion Until It Settles
 * ```typescript
 * // init — bind the operation to the dataset
 * const describeIngestion = yield* AWS.QuickSight.DescribeIngestion(dataSet);
 *
 * // runtime
 * const { Ingestion } = yield* describeIngestion({
 *   IngestionId: ingestionId,
 * }).pipe(
 *   Effect.repeat({
 *     schedule: Schedule.spaced("5 seconds"),
 *     until: (r) =>
 *       r.Ingestion?.IngestionStatus === "COMPLETED" ||
 *       r.Ingestion?.IngestionStatus === "FAILED",
 *     times: 24,
 *   }),
 * );
 * ```
 *
 * @binding
 */
export interface DescribeIngestion extends Binding.Service<
  DescribeIngestion,
  "AWS.QuickSight.DescribeIngestion",
  (
    dataSet: DataSet,
  ) => Effect.Effect<
    (
      request: Omit<quicksight.DescribeIngestionRequest, "AwsAccountId" | "DataSetId">,
    ) => Effect.Effect<quicksight.DescribeIngestionResponse, quicksight.DescribeIngestionError>
  >
> {}
export const DescribeIngestion = Binding.Service<DescribeIngestion>(
  "AWS.QuickSight.DescribeIngestion",
);