| 1 | import type * as memorydb from "@distilled.cloud/aws/memorydb"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Cluster } from "./Cluster.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `CreateSnapshot` operation (IAM actions |
| 8 | * `memorydb:CreateSnapshot` + `memorydb:TagResource`), scoped to one |
| 9 | * {@link Cluster}. |
| 10 | * |
| 11 | * Takes an on-demand snapshot of the bound cluster — e.g. a pre-migration |
| 12 | * backup from an operational Lambda. Provide the implementation with |
| 13 | * `Effect.provide(AWS.MemoryDB.CreateSnapshotHttp)`. |
| 14 | * ### Managing Snapshots |
| 15 | * **Example:** Take an On-Demand Snapshot |
| 16 | * ```typescript |
| 17 | * const createSnapshot = yield* MemoryDB.CreateSnapshot(cluster); |
| 18 | * |
| 19 | * const result = yield* createSnapshot({ SnapshotName: "pre-migration" }); |
| 20 | * // result.Snapshot.Status → "creating" |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | */ |
| 25 | export interface CreateSnapshot extends Binding.Service< |
| 26 | CreateSnapshot, |
| 27 | "AWS.MemoryDB.CreateSnapshot", |
| 28 | ( |
| 29 | cluster: Cluster, |
| 30 | ) => Effect.Effect< |
| 31 | ( |
| 32 | request: Omit<memorydb.CreateSnapshotRequest, "ClusterName">, |
| 33 | ) => Effect.Effect< |
| 34 | memorydb.CreateSnapshotResponse, |
| 35 | memorydb.CreateSnapshotError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | export const CreateSnapshot = Binding.Service<CreateSnapshot>( |
| 40 | "AWS.MemoryDB.CreateSnapshot", |
| 41 | ); |