Skip to content

Commit 45d84e0

Browse files
author
awstools
committed
feat(client-backup-gateway): Changes include: new GetVirtualMachineApi to fetch a single user's VM, improving ListVirtualMachines to fetch filtered VMs as well as all VMs, and improving GetGatewayApi to now also return the gateway's MaintenanceStartTime.
1 parent d48cc66 commit 45d84e0

File tree

7 files changed

+728
-70
lines changed

7 files changed

+728
-70
lines changed

clients/client-backup-gateway/src/BackupGateway.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ import {
2828
DisassociateGatewayFromServerCommandOutput,
2929
} from "./commands/DisassociateGatewayFromServerCommand";
3030
import { GetGatewayCommand, GetGatewayCommandInput, GetGatewayCommandOutput } from "./commands/GetGatewayCommand";
31+
import {
32+
GetVirtualMachineCommand,
33+
GetVirtualMachineCommandInput,
34+
GetVirtualMachineCommandOutput,
35+
} from "./commands/GetVirtualMachineCommand";
3136
import {
3237
ImportHypervisorConfigurationCommand,
3338
ImportHypervisorConfigurationCommandInput,
@@ -287,6 +292,38 @@ export class BackupGateway extends BackupGatewayClient {
287292
}
288293
}
289294

295+
/**
296+
* <p>By providing the ARN (Amazon Resource Name), this API returns the virtual machine.</p>
297+
*/
298+
public getVirtualMachine(
299+
args: GetVirtualMachineCommandInput,
300+
options?: __HttpHandlerOptions
301+
): Promise<GetVirtualMachineCommandOutput>;
302+
public getVirtualMachine(
303+
args: GetVirtualMachineCommandInput,
304+
cb: (err: any, data?: GetVirtualMachineCommandOutput) => void
305+
): void;
306+
public getVirtualMachine(
307+
args: GetVirtualMachineCommandInput,
308+
options: __HttpHandlerOptions,
309+
cb: (err: any, data?: GetVirtualMachineCommandOutput) => void
310+
): void;
311+
public getVirtualMachine(
312+
args: GetVirtualMachineCommandInput,
313+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetVirtualMachineCommandOutput) => void),
314+
cb?: (err: any, data?: GetVirtualMachineCommandOutput) => void
315+
): Promise<GetVirtualMachineCommandOutput> | void {
316+
const command = new GetVirtualMachineCommand(args);
317+
if (typeof optionsOrCb === "function") {
318+
this.send(command, optionsOrCb);
319+
} else if (typeof cb === "function") {
320+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
321+
this.send(command, optionsOrCb || {}, cb);
322+
} else {
323+
return this.send(command, optionsOrCb);
324+
}
325+
}
326+
290327
/**
291328
* <p>Connect to a hypervisor by importing its configuration.</p>
292329
*/

clients/client-backup-gateway/src/BackupGatewayClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import {
6565
DisassociateGatewayFromServerCommandOutput,
6666
} from "./commands/DisassociateGatewayFromServerCommand";
6767
import { GetGatewayCommandInput, GetGatewayCommandOutput } from "./commands/GetGatewayCommand";
68+
import { GetVirtualMachineCommandInput, GetVirtualMachineCommandOutput } from "./commands/GetVirtualMachineCommand";
6869
import {
6970
ImportHypervisorConfigurationCommandInput,
7071
ImportHypervisorConfigurationCommandOutput,
@@ -107,6 +108,7 @@ export type ServiceInputTypes =
107108
| DeleteHypervisorCommandInput
108109
| DisassociateGatewayFromServerCommandInput
109110
| GetGatewayCommandInput
111+
| GetVirtualMachineCommandInput
110112
| ImportHypervisorConfigurationCommandInput
111113
| ListGatewaysCommandInput
112114
| ListHypervisorsCommandInput
@@ -127,6 +129,7 @@ export type ServiceOutputTypes =
127129
| DeleteHypervisorCommandOutput
128130
| DisassociateGatewayFromServerCommandOutput
129131
| GetGatewayCommandOutput
132+
| GetVirtualMachineCommandOutput
130133
| ImportHypervisorConfigurationCommandOutput
131134
| ListGatewaysCommandOutput
132135
| ListHypervisorsCommandOutput
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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 { BackupGatewayClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BackupGatewayClient";
16+
import {
17+
GetVirtualMachineInput,
18+
GetVirtualMachineInputFilterSensitiveLog,
19+
GetVirtualMachineOutput,
20+
GetVirtualMachineOutputFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_json1_0GetVirtualMachineCommand,
24+
serializeAws_json1_0GetVirtualMachineCommand,
25+
} from "../protocols/Aws_json1_0";
26+
27+
export interface GetVirtualMachineCommandInput extends GetVirtualMachineInput {}
28+
export interface GetVirtualMachineCommandOutput extends GetVirtualMachineOutput, __MetadataBearer {}
29+
30+
/**
31+
* <p>By providing the ARN (Amazon Resource Name), this API returns the virtual machine.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { BackupGatewayClient, GetVirtualMachineCommand } from "@aws-sdk/client-backup-gateway"; // ES Modules import
36+
* // const { BackupGatewayClient, GetVirtualMachineCommand } = require("@aws-sdk/client-backup-gateway"); // CommonJS import
37+
* const client = new BackupGatewayClient(config);
38+
* const command = new GetVirtualMachineCommand(input);
39+
* const response = await client.send(command);
40+
* ```
41+
*
42+
* @see {@link GetVirtualMachineCommandInput} for command's `input` shape.
43+
* @see {@link GetVirtualMachineCommandOutput} for command's `response` shape.
44+
* @see {@link BackupGatewayClientResolvedConfig | config} for BackupGatewayClient's `config` shape.
45+
*
46+
*/
47+
export class GetVirtualMachineCommand extends $Command<
48+
GetVirtualMachineCommandInput,
49+
GetVirtualMachineCommandOutput,
50+
BackupGatewayClientResolvedConfig
51+
> {
52+
// Start section: command_properties
53+
// End section: command_properties
54+
55+
constructor(readonly input: GetVirtualMachineCommandInput) {
56+
// Start section: command_constructor
57+
super();
58+
// End section: command_constructor
59+
}
60+
61+
/**
62+
* @internal
63+
*/
64+
resolveMiddleware(
65+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
66+
configuration: BackupGatewayClientResolvedConfig,
67+
options?: __HttpHandlerOptions
68+
): Handler<GetVirtualMachineCommandInput, GetVirtualMachineCommandOutput> {
69+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
70+
71+
const stack = clientStack.concat(this.middlewareStack);
72+
73+
const { logger } = configuration;
74+
const clientName = "BackupGatewayClient";
75+
const commandName = "GetVirtualMachineCommand";
76+
const handlerExecutionContext: HandlerExecutionContext = {
77+
logger,
78+
clientName,
79+
commandName,
80+
inputFilterSensitiveLog: GetVirtualMachineInputFilterSensitiveLog,
81+
outputFilterSensitiveLog: GetVirtualMachineOutputFilterSensitiveLog,
82+
};
83+
const { requestHandler } = configuration;
84+
return stack.resolve(
85+
(request: FinalizeHandlerArguments<any>) =>
86+
requestHandler.handle(request.request as __HttpRequest, options || {}),
87+
handlerExecutionContext
88+
);
89+
}
90+
91+
private serialize(input: GetVirtualMachineCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
92+
return serializeAws_json1_0GetVirtualMachineCommand(input, context);
93+
}
94+
95+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetVirtualMachineCommandOutput> {
96+
return deserializeAws_json1_0GetVirtualMachineCommand(output, context);
97+
}
98+
99+
// Start section: command_body_extra
100+
// End section: command_body_extra
101+
}

clients/client-backup-gateway/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from "./DeleteGatewayCommand";
55
export * from "./DeleteHypervisorCommand";
66
export * from "./DisassociateGatewayFromServerCommand";
77
export * from "./GetGatewayCommand";
8+
export * from "./GetVirtualMachineCommand";
89
export * from "./ImportHypervisorConfigurationCommand";
910
export * from "./ListGatewaysCommand";
1011
export * from "./ListHypervisorsCommand";

0 commit comments

Comments
 (0)