Skip to content

Commit ab547b0

Browse files
author
awstools
committed
feat(client-neptune): This release adds Global Cluster Switchover capability which enables you to change your global cluster's primary AWS Region, the region that serves writes, while preserving the replication between all regions in the global cluster.
1 parent a5f2aef commit ab547b0

14 files changed

+696
-66
lines changed

clients/client-neptune/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,3 +772,11 @@ StopDBCluster
772772
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/neptune/command/StopDBClusterCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-neptune/Interface/StopDBClusterCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-neptune/Interface/StopDBClusterCommandOutput/)
773773

774774
</details>
775+
<details>
776+
<summary>
777+
SwitchoverGlobalCluster
778+
</summary>
779+
780+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/neptune/command/SwitchoverGlobalClusterCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-neptune/Interface/SwitchoverGlobalClusterCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-neptune/Interface/SwitchoverGlobalClusterCommandOutput/)
781+
782+
</details>

clients/client-neptune/src/Neptune.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ import {
347347
StopDBClusterCommandInput,
348348
StopDBClusterCommandOutput,
349349
} from "./commands/StopDBClusterCommand";
350+
import {
351+
SwitchoverGlobalClusterCommand,
352+
SwitchoverGlobalClusterCommandInput,
353+
SwitchoverGlobalClusterCommandOutput,
354+
} from "./commands/SwitchoverGlobalClusterCommand";
350355
import { NeptuneClient, NeptuneClientConfig } from "./NeptuneClient";
351356

352357
const commands = {
@@ -419,6 +424,7 @@ const commands = {
419424
RestoreDBClusterToPointInTimeCommand,
420425
StartDBClusterCommand,
421426
StopDBClusterCommand,
427+
SwitchoverGlobalClusterCommand,
422428
};
423429

424430
export interface Neptune {
@@ -1587,6 +1593,23 @@ export interface Neptune {
15871593
options: __HttpHandlerOptions,
15881594
cb: (err: any, data?: StopDBClusterCommandOutput) => void
15891595
): void;
1596+
1597+
/**
1598+
* @see {@link SwitchoverGlobalClusterCommand}
1599+
*/
1600+
switchoverGlobalCluster(
1601+
args: SwitchoverGlobalClusterCommandInput,
1602+
options?: __HttpHandlerOptions
1603+
): Promise<SwitchoverGlobalClusterCommandOutput>;
1604+
switchoverGlobalCluster(
1605+
args: SwitchoverGlobalClusterCommandInput,
1606+
cb: (err: any, data?: SwitchoverGlobalClusterCommandOutput) => void
1607+
): void;
1608+
switchoverGlobalCluster(
1609+
args: SwitchoverGlobalClusterCommandInput,
1610+
options: __HttpHandlerOptions,
1611+
cb: (err: any, data?: SwitchoverGlobalClusterCommandOutput) => void
1612+
): void;
15901613
}
15911614

15921615
/**

clients/client-neptune/src/NeptuneClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ import {
287287
} from "./commands/RestoreDBClusterToPointInTimeCommand";
288288
import { StartDBClusterCommandInput, StartDBClusterCommandOutput } from "./commands/StartDBClusterCommand";
289289
import { StopDBClusterCommandInput, StopDBClusterCommandOutput } from "./commands/StopDBClusterCommand";
290+
import {
291+
SwitchoverGlobalClusterCommandInput,
292+
SwitchoverGlobalClusterCommandOutput,
293+
} from "./commands/SwitchoverGlobalClusterCommand";
290294
import {
291295
ClientInputEndpointParameters,
292296
ClientResolvedEndpointParameters,
@@ -370,7 +374,8 @@ export type ServiceInputTypes =
370374
| RestoreDBClusterFromSnapshotCommandInput
371375
| RestoreDBClusterToPointInTimeCommandInput
372376
| StartDBClusterCommandInput
373-
| StopDBClusterCommandInput;
377+
| StopDBClusterCommandInput
378+
| SwitchoverGlobalClusterCommandInput;
374379

375380
/**
376381
* @public
@@ -444,7 +449,8 @@ export type ServiceOutputTypes =
444449
| RestoreDBClusterFromSnapshotCommandOutput
445450
| RestoreDBClusterToPointInTimeCommandOutput
446451
| StartDBClusterCommandOutput
447-
| StopDBClusterCommandOutput;
452+
| StopDBClusterCommandOutput
453+
| SwitchoverGlobalClusterCommandOutput;
448454

449455
/**
450456
* @public

clients/client-neptune/src/commands/CreateGlobalClusterCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ export interface CreateGlobalClusterCommandOutput extends CreateGlobalClusterRes
7272
* // IsWriter: true || false,
7373
* // },
7474
* // ],
75+
* // FailoverState: { // FailoverState
76+
* // Status: "pending" || "failing-over" || "cancelling",
77+
* // FromDbClusterArn: "STRING_VALUE",
78+
* // ToDbClusterArn: "STRING_VALUE",
79+
* // IsDataLossAllowed: true || false,
80+
* // },
7581
* // },
7682
* // };
7783
*

clients/client-neptune/src/commands/DeleteGlobalClusterCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export interface DeleteGlobalClusterCommandOutput extends DeleteGlobalClusterRes
6060
* // IsWriter: true || false,
6161
* // },
6262
* // ],
63+
* // FailoverState: { // FailoverState
64+
* // Status: "pending" || "failing-over" || "cancelling",
65+
* // FromDbClusterArn: "STRING_VALUE",
66+
* // ToDbClusterArn: "STRING_VALUE",
67+
* // IsDataLossAllowed: true || false,
68+
* // },
6369
* // },
6470
* // };
6571
*

clients/client-neptune/src/commands/DescribeGlobalClustersCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ export interface DescribeGlobalClustersCommandOutput extends GlobalClustersMessa
6464
* // IsWriter: true || false,
6565
* // },
6666
* // ],
67+
* // FailoverState: { // FailoverState
68+
* // Status: "pending" || "failing-over" || "cancelling",
69+
* // FromDbClusterArn: "STRING_VALUE",
70+
* // ToDbClusterArn: "STRING_VALUE",
71+
* // IsDataLossAllowed: true || false,
72+
* // },
6773
* // },
6874
* // ],
6975
* // };

clients/client-neptune/src/commands/FailoverGlobalClusterCommand.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export interface FailoverGlobalClusterCommandOutput extends FailoverGlobalCluste
5151
* const input = { // FailoverGlobalClusterMessage
5252
* GlobalClusterIdentifier: "STRING_VALUE", // required
5353
* TargetDbClusterIdentifier: "STRING_VALUE", // required
54+
* AllowDataLoss: true || false,
55+
* Switchover: true || false,
5456
* };
5557
* const command = new FailoverGlobalClusterCommand(input);
5658
* const response = await client.send(command);
@@ -73,6 +75,12 @@ export interface FailoverGlobalClusterCommandOutput extends FailoverGlobalCluste
7375
* // IsWriter: true || false,
7476
* // },
7577
* // ],
78+
* // FailoverState: { // FailoverState
79+
* // Status: "pending" || "failing-over" || "cancelling",
80+
* // FromDbClusterArn: "STRING_VALUE",
81+
* // ToDbClusterArn: "STRING_VALUE",
82+
* // IsDataLossAllowed: true || false,
83+
* // },
7684
* // },
7785
* // };
7886
*

clients/client-neptune/src/commands/ModifyGlobalClusterCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ export interface ModifyGlobalClusterCommandOutput extends ModifyGlobalClusterRes
6565
* // IsWriter: true || false,
6666
* // },
6767
* // ],
68+
* // FailoverState: { // FailoverState
69+
* // Status: "pending" || "failing-over" || "cancelling",
70+
* // FromDbClusterArn: "STRING_VALUE",
71+
* // ToDbClusterArn: "STRING_VALUE",
72+
* // IsDataLossAllowed: true || false,
73+
* // },
6874
* // },
6975
* // };
7076
*

clients/client-neptune/src/commands/RemoveFromGlobalClusterCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export interface RemoveFromGlobalClusterCommandOutput extends RemoveFromGlobalCl
6363
* // IsWriter: true || false,
6464
* // },
6565
* // ],
66+
* // FailoverState: { // FailoverState
67+
* // Status: "pending" || "failing-over" || "cancelling",
68+
* // FromDbClusterArn: "STRING_VALUE",
69+
* // ToDbClusterArn: "STRING_VALUE",
70+
* // IsDataLossAllowed: true || false,
71+
* // },
6672
* // },
6773
* // };
6874
*
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { SwitchoverGlobalClusterMessage, SwitchoverGlobalClusterResult } from "../models/models_0";
9+
import { NeptuneClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../NeptuneClient";
10+
import { de_SwitchoverGlobalClusterCommand, se_SwitchoverGlobalClusterCommand } from "../protocols/Aws_query";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link SwitchoverGlobalClusterCommand}.
21+
*/
22+
export interface SwitchoverGlobalClusterCommandInput extends SwitchoverGlobalClusterMessage {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link SwitchoverGlobalClusterCommand}.
27+
*/
28+
export interface SwitchoverGlobalClusterCommandOutput extends SwitchoverGlobalClusterResult, __MetadataBearer {}
29+
30+
/**
31+
* <p>Switches over the specified secondary DB cluster to be the new primary DB cluster in the global
32+
* database cluster. Switchover operations were previously called "managed planned failovers."</p>
33+
* <p>Promotes the specified secondary cluster to assume full read/write capabilities and demotes the current
34+
* primary cluster to a secondary (read-only) cluster, maintaining the original replication topology. All secondary
35+
* clusters are synchronized with the primary at the beginning of the process so the new primary continues operations
36+
* for the global database without losing any data. Your database is unavailable for a short time while the primary
37+
* and selected secondary clusters are assuming their new roles.</p>
38+
* <note>
39+
* <p>This operation is intended for controlled environments, for operations such as "regional rotation" or
40+
* to fall back to the original primary after a global database failover.</p>
41+
* </note>
42+
* @example
43+
* Use a bare-bones client and the command you need to make an API call.
44+
* ```javascript
45+
* import { NeptuneClient, SwitchoverGlobalClusterCommand } from "@aws-sdk/client-neptune"; // ES Modules import
46+
* // const { NeptuneClient, SwitchoverGlobalClusterCommand } = require("@aws-sdk/client-neptune"); // CommonJS import
47+
* const client = new NeptuneClient(config);
48+
* const input = { // SwitchoverGlobalClusterMessage
49+
* GlobalClusterIdentifier: "STRING_VALUE", // required
50+
* TargetDbClusterIdentifier: "STRING_VALUE", // required
51+
* };
52+
* const command = new SwitchoverGlobalClusterCommand(input);
53+
* const response = await client.send(command);
54+
* // { // SwitchoverGlobalClusterResult
55+
* // GlobalCluster: { // GlobalCluster
56+
* // GlobalClusterIdentifier: "STRING_VALUE",
57+
* // GlobalClusterResourceId: "STRING_VALUE",
58+
* // GlobalClusterArn: "STRING_VALUE",
59+
* // Status: "STRING_VALUE",
60+
* // Engine: "STRING_VALUE",
61+
* // EngineVersion: "STRING_VALUE",
62+
* // StorageEncrypted: true || false,
63+
* // DeletionProtection: true || false,
64+
* // GlobalClusterMembers: [ // GlobalClusterMemberList
65+
* // { // GlobalClusterMember
66+
* // DBClusterArn: "STRING_VALUE",
67+
* // Readers: [ // ReadersArnList
68+
* // "STRING_VALUE",
69+
* // ],
70+
* // IsWriter: true || false,
71+
* // },
72+
* // ],
73+
* // FailoverState: { // FailoverState
74+
* // Status: "pending" || "failing-over" || "cancelling",
75+
* // FromDbClusterArn: "STRING_VALUE",
76+
* // ToDbClusterArn: "STRING_VALUE",
77+
* // IsDataLossAllowed: true || false,
78+
* // },
79+
* // },
80+
* // };
81+
*
82+
* ```
83+
*
84+
* @param SwitchoverGlobalClusterCommandInput - {@link SwitchoverGlobalClusterCommandInput}
85+
* @returns {@link SwitchoverGlobalClusterCommandOutput}
86+
* @see {@link SwitchoverGlobalClusterCommandInput} for command's `input` shape.
87+
* @see {@link SwitchoverGlobalClusterCommandOutput} for command's `response` shape.
88+
* @see {@link NeptuneClientResolvedConfig | config} for NeptuneClient's `config` shape.
89+
*
90+
* @throws {@link DBClusterNotFoundFault} (client fault)
91+
* <p>
92+
* <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.</p>
93+
*
94+
* @throws {@link GlobalClusterNotFoundFault} (client fault)
95+
* <p>The <code>GlobalClusterIdentifier</code> doesn't refer to an existing global database cluster. </p>
96+
*
97+
* @throws {@link InvalidDBClusterStateFault} (client fault)
98+
* <p>The DB cluster is not in a valid state.</p>
99+
*
100+
* @throws {@link InvalidGlobalClusterStateFault} (client fault)
101+
* <p>The global cluster is in an invalid state and can't perform the requested operation. </p>
102+
*
103+
* @throws {@link NeptuneServiceException}
104+
* <p>Base exception class for all service exceptions from Neptune service.</p>
105+
*
106+
*
107+
* @public
108+
*/
109+
export class SwitchoverGlobalClusterCommand extends $Command
110+
.classBuilder<
111+
SwitchoverGlobalClusterCommandInput,
112+
SwitchoverGlobalClusterCommandOutput,
113+
NeptuneClientResolvedConfig,
114+
ServiceInputTypes,
115+
ServiceOutputTypes
116+
>()
117+
.ep(commonParams)
118+
.m(function (this: any, Command: any, cs: any, config: NeptuneClientResolvedConfig, o: any) {
119+
return [
120+
getSerdePlugin(config, this.serialize, this.deserialize),
121+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
122+
];
123+
})
124+
.s("AmazonRDSv19", "SwitchoverGlobalCluster", {})
125+
.n("NeptuneClient", "SwitchoverGlobalClusterCommand")
126+
.f(void 0, void 0)
127+
.ser(se_SwitchoverGlobalClusterCommand)
128+
.de(de_SwitchoverGlobalClusterCommand)
129+
.build() {
130+
/** @internal type navigation helper, not in runtime. */
131+
protected declare static __types: {
132+
api: {
133+
input: SwitchoverGlobalClusterMessage;
134+
output: SwitchoverGlobalClusterResult;
135+
};
136+
sdk: {
137+
input: SwitchoverGlobalClusterCommandInput;
138+
output: SwitchoverGlobalClusterCommandOutput;
139+
};
140+
};
141+
}

clients/client-neptune/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ export * from "./RestoreDBClusterFromSnapshotCommand";
6868
export * from "./RestoreDBClusterToPointInTimeCommand";
6969
export * from "./StartDBClusterCommand";
7070
export * from "./StopDBClusterCommand";
71+
export * from "./SwitchoverGlobalClusterCommand";

0 commit comments

Comments
 (0)