Skip to content

Commit 9e66058

Browse files
author
awstools
committed
feat(client-drs): Changed existing APIs and added new APIs to accommodate using multiple AWS accounts with AWS Elastic Disaster Recovery.
1 parent 6efc758 commit 9e66058

File tree

13 files changed

+2580
-849
lines changed

13 files changed

+2580
-849
lines changed

clients/client-drs/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ using your favorite package manager:
2626

2727
The AWS SDK is modulized by clients and commands.
2828
To send a request, you only need to import the `DrsClient` and
29-
the commands you need, for example `CreateReplicationConfigurationTemplateCommand`:
29+
the commands you need, for example `CreateExtendedSourceServerCommand`:
3030

3131
```js
3232
// ES5 example
33-
const { DrsClient, CreateReplicationConfigurationTemplateCommand } = require("@aws-sdk/client-drs");
33+
const { DrsClient, CreateExtendedSourceServerCommand } = require("@aws-sdk/client-drs");
3434
```
3535

3636
```ts
3737
// ES6+ example
38-
import { DrsClient, CreateReplicationConfigurationTemplateCommand } from "@aws-sdk/client-drs";
38+
import { DrsClient, CreateExtendedSourceServerCommand } from "@aws-sdk/client-drs";
3939
```
4040

4141
### Usage
@@ -54,7 +54,7 @@ const client = new DrsClient({ region: "REGION" });
5454
const params = {
5555
/** input parameters */
5656
};
57-
const command = new CreateReplicationConfigurationTemplateCommand(params);
57+
const command = new CreateExtendedSourceServerCommand(params);
5858
```
5959

6060
#### Async/await
@@ -133,15 +133,15 @@ const client = new AWS.Drs({ region: "REGION" });
133133

134134
// async/await.
135135
try {
136-
const data = await client.createReplicationConfigurationTemplate(params);
136+
const data = await client.createExtendedSourceServer(params);
137137
// process data.
138138
} catch (error) {
139139
// error handling.
140140
}
141141

142142
// Promises.
143143
client
144-
.createReplicationConfigurationTemplate(params)
144+
.createExtendedSourceServer(params)
145145
.then((data) => {
146146
// process data.
147147
})
@@ -150,7 +150,7 @@ client
150150
});
151151

152152
// callbacks.
153-
client.createReplicationConfigurationTemplate(params, (err, data) => {
153+
client.createExtendedSourceServer(params, (err, data) => {
154154
// process err and data.
155155
});
156156
```

clients/client-drs/src/Drs.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// smithy-typescript generated code
22
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
33

4+
import {
5+
CreateExtendedSourceServerCommand,
6+
CreateExtendedSourceServerCommandInput,
7+
CreateExtendedSourceServerCommandOutput,
8+
} from "./commands/CreateExtendedSourceServerCommand";
49
import {
510
CreateReplicationConfigurationTemplateCommand,
611
CreateReplicationConfigurationTemplateCommandInput,
@@ -82,6 +87,16 @@ import {
8287
InitializeServiceCommandInput,
8388
InitializeServiceCommandOutput,
8489
} from "./commands/InitializeServiceCommand";
90+
import {
91+
ListExtensibleSourceServersCommand,
92+
ListExtensibleSourceServersCommandInput,
93+
ListExtensibleSourceServersCommandOutput,
94+
} from "./commands/ListExtensibleSourceServersCommand";
95+
import {
96+
ListStagingAccountsCommand,
97+
ListStagingAccountsCommandInput,
98+
ListStagingAccountsCommandOutput,
99+
} from "./commands/ListStagingAccountsCommand";
85100
import {
86101
ListTagsForResourceCommand,
87102
ListTagsForResourceCommandInput,
@@ -144,6 +159,38 @@ import { DrsClient } from "./DrsClient";
144159
* <p>AWS Elastic Disaster Recovery Service.</p>
145160
*/
146161
export class Drs extends DrsClient {
162+
/**
163+
* <p>Create an extended source server in the target Account based on the source server in staging account.</p>
164+
*/
165+
public createExtendedSourceServer(
166+
args: CreateExtendedSourceServerCommandInput,
167+
options?: __HttpHandlerOptions
168+
): Promise<CreateExtendedSourceServerCommandOutput>;
169+
public createExtendedSourceServer(
170+
args: CreateExtendedSourceServerCommandInput,
171+
cb: (err: any, data?: CreateExtendedSourceServerCommandOutput) => void
172+
): void;
173+
public createExtendedSourceServer(
174+
args: CreateExtendedSourceServerCommandInput,
175+
options: __HttpHandlerOptions,
176+
cb: (err: any, data?: CreateExtendedSourceServerCommandOutput) => void
177+
): void;
178+
public createExtendedSourceServer(
179+
args: CreateExtendedSourceServerCommandInput,
180+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CreateExtendedSourceServerCommandOutput) => void),
181+
cb?: (err: any, data?: CreateExtendedSourceServerCommandOutput) => void
182+
): Promise<CreateExtendedSourceServerCommandOutput> | void {
183+
const command = new CreateExtendedSourceServerCommand(args);
184+
if (typeof optionsOrCb === "function") {
185+
this.send(command, optionsOrCb);
186+
} else if (typeof cb === "function") {
187+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
188+
this.send(command, optionsOrCb || {}, cb);
189+
} else {
190+
return this.send(command, optionsOrCb);
191+
}
192+
}
193+
147194
/**
148195
* <p>Creates a new ReplicationConfigurationTemplate.</p>
149196
*/
@@ -685,6 +732,73 @@ export class Drs extends DrsClient {
685732
}
686733
}
687734

735+
/**
736+
* <p>Returns a list of source servers on a staging account that are extensible, which means that:
737+
* a. The source server is not already extended into this Account.
738+
* b. The source server on the Account we’re reading from is not an extension of another source server.
739+
* </p>
740+
*/
741+
public listExtensibleSourceServers(
742+
args: ListExtensibleSourceServersCommandInput,
743+
options?: __HttpHandlerOptions
744+
): Promise<ListExtensibleSourceServersCommandOutput>;
745+
public listExtensibleSourceServers(
746+
args: ListExtensibleSourceServersCommandInput,
747+
cb: (err: any, data?: ListExtensibleSourceServersCommandOutput) => void
748+
): void;
749+
public listExtensibleSourceServers(
750+
args: ListExtensibleSourceServersCommandInput,
751+
options: __HttpHandlerOptions,
752+
cb: (err: any, data?: ListExtensibleSourceServersCommandOutput) => void
753+
): void;
754+
public listExtensibleSourceServers(
755+
args: ListExtensibleSourceServersCommandInput,
756+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListExtensibleSourceServersCommandOutput) => void),
757+
cb?: (err: any, data?: ListExtensibleSourceServersCommandOutput) => void
758+
): Promise<ListExtensibleSourceServersCommandOutput> | void {
759+
const command = new ListExtensibleSourceServersCommand(args);
760+
if (typeof optionsOrCb === "function") {
761+
this.send(command, optionsOrCb);
762+
} else if (typeof cb === "function") {
763+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
764+
this.send(command, optionsOrCb || {}, cb);
765+
} else {
766+
return this.send(command, optionsOrCb);
767+
}
768+
}
769+
770+
/**
771+
* <p>Returns an array of staging accounts for existing extended source servers.</p>
772+
*/
773+
public listStagingAccounts(
774+
args: ListStagingAccountsCommandInput,
775+
options?: __HttpHandlerOptions
776+
): Promise<ListStagingAccountsCommandOutput>;
777+
public listStagingAccounts(
778+
args: ListStagingAccountsCommandInput,
779+
cb: (err: any, data?: ListStagingAccountsCommandOutput) => void
780+
): void;
781+
public listStagingAccounts(
782+
args: ListStagingAccountsCommandInput,
783+
options: __HttpHandlerOptions,
784+
cb: (err: any, data?: ListStagingAccountsCommandOutput) => void
785+
): void;
786+
public listStagingAccounts(
787+
args: ListStagingAccountsCommandInput,
788+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListStagingAccountsCommandOutput) => void),
789+
cb?: (err: any, data?: ListStagingAccountsCommandOutput) => void
790+
): Promise<ListStagingAccountsCommandOutput> | void {
791+
const command = new ListStagingAccountsCommand(args);
792+
if (typeof optionsOrCb === "function") {
793+
this.send(command, optionsOrCb);
794+
} else if (typeof cb === "function") {
795+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
796+
this.send(command, optionsOrCb || {}, cb);
797+
} else {
798+
return this.send(command, optionsOrCb);
799+
}
800+
}
801+
688802
/**
689803
* <p>List all tags for your Elastic Disaster Recovery resources.</p>
690804
*/

clients/client-drs/src/DrsClient.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ import {
5252
UserAgent as __UserAgent,
5353
} from "@aws-sdk/types";
5454

55+
import {
56+
CreateExtendedSourceServerCommandInput,
57+
CreateExtendedSourceServerCommandOutput,
58+
} from "./commands/CreateExtendedSourceServerCommand";
5559
import {
5660
CreateReplicationConfigurationTemplateCommandInput,
5761
CreateReplicationConfigurationTemplateCommandOutput,
@@ -108,6 +112,14 @@ import {
108112
GetReplicationConfigurationCommandOutput,
109113
} from "./commands/GetReplicationConfigurationCommand";
110114
import { InitializeServiceCommandInput, InitializeServiceCommandOutput } from "./commands/InitializeServiceCommand";
115+
import {
116+
ListExtensibleSourceServersCommandInput,
117+
ListExtensibleSourceServersCommandOutput,
118+
} from "./commands/ListExtensibleSourceServersCommand";
119+
import {
120+
ListStagingAccountsCommandInput,
121+
ListStagingAccountsCommandOutput,
122+
} from "./commands/ListStagingAccountsCommand";
111123
import {
112124
ListTagsForResourceCommandInput,
113125
ListTagsForResourceCommandOutput,
@@ -147,6 +159,7 @@ import {
147159
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
148160

149161
export type ServiceInputTypes =
162+
| CreateExtendedSourceServerCommandInput
150163
| CreateReplicationConfigurationTemplateCommandInput
151164
| DeleteJobCommandInput
152165
| DeleteRecoveryInstanceCommandInput
@@ -164,6 +177,8 @@ export type ServiceInputTypes =
164177
| GetLaunchConfigurationCommandInput
165178
| GetReplicationConfigurationCommandInput
166179
| InitializeServiceCommandInput
180+
| ListExtensibleSourceServersCommandInput
181+
| ListStagingAccountsCommandInput
167182
| ListTagsForResourceCommandInput
168183
| RetryDataReplicationCommandInput
169184
| StartFailbackLaunchCommandInput
@@ -178,6 +193,7 @@ export type ServiceInputTypes =
178193
| UpdateReplicationConfigurationTemplateCommandInput;
179194

180195
export type ServiceOutputTypes =
196+
| CreateExtendedSourceServerCommandOutput
181197
| CreateReplicationConfigurationTemplateCommandOutput
182198
| DeleteJobCommandOutput
183199
| DeleteRecoveryInstanceCommandOutput
@@ -195,6 +211,8 @@ export type ServiceOutputTypes =
195211
| GetLaunchConfigurationCommandOutput
196212
| GetReplicationConfigurationCommandOutput
197213
| InitializeServiceCommandOutput
214+
| ListExtensibleSourceServersCommandOutput
215+
| ListStagingAccountsCommandOutput
198216
| ListTagsForResourceCommandOutput
199217
| RetryDataReplicationCommandOutput
200218
| StartFailbackLaunchCommandOutput
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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 { DrsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DrsClient";
16+
import { CreateExtendedSourceServerRequest, CreateExtendedSourceServerResponse } from "../models/models_0";
17+
import {
18+
deserializeAws_restJson1CreateExtendedSourceServerCommand,
19+
serializeAws_restJson1CreateExtendedSourceServerCommand,
20+
} from "../protocols/Aws_restJson1";
21+
22+
export interface CreateExtendedSourceServerCommandInput extends CreateExtendedSourceServerRequest {}
23+
export interface CreateExtendedSourceServerCommandOutput extends CreateExtendedSourceServerResponse, __MetadataBearer {}
24+
25+
/**
26+
* <p>Create an extended source server in the target Account based on the source server in staging account.</p>
27+
* @example
28+
* Use a bare-bones client and the command you need to make an API call.
29+
* ```javascript
30+
* import { DrsClient, CreateExtendedSourceServerCommand } from "@aws-sdk/client-drs"; // ES Modules import
31+
* // const { DrsClient, CreateExtendedSourceServerCommand } = require("@aws-sdk/client-drs"); // CommonJS import
32+
* const client = new DrsClient(config);
33+
* const command = new CreateExtendedSourceServerCommand(input);
34+
* const response = await client.send(command);
35+
* ```
36+
*
37+
* @see {@link CreateExtendedSourceServerCommandInput} for command's `input` shape.
38+
* @see {@link CreateExtendedSourceServerCommandOutput} for command's `response` shape.
39+
* @see {@link DrsClientResolvedConfig | config} for DrsClient's `config` shape.
40+
*
41+
*/
42+
export class CreateExtendedSourceServerCommand extends $Command<
43+
CreateExtendedSourceServerCommandInput,
44+
CreateExtendedSourceServerCommandOutput,
45+
DrsClientResolvedConfig
46+
> {
47+
// Start section: command_properties
48+
// End section: command_properties
49+
50+
constructor(readonly input: CreateExtendedSourceServerCommandInput) {
51+
// Start section: command_constructor
52+
super();
53+
// End section: command_constructor
54+
}
55+
56+
/**
57+
* @internal
58+
*/
59+
resolveMiddleware(
60+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
61+
configuration: DrsClientResolvedConfig,
62+
options?: __HttpHandlerOptions
63+
): Handler<CreateExtendedSourceServerCommandInput, CreateExtendedSourceServerCommandOutput> {
64+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
65+
66+
const stack = clientStack.concat(this.middlewareStack);
67+
68+
const { logger } = configuration;
69+
const clientName = "DrsClient";
70+
const commandName = "CreateExtendedSourceServerCommand";
71+
const handlerExecutionContext: HandlerExecutionContext = {
72+
logger,
73+
clientName,
74+
commandName,
75+
inputFilterSensitiveLog: CreateExtendedSourceServerRequest.filterSensitiveLog,
76+
outputFilterSensitiveLog: CreateExtendedSourceServerResponse.filterSensitiveLog,
77+
};
78+
const { requestHandler } = configuration;
79+
return stack.resolve(
80+
(request: FinalizeHandlerArguments<any>) =>
81+
requestHandler.handle(request.request as __HttpRequest, options || {}),
82+
handlerExecutionContext
83+
);
84+
}
85+
86+
private serialize(input: CreateExtendedSourceServerCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
87+
return serializeAws_restJson1CreateExtendedSourceServerCommand(input, context);
88+
}
89+
90+
private deserialize(
91+
output: __HttpResponse,
92+
context: __SerdeContext
93+
): Promise<CreateExtendedSourceServerCommandOutput> {
94+
return deserializeAws_restJson1CreateExtendedSourceServerCommand(output, context);
95+
}
96+
97+
// Start section: command_body_extra
98+
// End section: command_body_extra
99+
}

0 commit comments

Comments
 (0)