| 1 | import type * as fsx from "@distilled.cloud/aws/fsx"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { FileSystem } from "./FileSystem.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `CreateBackup` operation scoped to one file system |
| 8 | * (IAM actions `fsx:CreateBackup` and `fsx:TagResource` on the file system |
| 9 | * ARN and on `arn:aws:fsx:*:*:backup/*` — the new backup's ARN is unknowable |
| 10 | * at deploy time). |
| 11 | * |
| 12 | * Takes a user-initiated backup of the bound {@link FileSystem} — e.g. |
| 13 | * before a risky data migration, or on an application-defined cadence |
| 14 | * richer than the daily automatic backup. Pass a `ClientRequestToken` to |
| 15 | * make the call idempotent. A backup already in progress surfaces the typed |
| 16 | * `BackupInProgress`. Provide the implementation with |
| 17 | * `Effect.provide(AWS.FSx.CreateBackupHttp)`. |
| 18 | * ### Managing Backups at Runtime |
| 19 | * **Example:** Take a pre-migration backup |
| 20 | * ```typescript |
| 21 | * const createBackup = yield* AWS.FSx.CreateBackup(files); |
| 22 | * |
| 23 | * const response = yield* createBackup({ |
| 24 | * ClientRequestToken: `migration-${migrationId}`, |
| 25 | * Tags: [{ Key: "reason", Value: "pre-migration" }], |
| 26 | * }); |
| 27 | * yield* Effect.log(`backup ${response.Backup?.BackupId} started`); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface CreateBackup extends Binding.Service< |
| 33 | CreateBackup, |
| 34 | "AWS.FSx.CreateBackup", |
| 35 | ( |
| 36 | fileSystem: FileSystem, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: Omit<fsx.CreateBackupRequest, "FileSystemId">, |
| 40 | ) => Effect.Effect<fsx.CreateBackupResponse, fsx.CreateBackupError> |
| 41 | > |
| 42 | > {} |
| 43 | export const CreateBackup = Binding.Service<CreateBackup>( |
| 44 | "AWS.FSx.CreateBackup", |
| 45 | ); |