| 1 | import type * as mq from "@distilled.cloud/aws/mq"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Broker } from "./Broker.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `Promote` operation (IAM action `mq:Promote`), |
| 8 | * scoped to one {@link Broker}. |
| 9 | * |
| 10 | * Promotes a cross-region data replication (CRDR) replica broker to the |
| 11 | * primary role — `SWITCHOVER` performs a coordinated role exchange with the |
| 12 | * current primary, `FAILOVER` promotes the replica unilaterally when the |
| 13 | * primary is unreachable. Only meaningful for brokers created with |
| 14 | * `dataReplicationMode: "CRDR"`. Provide the implementation with |
| 15 | * `Effect.provide(AWS.MQ.PromoteHttp)`. |
| 16 | * ### Disaster Recovery |
| 17 | * **Example:** Fail Over to the Replica |
| 18 | * ```typescript |
| 19 | * const promote = yield* MQ.Promote(replica); |
| 20 | * |
| 21 | * yield* promote({ Mode: "FAILOVER" }); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface Promote extends Binding.Service< |
| 27 | Promote, |
| 28 | "AWS.MQ.Promote", |
| 29 | ( |
| 30 | broker: Broker, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request: Omit<mq.PromoteRequest, "BrokerId">, |
| 34 | ) => Effect.Effect<mq.PromoteResponse, mq.PromoteError> |
| 35 | > |
| 36 | > {} |
| 37 | export const Promote = Binding.Service<Promote>("AWS.MQ.Promote"); |