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 `FailoverDBCluster` operation (IAM action
8 * `rds:FailoverDBCluster`).
9 *
10 * Forces a failover of the bound {@link DBCluster} — one of the replicas is
11 * promoted to primary — for resilience testing or to move the writer to a
12 * specific instance. The cluster identifier is injected from the binding.
13 * Provide the implementation with
14 * `Effect.provide(AWS.DocDB.FailoverDBClusterHttp)`.
15 * ### Operating a Cluster
16 * **Example:** Force a Failover
17 * ```typescript
18 * // init — bind the operation to the cluster
19 * const failoverDBCluster = yield* AWS.DocDB.FailoverDBCluster(cluster);
20 *
21 * // runtime — promote a specific replica
22 * yield* failoverDBCluster({
23 * TargetDBInstanceIdentifier: replicaId,
24 * });
25 * ```
26 *
27 * @binding
28 */
29export interface FailoverDBCluster extends Binding.Service<
30 FailoverDBCluster,
31 "AWS.DocDB.FailoverDBCluster",
32 (
33 cluster: DBCluster,
34 ) => Effect.Effect<
35 (
36 request?: Omit<docdb.FailoverDBClusterMessage, "DBClusterIdentifier">,
37 ) => Effect.Effect<
38 docdb.FailoverDBClusterResult,
39 docdb.FailoverDBClusterError
40 >
41 >
42> {}
43export const FailoverDBCluster = Binding.Service<FailoverDBCluster>(
44 "AWS.DocDB.FailoverDBCluster",
45);