1import type * as docdb from "@distilled.cloud/aws/docdb";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { DBCluster } from "./DBCluster.ts";
5
6/**
7 * Runtime binding for the `CreateDBClusterSnapshot` operation (IAM action
8 * `rds:CreateDBClusterSnapshot`).
9 *
10 * Takes an on-demand snapshot of the bound {@link DBCluster} — e.g. a backup
11 * function that snapshots before a risky migration. The cluster identifier
12 * is injected from the binding; the grant covers both the cluster ARN and
13 * the account's `cluster-snapshot` ARN space (both resources must be allowed
14 * for snapshot creation). Provide the implementation with
15 * `Effect.provide(AWS.DocDB.CreateDBClusterSnapshotHttp)`.
16 * ### Operating a Cluster
17 * **Example:** Snapshot Before a Migration
18 * ```typescript
19 * // init — bind the operation to the cluster
20 * const createDBClusterSnapshot =
21 * yield* AWS.DocDB.CreateDBClusterSnapshot(cluster);
22 *
23 * // runtime
24 * const { DBClusterSnapshot } = yield* createDBClusterSnapshot({
25 * DBClusterSnapshotIdentifier: `pre-migration-${runId}`,
26 * });
27 * ```
28 *
29 * @binding
30 */
31export interface CreateDBClusterSnapshot extends Binding.Service<
32 CreateDBClusterSnapshot,
33 "AWS.DocDB.CreateDBClusterSnapshot",
34 (
35 cluster: DBCluster,
36 ) => Effect.Effect<
37 (
38 request: Omit<
39 docdb.CreateDBClusterSnapshotMessage,
40 "DBClusterIdentifier"
41 >,
42 ) => Effect.Effect<
43 docdb.CreateDBClusterSnapshotResult,
44 docdb.CreateDBClusterSnapshotError
45 >
46 >
47> {}
48export const CreateDBClusterSnapshot = Binding.Service<CreateDBClusterSnapshot>(
49 "AWS.DocDB.CreateDBClusterSnapshot",
50);