| 1 | import type * as DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export interface CreateBackupRequest extends Omit< |
| 7 | DynamoDB.CreateBackupInput, |
| 8 | "TableName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `dynamodb:CreateBackup`. |
| 13 | * |
| 14 | * Bind this operation to a `Table` inside a function runtime to get a callable |
| 15 | * that creates an on-demand backup of the bound table, automatically injecting |
| 16 | * the table name. Provide the `CreateBackupHttp` layer on the Function to |
| 17 | * satisfy the binding. |
| 18 | * ### Backup and Restore |
| 19 | * **Example:** Create an On-Demand Backup |
| 20 | * ```typescript |
| 21 | * const createBackup = yield* AWS.DynamoDB.CreateBackup(table); |
| 22 | * |
| 23 | * const response = yield* createBackup({ BackupName: "nightly" }); |
| 24 | * const backupArn = response.BackupDetails?.BackupArn; |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface CreateBackup extends Binding.Service< |
| 30 | CreateBackup, |
| 31 | "AWS.DynamoDB.CreateBackup", |
| 32 | <T extends Table>( |
| 33 | table: T, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request: CreateBackupRequest, |
| 37 | ) => Effect.Effect<DynamoDB.CreateBackupOutput, DynamoDB.CreateBackupError> |
| 38 | > |
| 39 | > {} |
| 40 | export const CreateBackup = Binding.Service<CreateBackup>( |
| 41 | "AWS.DynamoDB.CreateBackup", |
| 42 | ); |