1import type * as dax from "@distilled.cloud/aws/dax";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Cluster } from "./Cluster.ts";
5
6/**
7 * Runtime binding for the `DecreaseReplicationFactor` operation (IAM action
8 * `dax:DecreaseReplicationFactor`), scoped to one {@link Cluster}.
9 *
10 * Removes read-replica nodes from the bound DAX cluster — the scale-in half
11 * of node-count automation (e.g. shrinking a cluster off-peak to cut
12 * node-hour cost). Provide the implementation with
13 * `Effect.provide(AWS.DAX.DecreaseReplicationFactorHttp)`.
14 * ### Scaling a Cluster
15 * **Example:** Scale In to One Node
16 * ```typescript
17 * const decreaseReplicationFactor =
18 * yield* DAX.DecreaseReplicationFactor(cluster);
19 *
20 * const result = yield* decreaseReplicationFactor({
21 * NewReplicationFactor: 1,
22 * });
23 * // result.Cluster?.TotalNodes → 1 once the removal completes
24 * ```
25 *
26 * @binding
27 */
28export interface DecreaseReplicationFactor extends Binding.Service<
29 DecreaseReplicationFactor,
30 "AWS.DAX.DecreaseReplicationFactor",
31 (
32 cluster: Cluster,
33 ) => Effect.Effect<
34 (
35 request: Omit<dax.DecreaseReplicationFactorRequest, "ClusterName">,
36 ) => Effect.Effect<
37 dax.DecreaseReplicationFactorResponse,
38 dax.DecreaseReplicationFactorError
39 >
40 >
41> {}
42export const DecreaseReplicationFactor =
43 Binding.Service<DecreaseReplicationFactor>(
44 "AWS.DAX.DecreaseReplicationFactor",
45 );