Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update generated protocol tests
  • Loading branch information
kstich committed Dec 12, 2020
commit 3697457544fac312653bf8017815364bc17743c5
71 changes: 70 additions & 1 deletion protocol_tests/aws-ec2/EC2Protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ import {
SimpleScalarXmlPropertiesCommandOutput,
} from "./commands/SimpleScalarXmlPropertiesCommand";
import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand";
import {
XmlEmptyBlobsCommand,
XmlEmptyBlobsCommandInput,
XmlEmptyBlobsCommandOutput,
} from "./commands/XmlEmptyBlobsCommand";
import {
XmlEmptyListsCommand,
XmlEmptyListsCommandInput,
XmlEmptyListsCommandOutput,
} from "./commands/XmlEmptyListsCommand";
import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand";
import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand";
import {
Expand Down Expand Up @@ -454,6 +464,64 @@ export class EC2Protocol extends EC2ProtocolClient {
}
}

public xmlEmptyBlobs(
args: XmlEmptyBlobsCommandInput,
options?: __HttpHandlerOptions
): Promise<XmlEmptyBlobsCommandOutput>;
public xmlEmptyBlobs(
args: XmlEmptyBlobsCommandInput,
cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void
): void;
public xmlEmptyBlobs(
args: XmlEmptyBlobsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void
): void;
public xmlEmptyBlobs(
args: XmlEmptyBlobsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void),
cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void
): Promise<XmlEmptyBlobsCommandOutput> | void {
const command = new XmlEmptyBlobsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

public xmlEmptyLists(
args: XmlEmptyListsCommandInput,
options?: __HttpHandlerOptions
): Promise<XmlEmptyListsCommandOutput>;
public xmlEmptyLists(
args: XmlEmptyListsCommandInput,
cb: (err: any, data?: XmlEmptyListsCommandOutput) => void
): void;
public xmlEmptyLists(
args: XmlEmptyListsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: XmlEmptyListsCommandOutput) => void
): void;
public xmlEmptyLists(
args: XmlEmptyListsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void),
cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void
): Promise<XmlEmptyListsCommandOutput> | void {
const command = new XmlEmptyListsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* This example serializes enums as top level properties, in lists, sets, and maps.
*/
Expand Down Expand Up @@ -490,7 +558,8 @@ export class EC2Protocol extends EC2ProtocolClient {
* 4. XML lists with @xmlName on its members
* 5. Flattened XML lists.
* 6. Flattened XML lists with @xmlName.
* 7. Lists of structures.
* 7. Flattened XML lists with @xmlNamespace.
* 8. Lists of structures.
*/
public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise<XmlListsCommandOutput>;
public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void;
Expand Down
6 changes: 6 additions & 0 deletions protocol_tests/aws-ec2/EC2ProtocolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
SimpleScalarXmlPropertiesCommandOutput,
} from "./commands/SimpleScalarXmlPropertiesCommand";
import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand";
import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand";
import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand";
import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand";
import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand";
import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand";
Expand Down Expand Up @@ -88,6 +90,8 @@ export type ServiceInputTypes =
| SimpleInputParamsCommandInput
| SimpleScalarXmlPropertiesCommandInput
| XmlBlobsCommandInput
| XmlEmptyBlobsCommandInput
| XmlEmptyListsCommandInput
| XmlEnumsCommandInput
| XmlListsCommandInput
| XmlNamespacesCommandInput
Expand All @@ -106,6 +110,8 @@ export type ServiceOutputTypes =
| SimpleInputParamsCommandOutput
| SimpleScalarXmlPropertiesCommandOutput
| XmlBlobsCommandOutput
| XmlEmptyBlobsCommandOutput
| XmlEmptyListsCommandOutput
| XmlEnumsCommandOutput
| XmlListsCommandOutput
| XmlNamespacesCommandOutput
Expand Down
2 changes: 1 addition & 1 deletion protocol_tests/aws-ec2/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@aws-sdk/aws-ec2
# @aws-sdk/aws-ec2

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-ec2/rc.svg)](https://www.npmjs.com/package/@aws-sdk/aws-ec2)
[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-ec2.svg)](https://www.npmjs.com/package/@aws-sdk/aws-ec2)
Expand Down
82 changes: 82 additions & 0 deletions protocol_tests/aws-ec2/commands/XmlEmptyBlobsCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient";
import { XmlBlobsOutput } from "../models/models_0";
import { deserializeAws_ec2XmlEmptyBlobsCommand, serializeAws_ec2XmlEmptyBlobsCommand } from "../protocols/Aws_ec2";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
MiddlewareStack,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

export type XmlEmptyBlobsCommandInput = {};
export type XmlEmptyBlobsCommandOutput = XmlBlobsOutput & __MetadataBearer;

export class XmlEmptyBlobsCommand extends $Command<
XmlEmptyBlobsCommandInput,
XmlEmptyBlobsCommandOutput,
EC2ProtocolClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: XmlEmptyBlobsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: EC2ProtocolClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "EC2ProtocolClient";
const commandName = "XmlEmptyBlobsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (input: any) => input,
outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog,
};

if (typeof logger.info === "function") {
logger.info({
clientName,
commandName,
});
}

const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_ec2XmlEmptyBlobsCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<XmlEmptyBlobsCommandOutput> {
return deserializeAws_ec2XmlEmptyBlobsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
82 changes: 82 additions & 0 deletions protocol_tests/aws-ec2/commands/XmlEmptyListsCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient";
import { XmlListsOutput } from "../models/models_0";
import { deserializeAws_ec2XmlEmptyListsCommand, serializeAws_ec2XmlEmptyListsCommand } from "../protocols/Aws_ec2";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
MiddlewareStack,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

export type XmlEmptyListsCommandInput = {};
export type XmlEmptyListsCommandOutput = XmlListsOutput & __MetadataBearer;

export class XmlEmptyListsCommand extends $Command<
XmlEmptyListsCommandInput,
XmlEmptyListsCommandOutput,
EC2ProtocolClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: XmlEmptyListsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: EC2ProtocolClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "EC2ProtocolClient";
const commandName = "XmlEmptyListsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (input: any) => input,
outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog,
};

if (typeof logger.info === "function") {
logger.info({
clientName,
commandName,
});
}

const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_ec2XmlEmptyListsCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<XmlEmptyListsCommandOutput> {
return deserializeAws_ec2XmlEmptyListsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
3 changes: 2 additions & 1 deletion protocol_tests/aws-ec2/commands/XmlListsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export type XmlListsCommandOutput = XmlListsOutput & __MetadataBearer;
* 4. XML lists with @xmlName on its members
* 5. Flattened XML lists.
* 6. Flattened XML lists with @xmlName.
* 7. Lists of structures.
* 7. Flattened XML lists with @xmlNamespace.
* 8. Lists of structures.
*/
export class XmlListsCommand extends $Command<
XmlListsCommandInput,
Expand Down
2 changes: 2 additions & 0 deletions protocol_tests/aws-ec2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export * from "./commands/RecursiveXmlShapesCommand";
export * from "./commands/SimpleInputParamsCommand";
export * from "./commands/SimpleScalarXmlPropertiesCommand";
export * from "./commands/XmlBlobsCommand";
export * from "./commands/XmlEmptyBlobsCommand";
export * from "./commands/XmlEmptyListsCommand";
export * from "./commands/XmlEnumsCommand";
export * from "./commands/XmlListsCommand";
export * from "./commands/XmlNamespacesCommand";
Expand Down
40 changes: 24 additions & 16 deletions protocol_tests/aws-ec2/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ export namespace QueryTimestampsInput {
});
}

export type FooEnum = "0" | "1" | "Bar" | "Baz" | "Foo";
export enum FooEnum {
BAR = "Bar",
BAZ = "Baz",
FOO = "Foo",
ONE = "1",
ZERO = "0",
}

export interface SimpleInputParamsInput {
Foo?: string;
Expand Down Expand Up @@ -181,21 +187,6 @@ export namespace XmlBlobsOutput {
});
}

export interface XmlEnumsOutput {
fooEnum1?: FooEnum | string;
fooEnum2?: FooEnum | string;
fooEnum3?: FooEnum | string;
fooEnumList?: (FooEnum | string)[];
fooEnumSet?: (FooEnum | string)[];
fooEnumMap?: { [key: string]: FooEnum | string };
}

export namespace XmlEnumsOutput {
export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({
...obj,
});
}

export interface StructureListMember {
a?: string;
b?: string;
Expand All @@ -222,6 +213,8 @@ export interface XmlListsOutput {
renamedListMembers?: string[];
flattenedList?: string[];
flattenedList2?: string[];
flattenedListWithMemberNamespace?: string[];
flattenedListWithNamespace?: string[];
structureList?: StructureListMember[];
}

Expand All @@ -231,6 +224,21 @@ export namespace XmlListsOutput {
});
}

export interface XmlEnumsOutput {
fooEnum1?: FooEnum | string;
fooEnum2?: FooEnum | string;
fooEnum3?: FooEnum | string;
fooEnumList?: (FooEnum | string)[];
fooEnumSet?: (FooEnum | string)[];
fooEnumMap?: { [key: string]: FooEnum | string };
}

export namespace XmlEnumsOutput {
export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({
...obj,
});
}

export interface XmlNamespaceNested {
foo?: string;
values?: string[];
Expand Down
Loading