sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ DynamoDB/ CreateBackup.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 CreateBackupRequest extends Omit<DynamoDB.CreateBackupInput, "TableName"> {}

/**
 * Runtime binding for `dynamodb:CreateBackup`.
 *
 * Bind this operation to a `Table` inside a function runtime to get a callable
 * that creates an on-demand backup of the bound table, automatically injecting
 * the table name. Provide the `CreateBackupHttp` layer on the Function to
 * satisfy the binding.
 * ### Backup and Restore
 * **Example:** Create an On-Demand Backup
 * ```typescript
 * const createBackup = yield* AWS.DynamoDB.CreateBackup(table);
 *
 * const response = yield* createBackup({ BackupName: "nightly" });
 * const backupArn = response.BackupDetails?.BackupArn;
 * ```
 *
 * @binding
 */
export interface CreateBackup extends Binding.Service<
  CreateBackup,
  "AWS.DynamoDB.CreateBackup",
  <T extends Table>(
    table: T,
  ) => Effect.Effect<
    (
      request: CreateBackupRequest,
    ) => Effect.Effect<DynamoDB.CreateBackupOutput, DynamoDB.CreateBackupError>
  >
> {}
export const CreateBackup = Binding.Service<CreateBackup>("AWS.DynamoDB.CreateBackup");