sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ DynamoDB/ DescribeExport.ts

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

export interface DescribeExportRequest extends DynamoDB.DescribeExportInput {}

/**
 * Runtime binding for `dynamodb:DescribeExport`.
 *
 * Bind this operation to a `Table` inside a function runtime to get a callable
 * that reads the status of one of the bound table's S3 exports by ARN. The
 * IAM grant covers every export of the bound table (`{tableArn}/export/*`).
 * Provide the `DescribeExportHttp` layer on the Function to satisfy the
 * binding.
 * ### Exporting to S3
 * **Example:** Poll an Export Until It Completes
 * ```typescript
 * const describeExport = yield* AWS.DynamoDB.DescribeExport(table);
 *
 * const response = yield* describeExport({ ExportArn: exportArn });
 * const status = response.ExportDescription?.ExportStatus;
 * ```
 *
 * @binding
 */
export interface DescribeExport extends Binding.Service<
  DescribeExport,
  "AWS.DynamoDB.DescribeExport",
  <T extends Table>(
    table: T,
  ) => Effect.Effect<
    (
      request: DescribeExportRequest,
    ) => Effect.Effect<DynamoDB.DescribeExportOutput, DynamoDB.DescribeExportError>
  >
> {}
export const DescribeExport = Binding.Service<DescribeExport>("AWS.DynamoDB.DescribeExport");