Skip to content

Commit d3daca7

Browse files
author
awstools
committed
feat(client-drs): Non breaking changes to existing APIs, and additional APIs added to support in-AWS failing back using AWS Elastic Disaster Recovery.
1 parent 6d5410c commit d3daca7

File tree

9 files changed

+1571
-244
lines changed

9 files changed

+1571
-244
lines changed

clients/client-drs/src/Drs.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ import {
107107
RetryDataReplicationCommandInput,
108108
RetryDataReplicationCommandOutput,
109109
} from "./commands/RetryDataReplicationCommand";
110+
import {
111+
ReverseReplicationCommand,
112+
ReverseReplicationCommandInput,
113+
ReverseReplicationCommandOutput,
114+
} from "./commands/ReverseReplicationCommand";
110115
import {
111116
StartFailbackLaunchCommand,
112117
StartFailbackLaunchCommandInput,
@@ -117,11 +122,21 @@ import {
117122
StartRecoveryCommandInput,
118123
StartRecoveryCommandOutput,
119124
} from "./commands/StartRecoveryCommand";
125+
import {
126+
StartReplicationCommand,
127+
StartReplicationCommandInput,
128+
StartReplicationCommandOutput,
129+
} from "./commands/StartReplicationCommand";
120130
import {
121131
StopFailbackCommand,
122132
StopFailbackCommandInput,
123133
StopFailbackCommandOutput,
124134
} from "./commands/StopFailbackCommand";
135+
import {
136+
StopReplicationCommand,
137+
StopReplicationCommandInput,
138+
StopReplicationCommandOutput,
139+
} from "./commands/StopReplicationCommand";
125140
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
126141
import {
127142
TerminateRecoveryInstancesCommand,
@@ -863,6 +878,41 @@ export class Drs extends DrsClient {
863878
}
864879
}
865880

881+
/**
882+
* <p>Start replication to origin / target region - applies only to protected instances that originated in EC2.
883+
* For recovery instances on target region - starts replication back to origin region.
884+
* For failback instances on origin region - starts replication to target region to re-protect them.
885+
* </p>
886+
*/
887+
public reverseReplication(
888+
args: ReverseReplicationCommandInput,
889+
options?: __HttpHandlerOptions
890+
): Promise<ReverseReplicationCommandOutput>;
891+
public reverseReplication(
892+
args: ReverseReplicationCommandInput,
893+
cb: (err: any, data?: ReverseReplicationCommandOutput) => void
894+
): void;
895+
public reverseReplication(
896+
args: ReverseReplicationCommandInput,
897+
options: __HttpHandlerOptions,
898+
cb: (err: any, data?: ReverseReplicationCommandOutput) => void
899+
): void;
900+
public reverseReplication(
901+
args: ReverseReplicationCommandInput,
902+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ReverseReplicationCommandOutput) => void),
903+
cb?: (err: any, data?: ReverseReplicationCommandOutput) => void
904+
): Promise<ReverseReplicationCommandOutput> | void {
905+
const command = new ReverseReplicationCommand(args);
906+
if (typeof optionsOrCb === "function") {
907+
this.send(command, optionsOrCb);
908+
} else if (typeof cb === "function") {
909+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
910+
this.send(command, optionsOrCb || {}, cb);
911+
} else {
912+
return this.send(command, optionsOrCb);
913+
}
914+
}
915+
866916
/**
867917
* <p>Initiates a Job for launching the machine that is being failed back to from the specified Recovery Instance. This will run conversion on the failback client and will reboot your machine, thus completing the failback process.</p>
868918
*/
@@ -927,6 +977,38 @@ export class Drs extends DrsClient {
927977
}
928978
}
929979

980+
/**
981+
* <p>Starts replication for a stopped Source Server. This action would make the Source Server protected again and restart billing for it.</p>
982+
*/
983+
public startReplication(
984+
args: StartReplicationCommandInput,
985+
options?: __HttpHandlerOptions
986+
): Promise<StartReplicationCommandOutput>;
987+
public startReplication(
988+
args: StartReplicationCommandInput,
989+
cb: (err: any, data?: StartReplicationCommandOutput) => void
990+
): void;
991+
public startReplication(
992+
args: StartReplicationCommandInput,
993+
options: __HttpHandlerOptions,
994+
cb: (err: any, data?: StartReplicationCommandOutput) => void
995+
): void;
996+
public startReplication(
997+
args: StartReplicationCommandInput,
998+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StartReplicationCommandOutput) => void),
999+
cb?: (err: any, data?: StartReplicationCommandOutput) => void
1000+
): Promise<StartReplicationCommandOutput> | void {
1001+
const command = new StartReplicationCommand(args);
1002+
if (typeof optionsOrCb === "function") {
1003+
this.send(command, optionsOrCb);
1004+
} else if (typeof cb === "function") {
1005+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1006+
this.send(command, optionsOrCb || {}, cb);
1007+
} else {
1008+
return this.send(command, optionsOrCb);
1009+
}
1010+
}
1011+
9301012
/**
9311013
* <p>Stops the failback process for a specified Recovery Instance. This changes the Failback State of the Recovery Instance back to FAILBACK_NOT_STARTED.</p>
9321014
*/
@@ -956,6 +1038,38 @@ export class Drs extends DrsClient {
9561038
}
9571039
}
9581040

1041+
/**
1042+
* <p>Stops replication for a Source Server. This action would make the Source Server unprotected, delete its existing snapshots and stop billing for it.</p>
1043+
*/
1044+
public stopReplication(
1045+
args: StopReplicationCommandInput,
1046+
options?: __HttpHandlerOptions
1047+
): Promise<StopReplicationCommandOutput>;
1048+
public stopReplication(
1049+
args: StopReplicationCommandInput,
1050+
cb: (err: any, data?: StopReplicationCommandOutput) => void
1051+
): void;
1052+
public stopReplication(
1053+
args: StopReplicationCommandInput,
1054+
options: __HttpHandlerOptions,
1055+
cb: (err: any, data?: StopReplicationCommandOutput) => void
1056+
): void;
1057+
public stopReplication(
1058+
args: StopReplicationCommandInput,
1059+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StopReplicationCommandOutput) => void),
1060+
cb?: (err: any, data?: StopReplicationCommandOutput) => void
1061+
): Promise<StopReplicationCommandOutput> | void {
1062+
const command = new StopReplicationCommand(args);
1063+
if (typeof optionsOrCb === "function") {
1064+
this.send(command, optionsOrCb);
1065+
} else if (typeof cb === "function") {
1066+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1067+
this.send(command, optionsOrCb || {}, cb);
1068+
} else {
1069+
return this.send(command, optionsOrCb);
1070+
}
1071+
}
1072+
9591073
/**
9601074
* <p>Adds or overwrites only the specified tags for the specified Elastic Disaster Recovery resource or resources. When you specify an existing tag key, the value is overwritten with the new value. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value.</p>
9611075
*/

clients/client-drs/src/DrsClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,15 @@ import {
123123
RetryDataReplicationCommandInput,
124124
RetryDataReplicationCommandOutput,
125125
} from "./commands/RetryDataReplicationCommand";
126+
import { ReverseReplicationCommandInput, ReverseReplicationCommandOutput } from "./commands/ReverseReplicationCommand";
126127
import {
127128
StartFailbackLaunchCommandInput,
128129
StartFailbackLaunchCommandOutput,
129130
} from "./commands/StartFailbackLaunchCommand";
130131
import { StartRecoveryCommandInput, StartRecoveryCommandOutput } from "./commands/StartRecoveryCommand";
132+
import { StartReplicationCommandInput, StartReplicationCommandOutput } from "./commands/StartReplicationCommand";
131133
import { StopFailbackCommandInput, StopFailbackCommandOutput } from "./commands/StopFailbackCommand";
134+
import { StopReplicationCommandInput, StopReplicationCommandOutput } from "./commands/StopReplicationCommand";
132135
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
133136
import {
134137
TerminateRecoveryInstancesCommandInput,
@@ -182,9 +185,12 @@ export type ServiceInputTypes =
182185
| ListStagingAccountsCommandInput
183186
| ListTagsForResourceCommandInput
184187
| RetryDataReplicationCommandInput
188+
| ReverseReplicationCommandInput
185189
| StartFailbackLaunchCommandInput
186190
| StartRecoveryCommandInput
191+
| StartReplicationCommandInput
187192
| StopFailbackCommandInput
193+
| StopReplicationCommandInput
188194
| TagResourceCommandInput
189195
| TerminateRecoveryInstancesCommandInput
190196
| UntagResourceCommandInput
@@ -216,9 +222,12 @@ export type ServiceOutputTypes =
216222
| ListStagingAccountsCommandOutput
217223
| ListTagsForResourceCommandOutput
218224
| RetryDataReplicationCommandOutput
225+
| ReverseReplicationCommandOutput
219226
| StartFailbackLaunchCommandOutput
220227
| StartRecoveryCommandOutput
228+
| StartReplicationCommandOutput
221229
| StopFailbackCommandOutput
230+
| StopReplicationCommandOutput
222231
| TagResourceCommandOutput
223232
| TerminateRecoveryInstancesCommandOutput
224233
| UntagResourceCommandOutput
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
5+
import { Command as $Command } from "@aws-sdk/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
} from "@aws-sdk/types";
15+
16+
import { DrsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DrsClient";
17+
import {
18+
ReverseReplicationRequest,
19+
ReverseReplicationRequestFilterSensitiveLog,
20+
ReverseReplicationResponse,
21+
ReverseReplicationResponseFilterSensitiveLog,
22+
} from "../models/models_0";
23+
import {
24+
deserializeAws_restJson1ReverseReplicationCommand,
25+
serializeAws_restJson1ReverseReplicationCommand,
26+
} from "../protocols/Aws_restJson1";
27+
28+
export interface ReverseReplicationCommandInput extends ReverseReplicationRequest {}
29+
export interface ReverseReplicationCommandOutput extends ReverseReplicationResponse, __MetadataBearer {}
30+
31+
/**
32+
* <p>Start replication to origin / target region - applies only to protected instances that originated in EC2.
33+
* For recovery instances on target region - starts replication back to origin region.
34+
* For failback instances on origin region - starts replication to target region to re-protect them.
35+
* </p>
36+
* @example
37+
* Use a bare-bones client and the command you need to make an API call.
38+
* ```javascript
39+
* import { DrsClient, ReverseReplicationCommand } from "@aws-sdk/client-drs"; // ES Modules import
40+
* // const { DrsClient, ReverseReplicationCommand } = require("@aws-sdk/client-drs"); // CommonJS import
41+
* const client = new DrsClient(config);
42+
* const command = new ReverseReplicationCommand(input);
43+
* const response = await client.send(command);
44+
* ```
45+
*
46+
* @see {@link ReverseReplicationCommandInput} for command's `input` shape.
47+
* @see {@link ReverseReplicationCommandOutput} for command's `response` shape.
48+
* @see {@link DrsClientResolvedConfig | config} for DrsClient's `config` shape.
49+
*
50+
*/
51+
export class ReverseReplicationCommand extends $Command<
52+
ReverseReplicationCommandInput,
53+
ReverseReplicationCommandOutput,
54+
DrsClientResolvedConfig
55+
> {
56+
// Start section: command_properties
57+
// End section: command_properties
58+
59+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
60+
return {
61+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
62+
Endpoint: { type: "builtInParams", name: "endpoint" },
63+
Region: { type: "builtInParams", name: "region" },
64+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
65+
};
66+
}
67+
68+
constructor(readonly input: ReverseReplicationCommandInput) {
69+
// Start section: command_constructor
70+
super();
71+
// End section: command_constructor
72+
}
73+
74+
/**
75+
* @internal
76+
*/
77+
resolveMiddleware(
78+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
79+
configuration: DrsClientResolvedConfig,
80+
options?: __HttpHandlerOptions
81+
): Handler<ReverseReplicationCommandInput, ReverseReplicationCommandOutput> {
82+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
83+
this.middlewareStack.use(
84+
getEndpointPlugin(configuration, ReverseReplicationCommand.getEndpointParameterInstructions())
85+
);
86+
87+
const stack = clientStack.concat(this.middlewareStack);
88+
89+
const { logger } = configuration;
90+
const clientName = "DrsClient";
91+
const commandName = "ReverseReplicationCommand";
92+
const handlerExecutionContext: HandlerExecutionContext = {
93+
logger,
94+
clientName,
95+
commandName,
96+
inputFilterSensitiveLog: ReverseReplicationRequestFilterSensitiveLog,
97+
outputFilterSensitiveLog: ReverseReplicationResponseFilterSensitiveLog,
98+
};
99+
const { requestHandler } = configuration;
100+
return stack.resolve(
101+
(request: FinalizeHandlerArguments<any>) =>
102+
requestHandler.handle(request.request as __HttpRequest, options || {}),
103+
handlerExecutionContext
104+
);
105+
}
106+
107+
private serialize(input: ReverseReplicationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
108+
return serializeAws_restJson1ReverseReplicationCommand(input, context);
109+
}
110+
111+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<ReverseReplicationCommandOutput> {
112+
return deserializeAws_restJson1ReverseReplicationCommand(output, context);
113+
}
114+
115+
// Start section: command_body_extra
116+
// End section: command_body_extra
117+
}

0 commit comments

Comments
 (0)