Skip to content

Commit 75335b5

Browse files
author
awstools
committed
feat(client-rds): RDS for Oracle supports Oracle Data Guard switchover and read replica backups.
1 parent a3238d8 commit 75335b5

File tree

8 files changed

+341
-2
lines changed

8 files changed

+341
-2
lines changed

clients/client-rds/src/RDS.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ import {
681681
StopDBInstanceCommandInput,
682682
StopDBInstanceCommandOutput,
683683
} from "./commands/StopDBInstanceCommand";
684+
import {
685+
SwitchoverReadReplicaCommand,
686+
SwitchoverReadReplicaCommandInput,
687+
SwitchoverReadReplicaCommandOutput,
688+
} from "./commands/SwitchoverReadReplicaCommand";
684689
import { RDSClient } from "./RDSClient";
685690

686691
/**
@@ -5930,4 +5935,37 @@ export class RDS extends RDSClient {
59305935
return this.send(command, optionsOrCb);
59315936
}
59325937
}
5938+
5939+
/**
5940+
* <p>Switches over an Oracle standby database in an Oracle Data Guard environment, making it the new
5941+
* primary database. Issue this command in the AWS Region that hosts the current standby database.</p>
5942+
*/
5943+
public switchoverReadReplica(
5944+
args: SwitchoverReadReplicaCommandInput,
5945+
options?: __HttpHandlerOptions
5946+
): Promise<SwitchoverReadReplicaCommandOutput>;
5947+
public switchoverReadReplica(
5948+
args: SwitchoverReadReplicaCommandInput,
5949+
cb: (err: any, data?: SwitchoverReadReplicaCommandOutput) => void
5950+
): void;
5951+
public switchoverReadReplica(
5952+
args: SwitchoverReadReplicaCommandInput,
5953+
options: __HttpHandlerOptions,
5954+
cb: (err: any, data?: SwitchoverReadReplicaCommandOutput) => void
5955+
): void;
5956+
public switchoverReadReplica(
5957+
args: SwitchoverReadReplicaCommandInput,
5958+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SwitchoverReadReplicaCommandOutput) => void),
5959+
cb?: (err: any, data?: SwitchoverReadReplicaCommandOutput) => void
5960+
): Promise<SwitchoverReadReplicaCommandOutput> | void {
5961+
const command = new SwitchoverReadReplicaCommand(args);
5962+
if (typeof optionsOrCb === "function") {
5963+
this.send(command, optionsOrCb);
5964+
} else if (typeof cb === "function") {
5965+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
5966+
this.send(command, optionsOrCb || {}, cb);
5967+
} else {
5968+
return this.send(command, optionsOrCb);
5969+
}
5970+
}
59335971
}

clients/client-rds/src/RDSClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ import {
489489
StopDBInstanceAutomatedBackupsReplicationCommandOutput,
490490
} from "./commands/StopDBInstanceAutomatedBackupsReplicationCommand";
491491
import { StopDBInstanceCommandInput, StopDBInstanceCommandOutput } from "./commands/StopDBInstanceCommand";
492+
import {
493+
SwitchoverReadReplicaCommandInput,
494+
SwitchoverReadReplicaCommandOutput,
495+
} from "./commands/SwitchoverReadReplicaCommand";
492496
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
493497

494498
export type ServiceInputTypes =
@@ -627,7 +631,8 @@ export type ServiceInputTypes =
627631
| StopActivityStreamCommandInput
628632
| StopDBClusterCommandInput
629633
| StopDBInstanceAutomatedBackupsReplicationCommandInput
630-
| StopDBInstanceCommandInput;
634+
| StopDBInstanceCommandInput
635+
| SwitchoverReadReplicaCommandInput;
631636

632637
export type ServiceOutputTypes =
633638
| AddRoleToDBClusterCommandOutput
@@ -765,7 +770,8 @@ export type ServiceOutputTypes =
765770
| StopActivityStreamCommandOutput
766771
| StopDBClusterCommandOutput
767772
| StopDBInstanceAutomatedBackupsReplicationCommandOutput
768-
| StopDBInstanceCommandOutput;
773+
| StopDBInstanceCommandOutput
774+
| SwitchoverReadReplicaCommandOutput;
769775

770776
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
771777
/**
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import {
16+
SwitchoverReadReplicaMessage,
17+
SwitchoverReadReplicaMessageFilterSensitiveLog,
18+
SwitchoverReadReplicaResult,
19+
SwitchoverReadReplicaResultFilterSensitiveLog,
20+
} from "../models/models_1";
21+
import {
22+
deserializeAws_querySwitchoverReadReplicaCommand,
23+
serializeAws_querySwitchoverReadReplicaCommand,
24+
} from "../protocols/Aws_query";
25+
import { RDSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RDSClient";
26+
27+
export interface SwitchoverReadReplicaCommandInput extends SwitchoverReadReplicaMessage {}
28+
export interface SwitchoverReadReplicaCommandOutput extends SwitchoverReadReplicaResult, __MetadataBearer {}
29+
30+
/**
31+
* <p>Switches over an Oracle standby database in an Oracle Data Guard environment, making it the new
32+
* primary database. Issue this command in the AWS Region that hosts the current standby database.</p>
33+
* @example
34+
* Use a bare-bones client and the command you need to make an API call.
35+
* ```javascript
36+
* import { RDSClient, SwitchoverReadReplicaCommand } from "@aws-sdk/client-rds"; // ES Modules import
37+
* // const { RDSClient, SwitchoverReadReplicaCommand } = require("@aws-sdk/client-rds"); // CommonJS import
38+
* const client = new RDSClient(config);
39+
* const command = new SwitchoverReadReplicaCommand(input);
40+
* const response = await client.send(command);
41+
* ```
42+
*
43+
* @see {@link SwitchoverReadReplicaCommandInput} for command's `input` shape.
44+
* @see {@link SwitchoverReadReplicaCommandOutput} for command's `response` shape.
45+
* @see {@link RDSClientResolvedConfig | config} for RDSClient's `config` shape.
46+
*
47+
*/
48+
export class SwitchoverReadReplicaCommand extends $Command<
49+
SwitchoverReadReplicaCommandInput,
50+
SwitchoverReadReplicaCommandOutput,
51+
RDSClientResolvedConfig
52+
> {
53+
// Start section: command_properties
54+
// End section: command_properties
55+
56+
constructor(readonly input: SwitchoverReadReplicaCommandInput) {
57+
// Start section: command_constructor
58+
super();
59+
// End section: command_constructor
60+
}
61+
62+
/**
63+
* @internal
64+
*/
65+
resolveMiddleware(
66+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
67+
configuration: RDSClientResolvedConfig,
68+
options?: __HttpHandlerOptions
69+
): Handler<SwitchoverReadReplicaCommandInput, SwitchoverReadReplicaCommandOutput> {
70+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
71+
72+
const stack = clientStack.concat(this.middlewareStack);
73+
74+
const { logger } = configuration;
75+
const clientName = "RDSClient";
76+
const commandName = "SwitchoverReadReplicaCommand";
77+
const handlerExecutionContext: HandlerExecutionContext = {
78+
logger,
79+
clientName,
80+
commandName,
81+
inputFilterSensitiveLog: SwitchoverReadReplicaMessageFilterSensitiveLog,
82+
outputFilterSensitiveLog: SwitchoverReadReplicaResultFilterSensitiveLog,
83+
};
84+
const { requestHandler } = configuration;
85+
return stack.resolve(
86+
(request: FinalizeHandlerArguments<any>) =>
87+
requestHandler.handle(request.request as __HttpRequest, options || {}),
88+
handlerExecutionContext
89+
);
90+
}
91+
92+
private serialize(input: SwitchoverReadReplicaCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
93+
return serializeAws_querySwitchoverReadReplicaCommand(input, context);
94+
}
95+
96+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<SwitchoverReadReplicaCommandOutput> {
97+
return deserializeAws_querySwitchoverReadReplicaCommand(output, context);
98+
}
99+
100+
// Start section: command_body_extra
101+
// End section: command_body_extra
102+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@ export * from "./StopActivityStreamCommand";
135135
export * from "./StopDBClusterCommand";
136136
export * from "./StopDBInstanceAutomatedBackupsReplicationCommand";
137137
export * from "./StopDBInstanceCommand";
138+
export * from "./SwitchoverReadReplicaCommand";

clients/client-rds/src/models/models_0.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,16 @@ export interface DBSnapshot {
22182218
*/
22192219
OriginalSnapshotCreateTime?: Date;
22202220

2221+
/**
2222+
* <p>The timestamp of the most recent transaction applied to the database that you're backing up.
2223+
* Thus, if you restore a snapshot, SnapshotDatabaseTime is the most recent transaction in the restored DB instance.
2224+
* In contrast, originalSnapshotCreateTime specifies the system time that the snapshot completed.</p>
2225+
* <p>If you back up a read replica, you can determine the replica lag by comparing SnapshotDatabaseTime
2226+
* with originalSnapshotCreateTime. For example, if originalSnapshotCreateTime is two hours later than
2227+
* SnapshotDatabaseTime, then the replica lag is two hours. *** REVIEWERS 7/27: Switchover</p>
2228+
*/
2229+
SnapshotDatabaseTime?: Date;
2230+
22212231
/**
22222232
* <p>Specifies where manual snapshots are stored: Amazon Web Services Outposts or the Amazon Web Services Region.</p>
22232233
*/

clients/client-rds/src/models/models_1.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8434,6 +8434,31 @@ export interface StopDBInstanceAutomatedBackupsReplicationResult {
84348434
DBInstanceAutomatedBackup?: DBInstanceAutomatedBackup;
84358435
}
84368436

8437+
export interface SwitchoverReadReplicaMessage {
8438+
/**
8439+
* <p>The DB instance identifier of the current standby database. This value is stored as a lowercase string.</p>
8440+
* <p>Constraints:</p>
8441+
* <ul>
8442+
* <li>
8443+
* <p>Must match the identifier of an existing Oracle read replica DB instance.</p>
8444+
* </li>
8445+
* </ul>
8446+
*/
8447+
DBInstanceIdentifier: string | undefined;
8448+
}
8449+
8450+
export interface SwitchoverReadReplicaResult {
8451+
/**
8452+
* <p>Contains the details of an Amazon RDS DB instance.</p>
8453+
* <p>This data type is used as a response element in the operations <code>CreateDBInstance</code>,
8454+
* <code>CreateDBInstanceReadReplica</code>, <code>DeleteDBInstance</code>, <code>DescribeDBInstances</code>,
8455+
* <code>ModifyDBInstance</code>, <code>PromoteReadReplica</code>, <code>RebootDBInstance</code>,
8456+
* <code>RestoreDBInstanceFromDBSnapshot</code>, <code>RestoreDBInstanceFromS3</code>, <code>RestoreDBInstanceToPointInTime</code>,
8457+
* <code>StartDBInstance</code>, and <code>StopDBInstance</code>.</p>
8458+
*/
8459+
DBInstance?: DBInstance;
8460+
}
8461+
84378462
/**
84388463
* @internal
84398464
*/
@@ -9568,3 +9593,17 @@ export const StopDBInstanceAutomatedBackupsReplicationResultFilterSensitiveLog =
95689593
): any => ({
95699594
...obj,
95709595
});
9596+
9597+
/**
9598+
* @internal
9599+
*/
9600+
export const SwitchoverReadReplicaMessageFilterSensitiveLog = (obj: SwitchoverReadReplicaMessage): any => ({
9601+
...obj,
9602+
});
9603+
9604+
/**
9605+
* @internal
9606+
*/
9607+
export const SwitchoverReadReplicaResultFilterSensitiveLog = (obj: SwitchoverReadReplicaResult): any => ({
9608+
...obj,
9609+
});

0 commit comments

Comments
 (0)