| 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 `FailoverShard` operation (IAM action |
| 8 | * `memorydb:FailoverShard`), scoped to one {@link Cluster}. |
| 9 | * |
| 10 | * Fails over a shard's primary node to a replica — designed for testing how |
| 11 | * your application behaves during a MemoryDB failover (chaos testing), not |
| 12 | * as a production remediation tool. Provide the implementation with |
| 13 | * `Effect.provide(AWS.MemoryDB.FailoverShardHttp)`. |
| 14 | * ### Testing Failover |
| 15 | * **Example:** Fail Over a Shard |
| 16 | * ```typescript |
| 17 | * const failoverShard = yield* MemoryDB.FailoverShard(cluster); |
| 18 | * |
| 19 | * const result = yield* failoverShard({ ShardName: "0001" }); |
| 20 | * // result.Cluster.Status → "updating" |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | */ |
| 25 | export interface FailoverShard extends Binding.Service< |
| 26 | FailoverShard, |
| 27 | "AWS.MemoryDB.FailoverShard", |
| 28 | ( |
| 29 | cluster: Cluster, |
| 30 | ) => Effect.Effect< |
| 31 | ( |
| 32 | request: Omit<memorydb.FailoverShardRequest, "ClusterName">, |
| 33 | ) => Effect.Effect< |
| 34 | memorydb.FailoverShardResponse, |
| 35 | memorydb.FailoverShardError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | export const FailoverShard = Binding.Service<FailoverShard>( |
| 40 | "AWS.MemoryDB.FailoverShard", |
| 41 | ); |