diff --git a/codegen/generic-client-test-codegen/build.gradle.kts b/codegen/generic-client-test-codegen/build.gradle.kts index 2440e1c79b95..40b5ae0d5b79 100644 --- a/codegen/generic-client-test-codegen/build.gradle.kts +++ b/codegen/generic-client-test-codegen/build.gradle.kts @@ -20,7 +20,7 @@ plugins { } dependencies { - implementation("software.amazon.smithy:smithy-aws-protocol-tests:[1.11.0, 1.12.0[") + implementation("software.amazon.smithy:smithy-aws-protocol-tests:[1.12.0, 1.13.0[") implementation(project(":smithy-aws-typescript-codegen")) } diff --git a/codegen/protocol-test-codegen/build.gradle.kts b/codegen/protocol-test-codegen/build.gradle.kts index b49a3890cfb9..5494ce3f51d0 100644 --- a/codegen/protocol-test-codegen/build.gradle.kts +++ b/codegen/protocol-test-codegen/build.gradle.kts @@ -20,7 +20,7 @@ plugins { } dependencies { - implementation("software.amazon.smithy:smithy-aws-protocol-tests:[1.11.0, 1.12.0[") + implementation("software.amazon.smithy:smithy-aws-protocol-tests:[1.12.0, 1.13.0[") implementation(project(":smithy-aws-typescript-codegen")) } diff --git a/codegen/sdk-codegen/build.gradle.kts b/codegen/sdk-codegen/build.gradle.kts index 6ba6fbe1d186..924e3e6acb8d 100644 --- a/codegen/sdk-codegen/build.gradle.kts +++ b/codegen/sdk-codegen/build.gradle.kts @@ -21,8 +21,11 @@ import software.amazon.smithy.aws.traits.ServiceTrait import kotlin.streams.toList buildscript { + repositories { + mavenCentral() + } dependencies { - "classpath"("software.amazon.smithy:smithy-aws-traits:[1.11.0,1.12.0[") + "classpath"("software.amazon.smithy:smithy-aws-traits:[1.12.0,1.13.0[") } } diff --git a/codegen/smithy-aws-typescript-codegen/build.gradle.kts b/codegen/smithy-aws-typescript-codegen/build.gradle.kts index df6633e25b95..718526b3f9e0 100644 --- a/codegen/smithy-aws-typescript-codegen/build.gradle.kts +++ b/codegen/smithy-aws-typescript-codegen/build.gradle.kts @@ -25,16 +25,16 @@ buildscript { mavenCentral() } dependencies { - classpath("software.amazon.smithy:smithy-model:[1.11.0, 1.12.0[") + classpath("software.amazon.smithy:smithy-model:[1.12.0, 1.13.0[") } } dependencies { - api("software.amazon.smithy:smithy-aws-cloudformation-traits:[1.11.0, 1.12.0[") - api("software.amazon.smithy:smithy-aws-traits:[1.11.0, 1.12.0[") - api("software.amazon.smithy:smithy-waiters:[1.11.0, 1.12.0[") - api("software.amazon.smithy:smithy-aws-iam-traits:[1.11.0, 1.12.0[") - api("software.amazon.smithy:smithy-protocol-test-traits:[1.11.0, 1.12.0[") + api("software.amazon.smithy:smithy-aws-cloudformation-traits:[1.12.0, 1.13.0[") + api("software.amazon.smithy:smithy-aws-traits:[1.12.0, 1.13.0[") + api("software.amazon.smithy:smithy-waiters:[1.12.0, 1.13.0[") + api("software.amazon.smithy:smithy-aws-iam-traits:[1.12.0, 1.13.0[") + api("software.amazon.smithy:smithy-protocol-test-traits:[1.12.0, 1.13.0[") api("software.amazon.smithy.typescript:smithy-typescript-codegen:0.6.0") } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java index 20d0d2233f25..ec2bed029dba 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java @@ -327,11 +327,6 @@ private static boolean filterMalformedRequestTests( return true; } - //TODO: Fixed after Smithy 1.11.0 - if (testCase.getId().equals("RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case14")) { - return true; - } - return false; } } diff --git a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AwsServiceIdIntegrationTest.java b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AwsServiceIdIntegrationTest.java index 5910c47f9bcf..567c4fc2ec9c 100644 --- a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AwsServiceIdIntegrationTest.java +++ b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AwsServiceIdIntegrationTest.java @@ -27,6 +27,7 @@ public void testSomeLibraryMethod() { Shape service = model.expectShape((ShapeId.from("smithy.example#OriginalName"))); AwsServiceIdIntegration integration = new AwsServiceIdIntegration(); TypeScriptSettings settings = new TypeScriptSettings(); + settings.setService(ShapeId.from("smithy.example#OriginalName")); SymbolProvider provider = TypeScriptCodegenPlugin.createSymbolProvider(model, settings); SymbolProvider decorated = integration.decorateSymbolProvider(settings, model, provider); Symbol symbol = decorated.toSymbol(service); diff --git a/protocol_tests/aws-ec2/src/EC2Protocol.ts b/protocol_tests/aws-ec2/src/EC2Protocol.ts index d229f3f27e25..786316886587 100644 --- a/protocol_tests/aws-ec2/src/EC2Protocol.ts +++ b/protocol_tests/aws-ec2/src/EC2Protocol.ts @@ -20,6 +20,11 @@ import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput, } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommand, IgnoresWrappingXmlNameCommandInput, @@ -219,6 +224,35 @@ export class EC2Protocol extends EC2ProtocolClient { } } + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HostWithPathOperationCommandOutput) => void), + cb?: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): Promise | void { + const command = new HostWithPathOperationCommand(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); + } + } + /** * The xmlName trait on the output structure is ignored in AWS Query. * diff --git a/protocol_tests/aws-ec2/src/EC2ProtocolClient.ts b/protocol_tests/aws-ec2/src/EC2ProtocolClient.ts index 4223b102a6c0..85e7dacae8b0 100644 --- a/protocol_tests/aws-ec2/src/EC2ProtocolClient.ts +++ b/protocol_tests/aws-ec2/src/EC2ProtocolClient.ts @@ -52,6 +52,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "./commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommandInput, IgnoresWrappingXmlNameCommandOutput, @@ -84,6 +88,7 @@ export type ServiceInputTypes = | EndpointOperationCommandInput | EndpointWithHostLabelOperationCommandInput | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput | IgnoresWrappingXmlNameCommandInput | NestedStructuresCommandInput | NoInputAndOutputCommandInput @@ -106,6 +111,7 @@ export type ServiceOutputTypes = | EndpointOperationCommandOutput | EndpointWithHostLabelOperationCommandOutput | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput | IgnoresWrappingXmlNameCommandOutput | NestedStructuresCommandOutput | NoInputAndOutputCommandOutput diff --git a/protocol_tests/aws-ec2/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-ec2/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..ee85445b638f --- /dev/null +++ b/protocol_tests/aws-ec2/src/commands/HostWithPathOperationCommand.ts @@ -0,0 +1,77 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient"; +import { + deserializeAws_ec2HostWithPathOperationCommand, + serializeAws_ec2HostWithPathOperationCommand, +} from "../protocols/Aws_ec2"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HostWithPathOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: EC2ProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "EC2ProtocolClient"; + const commandName = "HostWithPathOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HostWithPathOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2HostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2HostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-ec2/src/index.ts b/protocol_tests/aws-ec2/src/index.ts index 97bfc9f8fa82..730ab38e64dc 100644 --- a/protocol_tests/aws-ec2/src/index.ts +++ b/protocol_tests/aws-ec2/src/index.ts @@ -4,6 +4,7 @@ export * from "./commands/EmptyInputAndEmptyOutputCommand"; export * from "./commands/EndpointOperationCommand"; export * from "./commands/EndpointWithHostLabelOperationCommand"; export * from "./commands/GreetingWithErrorsCommand"; +export * from "./commands/HostWithPathOperationCommand"; export * from "./commands/IgnoresWrappingXmlNameCommand"; export * from "./commands/NestedStructuresCommand"; export * from "./commands/NoInputAndOutputCommand"; diff --git a/protocol_tests/aws-ec2/src/protocols/Aws_ec2.ts b/protocol_tests/aws-ec2/src/protocols/Aws_ec2.ts index 12a449552e0b..53711d9be60b 100644 --- a/protocol_tests/aws-ec2/src/protocols/Aws_ec2.ts +++ b/protocol_tests/aws-ec2/src/protocols/Aws_ec2.ts @@ -42,6 +42,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "../commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommandInput, IgnoresWrappingXmlNameCommandOutput, @@ -177,6 +181,20 @@ export const serializeAws_ec2GreetingWithErrorsCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +export const serializeAws_ec2HostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "HostWithPathOperation", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + export const serializeAws_ec2IgnoresWrappingXmlNameCommand = async ( input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext @@ -605,6 +623,49 @@ const deserializeAws_ec2GreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; +export const deserializeAws_ec2HostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2HostWithPathOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2HostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadEc2ErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.Errors.Error.code || parsedBody.Errors.Error.Code || errorCode; + response = { + ...parsedBody.Errors.Error, + name: `${errorCode}`, + message: parsedBody.Errors.Error.message || parsedBody.Errors.Error.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + export const deserializeAws_ec2IgnoresWrappingXmlNameCommand = async ( output: __HttpResponse, context: __SerdeContext diff --git a/protocol_tests/aws-ec2/test/functional/ec2query.spec.ts b/protocol_tests/aws-ec2/test/functional/ec2query.spec.ts index 202c6a69905c..ae49d2885cf8 100644 --- a/protocol_tests/aws-ec2/test/functional/ec2query.spec.ts +++ b/protocol_tests/aws-ec2/test/functional/ec2query.spec.ts @@ -1,4 +1,5 @@ import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; +import { Encoder as __Encoder } from "@aws-sdk/types"; import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; import { Readable } from "stream"; @@ -6,6 +7,7 @@ import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAn import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; +import { HostWithPathOperationCommand } from "../../src/commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommand } from "../../src/commands/IgnoresWrappingXmlNameCommand"; import { NestedStructuresCommand } from "../../src/commands/NestedStructuresCommand"; import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; @@ -444,6 +446,38 @@ it("Ec2ComplexError:Error:GreetingWithErrors", async () => { fail("Expected an exception to be thrown from response"); }); +/** + * Custom endpoints supplied by users can have paths + */ +it("Ec2QueryHostWithPath:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + endpoint: "https://example.com/custom", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HostWithPathOperationCommand({}); + try { + await client.send(command); + fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown"); + return; + } catch (err) { + if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) { + fail(err); + return; + } + const r = err.request; + expect(r.method).toBe("POST"); + expect(r.path).toBe("/custom/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=HostWithPathOperation&Version=2020-01-08`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + /** * The xmlName trait on the output structure is ignored in the ec2 protocol */ @@ -2291,3 +2325,20 @@ const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBo return compareParts(expectedParts, generatedParts); }; + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentUnknownTypeBodies = ( + utf8Encoder: __Encoder, + expectedBody: string, + generatedBody: string | Uint8Array +): Object => { + const expectedParts = { Value: expectedBody }; + const generatedParts = { + Value: generatedBody instanceof Uint8Array ? utf8Encoder(generatedBody) : generatedBody, + }; + + return compareParts(expectedParts, generatedParts); +}; diff --git a/protocol_tests/aws-json-10/src/JSONRPC10.ts b/protocol_tests/aws-json-10/src/JSONRPC10.ts index 0ef629f5e072..f391f3a6375d 100644 --- a/protocol_tests/aws-json-10/src/JSONRPC10.ts +++ b/protocol_tests/aws-json-10/src/JSONRPC10.ts @@ -20,6 +20,11 @@ import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput, } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { JsonUnionsCommand, JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; import { NoInputAndNoOutputCommand, @@ -171,6 +176,35 @@ export class JSONRPC10 extends JSONRPC10Client { } } + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HostWithPathOperationCommandOutput) => void), + cb?: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): Promise | void { + const command = new HostWithPathOperationCommand(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 operation uses unions for inputs and outputs. */ diff --git a/protocol_tests/aws-json-10/src/JSONRPC10Client.ts b/protocol_tests/aws-json-10/src/JSONRPC10Client.ts index 75ea79e82f5d..439cac743957 100644 --- a/protocol_tests/aws-json-10/src/JSONRPC10Client.ts +++ b/protocol_tests/aws-json-10/src/JSONRPC10Client.ts @@ -52,6 +52,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "./commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; @@ -66,6 +70,7 @@ export type ServiceInputTypes = | EndpointOperationCommandInput | EndpointWithHostLabelOperationCommandInput | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput | JsonUnionsCommandInput | NoInputAndNoOutputCommandInput | NoInputAndOutputCommandInput @@ -76,6 +81,7 @@ export type ServiceOutputTypes = | EndpointOperationCommandOutput | EndpointWithHostLabelOperationCommandOutput | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput | JsonUnionsCommandOutput | NoInputAndNoOutputCommandOutput | NoInputAndOutputCommandOutput diff --git a/protocol_tests/aws-json-10/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-json-10/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..9b0f527cacdb --- /dev/null +++ b/protocol_tests/aws-json-10/src/commands/HostWithPathOperationCommand.ts @@ -0,0 +1,77 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { JSONRPC10ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JSONRPC10Client"; +import { + deserializeAws_json1_0HostWithPathOperationCommand, + serializeAws_json1_0HostWithPathOperationCommand, +} from "../protocols/Aws_json1_0"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HostWithPathOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: JSONRPC10ClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "JSONRPC10Client"; + const commandName = "HostWithPathOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HostWithPathOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0HostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0HostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-json-10/src/index.ts b/protocol_tests/aws-json-10/src/index.ts index 2ea78bb1e50e..55b7cec91a21 100644 --- a/protocol_tests/aws-json-10/src/index.ts +++ b/protocol_tests/aws-json-10/src/index.ts @@ -4,6 +4,7 @@ export * from "./commands/EmptyInputAndEmptyOutputCommand"; export * from "./commands/EndpointOperationCommand"; export * from "./commands/EndpointWithHostLabelOperationCommand"; export * from "./commands/GreetingWithErrorsCommand"; +export * from "./commands/HostWithPathOperationCommand"; export * from "./commands/JsonUnionsCommand"; export * from "./commands/NoInputAndNoOutputCommand"; export * from "./commands/NoInputAndOutputCommand"; diff --git a/protocol_tests/aws-json-10/src/protocols/Aws_json1_0.ts b/protocol_tests/aws-json-10/src/protocols/Aws_json1_0.ts index 56d15aa62c5d..07e9cd3c78cc 100644 --- a/protocol_tests/aws-json-10/src/protocols/Aws_json1_0.ts +++ b/protocol_tests/aws-json-10/src/protocols/Aws_json1_0.ts @@ -35,6 +35,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "../commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "../commands/JsonUnionsCommand"; import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; @@ -125,6 +129,18 @@ export const serializeAws_json1_0GreetingWithErrorsCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +export const serializeAws_json1_0HostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.HostWithPathOperation", + }; + const body = "{}"; + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + export const serializeAws_json1_0JsonUnionsCommand = async ( input: JsonUnionsCommandInput, context: __SerdeContext @@ -377,6 +393,49 @@ const deserializeAws_json1_0GreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; +export const deserializeAws_json1_0HostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0HostWithPathOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0HostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + export const deserializeAws_json1_0JsonUnionsCommand = async ( output: __HttpResponse, context: __SerdeContext diff --git a/protocol_tests/aws-json-10/test/functional/awsjson1_0.spec.ts b/protocol_tests/aws-json-10/test/functional/awsjson1_0.spec.ts index af9d78135e8d..e30cc0e3d46c 100644 --- a/protocol_tests/aws-json-10/test/functional/awsjson1_0.spec.ts +++ b/protocol_tests/aws-json-10/test/functional/awsjson1_0.spec.ts @@ -7,6 +7,7 @@ import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAn import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; +import { HostWithPathOperationCommand } from "../../src/commands/HostWithPathOperationCommand"; import { JsonUnionsCommand } from "../../src/commands/JsonUnionsCommand"; import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; @@ -719,6 +720,38 @@ it("AwsJson10EmptyComplexError:Error:GreetingWithErrors", async () => { fail("Expected an exception to be thrown from response"); }); +/** + * Custom endpoints supplied by users can have paths + */ +it("AwsJson10HostWithPath:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + endpoint: "https://example.com/custom", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HostWithPathOperationCommand({}); + try { + await client.send(command); + fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown"); + return; + } catch (err) { + if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) { + fail(err); + return; + } + const r = err.request; + expect(r.method).toBe("POST"); + expect(r.path).toBe("/custom/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + /** * Serializes a string union value */ diff --git a/protocol_tests/aws-json/src/JsonProtocol.ts b/protocol_tests/aws-json/src/JsonProtocol.ts index 4160b91a2a96..3cdf050776b4 100644 --- a/protocol_tests/aws-json/src/JsonProtocol.ts +++ b/protocol_tests/aws-json/src/JsonProtocol.ts @@ -20,6 +20,11 @@ import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput, } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { JsonEnumsCommand, JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; import { JsonUnionsCommand, JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; import { @@ -176,6 +181,35 @@ export class JsonProtocol extends JsonProtocolClient { } } + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HostWithPathOperationCommandOutput) => void), + cb?: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): Promise | void { + const command = new HostWithPathOperationCommand(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. */ diff --git a/protocol_tests/aws-json/src/JsonProtocolClient.ts b/protocol_tests/aws-json/src/JsonProtocolClient.ts index c114d39a81bf..373b4829272a 100644 --- a/protocol_tests/aws-json/src/JsonProtocolClient.ts +++ b/protocol_tests/aws-json/src/JsonProtocolClient.ts @@ -56,6 +56,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "./commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; import { @@ -82,6 +86,7 @@ export type ServiceInputTypes = | EndpointOperationCommandInput | EndpointWithHostLabelOperationCommandInput | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput | JsonEnumsCommandInput | JsonUnionsCommandInput | KitchenSinkOperationCommandInput @@ -95,6 +100,7 @@ export type ServiceOutputTypes = | EndpointOperationCommandOutput | EndpointWithHostLabelOperationCommandOutput | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput | JsonEnumsCommandOutput | JsonUnionsCommandOutput | KitchenSinkOperationCommandOutput diff --git a/protocol_tests/aws-json/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-json/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..6851697eb662 --- /dev/null +++ b/protocol_tests/aws-json/src/commands/HostWithPathOperationCommand.ts @@ -0,0 +1,77 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { + deserializeAws_json1_1HostWithPathOperationCommand, + serializeAws_json1_1HostWithPathOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HostWithPathOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: JsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "JsonProtocolClient"; + const commandName = "HostWithPathOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HostWithPathOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1HostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1HostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-json/src/index.ts b/protocol_tests/aws-json/src/index.ts index e71caa814dff..868d450cd6f2 100644 --- a/protocol_tests/aws-json/src/index.ts +++ b/protocol_tests/aws-json/src/index.ts @@ -4,6 +4,7 @@ export * from "./commands/EmptyOperationCommand"; export * from "./commands/EndpointOperationCommand"; export * from "./commands/EndpointWithHostLabelOperationCommand"; export * from "./commands/GreetingWithErrorsCommand"; +export * from "./commands/HostWithPathOperationCommand"; export * from "./commands/JsonEnumsCommand"; export * from "./commands/JsonUnionsCommand"; export * from "./commands/KitchenSinkOperationCommand"; diff --git a/protocol_tests/aws-json/src/protocols/Aws_json1_1.ts b/protocol_tests/aws-json/src/protocols/Aws_json1_1.ts index db2eb96a3a5d..a8571c0ef28b 100644 --- a/protocol_tests/aws-json/src/protocols/Aws_json1_1.ts +++ b/protocol_tests/aws-json/src/protocols/Aws_json1_1.ts @@ -38,6 +38,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "../commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "../commands/JsonEnumsCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "../commands/JsonUnionsCommand"; import { @@ -147,6 +151,18 @@ export const serializeAws_json1_1GreetingWithErrorsCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +export const serializeAws_json1_1HostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.HostWithPathOperation", + }; + const body = "{}"; + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + export const serializeAws_json1_1JsonEnumsCommand = async ( input: JsonEnumsCommandInput, context: __SerdeContext @@ -437,6 +453,49 @@ const deserializeAws_json1_1GreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; +export const deserializeAws_json1_1HostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1HostWithPathOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1HostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + export const deserializeAws_json1_1JsonEnumsCommand = async ( output: __HttpResponse, context: __SerdeContext diff --git a/protocol_tests/aws-json/test/functional/awsjson1_1.spec.ts b/protocol_tests/aws-json/test/functional/awsjson1_1.spec.ts index 4dde12904a9b..c51dbdbd35c3 100644 --- a/protocol_tests/aws-json/test/functional/awsjson1_1.spec.ts +++ b/protocol_tests/aws-json/test/functional/awsjson1_1.spec.ts @@ -7,6 +7,7 @@ import { EmptyOperationCommand } from "../../src/commands/EmptyOperationCommand" import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; +import { HostWithPathOperationCommand } from "../../src/commands/HostWithPathOperationCommand"; import { JsonEnumsCommand } from "../../src/commands/JsonEnumsCommand"; import { JsonUnionsCommand } from "../../src/commands/JsonUnionsCommand"; import { KitchenSinkOperationCommand } from "../../src/commands/KitchenSinkOperationCommand"; @@ -847,6 +848,38 @@ it("AwsJson11FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as fail("Expected an exception to be thrown from response"); }); +/** + * Custom endpoints supplied by users can have paths + */ +it("AwsJson11HostWithPath:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com/custom", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HostWithPathOperationCommand({}); + try { + await client.send(command); + fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown"); + return; + } catch (err) { + if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) { + fail(err); + return; + } + const r = err.request; + expect(r.method).toBe("POST"); + expect(r.path).toBe("/custom/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + /** * Serializes simple scalar properties */ diff --git a/protocol_tests/aws-query/src/QueryProtocol.ts b/protocol_tests/aws-query/src/QueryProtocol.ts index 385160d7d302..e5b416d9e6aa 100644 --- a/protocol_tests/aws-query/src/QueryProtocol.ts +++ b/protocol_tests/aws-query/src/QueryProtocol.ts @@ -35,6 +35,11 @@ import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput, } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommand, IgnoresWrappingXmlNameCommandInput, @@ -347,6 +352,35 @@ export class QueryProtocol extends QueryProtocolClient { } } + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HostWithPathOperationCommandOutput) => void), + cb?: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): Promise | void { + const command = new HostWithPathOperationCommand(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); + } + } + /** * The xmlName trait on the output structure is ignored in AWS Query. * diff --git a/protocol_tests/aws-query/src/QueryProtocolClient.ts b/protocol_tests/aws-query/src/QueryProtocolClient.ts index f320a0341fa9..11b2e19a4359 100644 --- a/protocol_tests/aws-query/src/QueryProtocolClient.ts +++ b/protocol_tests/aws-query/src/QueryProtocolClient.ts @@ -61,6 +61,10 @@ import { FlattenedXmlMapWithXmlNamespaceCommandOutput, } from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommandInput, IgnoresWrappingXmlNameCommandOutput, @@ -101,6 +105,7 @@ export type ServiceInputTypes = | FlattenedXmlMapWithXmlNameCommandInput | FlattenedXmlMapWithXmlNamespaceCommandInput | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput | IgnoresWrappingXmlNameCommandInput | NestedStructuresCommandInput | NoInputAndNoOutputCommandInput @@ -131,6 +136,7 @@ export type ServiceOutputTypes = | FlattenedXmlMapWithXmlNameCommandOutput | FlattenedXmlMapWithXmlNamespaceCommandOutput | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput | IgnoresWrappingXmlNameCommandOutput | NestedStructuresCommandOutput | NoInputAndNoOutputCommandOutput diff --git a/protocol_tests/aws-query/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-query/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..b6ba334dc844 --- /dev/null +++ b/protocol_tests/aws-query/src/commands/HostWithPathOperationCommand.ts @@ -0,0 +1,77 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { + deserializeAws_queryHostWithPathOperationCommand, + serializeAws_queryHostWithPathOperationCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HostWithPathOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: QueryProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "QueryProtocolClient"; + const commandName = "HostWithPathOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HostWithPathOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryHostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryHostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-query/src/index.ts b/protocol_tests/aws-query/src/index.ts index 6cdf4b5bda3a..af9d3b4a81b1 100644 --- a/protocol_tests/aws-query/src/index.ts +++ b/protocol_tests/aws-query/src/index.ts @@ -7,6 +7,7 @@ export * from "./commands/FlattenedXmlMapCommand"; export * from "./commands/FlattenedXmlMapWithXmlNameCommand"; export * from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; export * from "./commands/GreetingWithErrorsCommand"; +export * from "./commands/HostWithPathOperationCommand"; export * from "./commands/IgnoresWrappingXmlNameCommand"; export * from "./commands/NestedStructuresCommand"; export * from "./commands/NoInputAndNoOutputCommand"; diff --git a/protocol_tests/aws-query/src/protocols/Aws_query.ts b/protocol_tests/aws-query/src/protocols/Aws_query.ts index 2cd9ede10853..55162a910471 100644 --- a/protocol_tests/aws-query/src/protocols/Aws_query.ts +++ b/protocol_tests/aws-query/src/protocols/Aws_query.ts @@ -51,6 +51,10 @@ import { FlattenedXmlMapWithXmlNamespaceCommandOutput, } from "../commands/FlattenedXmlMapWithXmlNamespaceCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommandInput, IgnoresWrappingXmlNameCommandOutput, @@ -241,6 +245,20 @@ export const serializeAws_queryGreetingWithErrorsCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +export const serializeAws_queryHostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "HostWithPathOperation", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + export const serializeAws_queryIgnoresWrappingXmlNameCommand = async ( input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext @@ -892,6 +910,49 @@ const deserializeAws_queryGreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; +export const deserializeAws_queryHostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryHostWithPathOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryHostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadQueryErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode; + response = { + ...parsedBody.Error, + name: `${errorCode}`, + message: parsedBody.Error.message || parsedBody.Error.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + export const deserializeAws_queryIgnoresWrappingXmlNameCommand = async ( output: __HttpResponse, context: __SerdeContext diff --git a/protocol_tests/aws-query/test/functional/awsquery.spec.ts b/protocol_tests/aws-query/test/functional/awsquery.spec.ts index 25e7a3f76305..661bd311f114 100644 --- a/protocol_tests/aws-query/test/functional/awsquery.spec.ts +++ b/protocol_tests/aws-query/test/functional/awsquery.spec.ts @@ -1,4 +1,5 @@ import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; +import { Encoder as __Encoder } from "@aws-sdk/types"; import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; import { Readable } from "stream"; @@ -9,6 +10,7 @@ import { FlattenedXmlMapCommand } from "../../src/commands/FlattenedXmlMapComman import { FlattenedXmlMapWithXmlNameCommand } from "../../src/commands/FlattenedXmlMapWithXmlNameCommand"; import { FlattenedXmlMapWithXmlNamespaceCommand } from "../../src/commands/FlattenedXmlMapWithXmlNamespaceCommand"; import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; +import { HostWithPathOperationCommand } from "../../src/commands/HostWithPathOperationCommand"; import { IgnoresWrappingXmlNameCommand } from "../../src/commands/IgnoresWrappingXmlNameCommand"; import { NestedStructuresCommand } from "../../src/commands/NestedStructuresCommand"; import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; @@ -650,6 +652,38 @@ it("QueryComplexError:Error:GreetingWithErrors", async () => { fail("Expected an exception to be thrown from response"); }); +/** + * Custom endpoints supplied by users can have paths + */ +it("QueryHostWithPath:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + endpoint: "https://example.com/custom", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HostWithPathOperationCommand({}); + try { + await client.send(command); + fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown"); + return; + } catch (err) { + if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) { + fail(err); + return; + } + const r = err.request; + expect(r.method).toBe("POST"); + expect(r.path).toBe("/custom/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=HostWithPathOperation&Version=2020-01-08`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + /** * The xmlName trait on the output structure is ignored in AWS Query */ @@ -3064,3 +3098,20 @@ const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBo return compareParts(expectedParts, generatedParts); }; + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentUnknownTypeBodies = ( + utf8Encoder: __Encoder, + expectedBody: string, + generatedBody: string | Uint8Array +): Object => { + const expectedParts = { Value: expectedBody }; + const generatedParts = { + Value: generatedBody instanceof Uint8Array ? utf8Encoder(generatedBody) : generatedBody, + }; + + return compareParts(expectedParts, generatedParts); +}; diff --git a/protocol_tests/aws-restjson/src/RestJsonProtocol.ts b/protocol_tests/aws-restjson/src/RestJsonProtocol.ts index 521bc004e871..d1dbf27965a8 100644 --- a/protocol_tests/aws-restjson/src/RestJsonProtocol.ts +++ b/protocol_tests/aws-restjson/src/RestJsonProtocol.ts @@ -135,6 +135,171 @@ import { JsonTimestampsCommandOutput, } from "./commands/JsonTimestampsCommand"; import { JsonUnionsCommand, JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; +import { + MalformedAcceptWithBodyCommand, + MalformedAcceptWithBodyCommandInput, + MalformedAcceptWithBodyCommandOutput, +} from "./commands/MalformedAcceptWithBodyCommand"; +import { + MalformedAcceptWithGenericStringCommand, + MalformedAcceptWithGenericStringCommandInput, + MalformedAcceptWithGenericStringCommandOutput, +} from "./commands/MalformedAcceptWithGenericStringCommand"; +import { + MalformedAcceptWithPayloadCommand, + MalformedAcceptWithPayloadCommandInput, + MalformedAcceptWithPayloadCommandOutput, +} from "./commands/MalformedAcceptWithPayloadCommand"; +import { + MalformedBlobCommand, + MalformedBlobCommandInput, + MalformedBlobCommandOutput, +} from "./commands/MalformedBlobCommand"; +import { + MalformedBooleanCommand, + MalformedBooleanCommandInput, + MalformedBooleanCommandOutput, +} from "./commands/MalformedBooleanCommand"; +import { + MalformedByteCommand, + MalformedByteCommandInput, + MalformedByteCommandOutput, +} from "./commands/MalformedByteCommand"; +import { + MalformedContentTypeWithBodyCommand, + MalformedContentTypeWithBodyCommandInput, + MalformedContentTypeWithBodyCommandOutput, +} from "./commands/MalformedContentTypeWithBodyCommand"; +import { + MalformedContentTypeWithGenericStringCommand, + MalformedContentTypeWithGenericStringCommandInput, + MalformedContentTypeWithGenericStringCommandOutput, +} from "./commands/MalformedContentTypeWithGenericStringCommand"; +import { + MalformedContentTypeWithoutBodyCommand, + MalformedContentTypeWithoutBodyCommandInput, + MalformedContentTypeWithoutBodyCommandOutput, +} from "./commands/MalformedContentTypeWithoutBodyCommand"; +import { + MalformedContentTypeWithPayloadCommand, + MalformedContentTypeWithPayloadCommandInput, + MalformedContentTypeWithPayloadCommandOutput, +} from "./commands/MalformedContentTypeWithPayloadCommand"; +import { + MalformedDoubleCommand, + MalformedDoubleCommandInput, + MalformedDoubleCommandOutput, +} from "./commands/MalformedDoubleCommand"; +import { + MalformedFloatCommand, + MalformedFloatCommandInput, + MalformedFloatCommandOutput, +} from "./commands/MalformedFloatCommand"; +import { + MalformedIntegerCommand, + MalformedIntegerCommandInput, + MalformedIntegerCommandOutput, +} from "./commands/MalformedIntegerCommand"; +import { + MalformedListCommand, + MalformedListCommandInput, + MalformedListCommandOutput, +} from "./commands/MalformedListCommand"; +import { + MalformedLongCommand, + MalformedLongCommandInput, + MalformedLongCommandOutput, +} from "./commands/MalformedLongCommand"; +import { + MalformedMapCommand, + MalformedMapCommandInput, + MalformedMapCommandOutput, +} from "./commands/MalformedMapCommand"; +import { + MalformedRequestBodyCommand, + MalformedRequestBodyCommandInput, + MalformedRequestBodyCommandOutput, +} from "./commands/MalformedRequestBodyCommand"; +import { + MalformedSetCommand, + MalformedSetCommandInput, + MalformedSetCommandOutput, +} from "./commands/MalformedSetCommand"; +import { + MalformedShortCommand, + MalformedShortCommandInput, + MalformedShortCommandOutput, +} from "./commands/MalformedShortCommand"; +import { + MalformedStringCommand, + MalformedStringCommandInput, + MalformedStringCommandOutput, +} from "./commands/MalformedStringCommand"; +import { + MalformedTimestampBodyDateTimeCommand, + MalformedTimestampBodyDateTimeCommandInput, + MalformedTimestampBodyDateTimeCommandOutput, +} from "./commands/MalformedTimestampBodyDateTimeCommand"; +import { + MalformedTimestampBodyDefaultCommand, + MalformedTimestampBodyDefaultCommandInput, + MalformedTimestampBodyDefaultCommandOutput, +} from "./commands/MalformedTimestampBodyDefaultCommand"; +import { + MalformedTimestampBodyHttpDateCommand, + MalformedTimestampBodyHttpDateCommandInput, + MalformedTimestampBodyHttpDateCommandOutput, +} from "./commands/MalformedTimestampBodyHttpDateCommand"; +import { + MalformedTimestampHeaderDateTimeCommand, + MalformedTimestampHeaderDateTimeCommandInput, + MalformedTimestampHeaderDateTimeCommandOutput, +} from "./commands/MalformedTimestampHeaderDateTimeCommand"; +import { + MalformedTimestampHeaderDefaultCommand, + MalformedTimestampHeaderDefaultCommandInput, + MalformedTimestampHeaderDefaultCommandOutput, +} from "./commands/MalformedTimestampHeaderDefaultCommand"; +import { + MalformedTimestampHeaderEpochCommand, + MalformedTimestampHeaderEpochCommandInput, + MalformedTimestampHeaderEpochCommandOutput, +} from "./commands/MalformedTimestampHeaderEpochCommand"; +import { + MalformedTimestampPathDefaultCommand, + MalformedTimestampPathDefaultCommandInput, + MalformedTimestampPathDefaultCommandOutput, +} from "./commands/MalformedTimestampPathDefaultCommand"; +import { + MalformedTimestampPathEpochCommand, + MalformedTimestampPathEpochCommandInput, + MalformedTimestampPathEpochCommandOutput, +} from "./commands/MalformedTimestampPathEpochCommand"; +import { + MalformedTimestampPathHttpDateCommand, + MalformedTimestampPathHttpDateCommandInput, + MalformedTimestampPathHttpDateCommandOutput, +} from "./commands/MalformedTimestampPathHttpDateCommand"; +import { + MalformedTimestampQueryDefaultCommand, + MalformedTimestampQueryDefaultCommandInput, + MalformedTimestampQueryDefaultCommandOutput, +} from "./commands/MalformedTimestampQueryDefaultCommand"; +import { + MalformedTimestampQueryEpochCommand, + MalformedTimestampQueryEpochCommandInput, + MalformedTimestampQueryEpochCommandOutput, +} from "./commands/MalformedTimestampQueryEpochCommand"; +import { + MalformedTimestampQueryHttpDateCommand, + MalformedTimestampQueryHttpDateCommandInput, + MalformedTimestampQueryHttpDateCommandOutput, +} from "./commands/MalformedTimestampQueryHttpDateCommand"; +import { + MalformedUnionCommand, + MalformedUnionCommandInput, + MalformedUnionCommandOutput, +} from "./commands/MalformedUnionCommand"; import { MediaTypeHeaderCommand, MediaTypeHeaderCommandInput, @@ -1190,6 +1355,959 @@ export class RestJsonProtocol extends RestJsonProtocolClient { } } + public malformedAcceptWithBody( + args: MalformedAcceptWithBodyCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedAcceptWithBody( + args: MalformedAcceptWithBodyCommandInput, + cb: (err: any, data?: MalformedAcceptWithBodyCommandOutput) => void + ): void; + public malformedAcceptWithBody( + args: MalformedAcceptWithBodyCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedAcceptWithBodyCommandOutput) => void + ): void; + public malformedAcceptWithBody( + args: MalformedAcceptWithBodyCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedAcceptWithBodyCommandOutput) => void), + cb?: (err: any, data?: MalformedAcceptWithBodyCommandOutput) => void + ): Promise | void { + const command = new MalformedAcceptWithBodyCommand(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 malformedAcceptWithGenericString( + args: MalformedAcceptWithGenericStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedAcceptWithGenericString( + args: MalformedAcceptWithGenericStringCommandInput, + cb: (err: any, data?: MalformedAcceptWithGenericStringCommandOutput) => void + ): void; + public malformedAcceptWithGenericString( + args: MalformedAcceptWithGenericStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedAcceptWithGenericStringCommandOutput) => void + ): void; + public malformedAcceptWithGenericString( + args: MalformedAcceptWithGenericStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedAcceptWithGenericStringCommandOutput) => void), + cb?: (err: any, data?: MalformedAcceptWithGenericStringCommandOutput) => void + ): Promise | void { + const command = new MalformedAcceptWithGenericStringCommand(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 malformedAcceptWithPayload( + args: MalformedAcceptWithPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedAcceptWithPayload( + args: MalformedAcceptWithPayloadCommandInput, + cb: (err: any, data?: MalformedAcceptWithPayloadCommandOutput) => void + ): void; + public malformedAcceptWithPayload( + args: MalformedAcceptWithPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedAcceptWithPayloadCommandOutput) => void + ): void; + public malformedAcceptWithPayload( + args: MalformedAcceptWithPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedAcceptWithPayloadCommandOutput) => void), + cb?: (err: any, data?: MalformedAcceptWithPayloadCommandOutput) => void + ): Promise | void { + const command = new MalformedAcceptWithPayloadCommand(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 malformedBlob( + args: MalformedBlobCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedBlob( + args: MalformedBlobCommandInput, + cb: (err: any, data?: MalformedBlobCommandOutput) => void + ): void; + public malformedBlob( + args: MalformedBlobCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedBlobCommandOutput) => void + ): void; + public malformedBlob( + args: MalformedBlobCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedBlobCommandOutput) => void), + cb?: (err: any, data?: MalformedBlobCommandOutput) => void + ): Promise | void { + const command = new MalformedBlobCommand(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 malformedBoolean( + args: MalformedBooleanCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedBoolean( + args: MalformedBooleanCommandInput, + cb: (err: any, data?: MalformedBooleanCommandOutput) => void + ): void; + public malformedBoolean( + args: MalformedBooleanCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedBooleanCommandOutput) => void + ): void; + public malformedBoolean( + args: MalformedBooleanCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedBooleanCommandOutput) => void), + cb?: (err: any, data?: MalformedBooleanCommandOutput) => void + ): Promise | void { + const command = new MalformedBooleanCommand(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 malformedByte( + args: MalformedByteCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedByte( + args: MalformedByteCommandInput, + cb: (err: any, data?: MalformedByteCommandOutput) => void + ): void; + public malformedByte( + args: MalformedByteCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedByteCommandOutput) => void + ): void; + public malformedByte( + args: MalformedByteCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedByteCommandOutput) => void), + cb?: (err: any, data?: MalformedByteCommandOutput) => void + ): Promise | void { + const command = new MalformedByteCommand(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 malformedContentTypeWithBody( + args: MalformedContentTypeWithBodyCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedContentTypeWithBody( + args: MalformedContentTypeWithBodyCommandInput, + cb: (err: any, data?: MalformedContentTypeWithBodyCommandOutput) => void + ): void; + public malformedContentTypeWithBody( + args: MalformedContentTypeWithBodyCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedContentTypeWithBodyCommandOutput) => void + ): void; + public malformedContentTypeWithBody( + args: MalformedContentTypeWithBodyCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedContentTypeWithBodyCommandOutput) => void), + cb?: (err: any, data?: MalformedContentTypeWithBodyCommandOutput) => void + ): Promise | void { + const command = new MalformedContentTypeWithBodyCommand(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 malformedContentTypeWithGenericString( + args: MalformedContentTypeWithGenericStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedContentTypeWithGenericString( + args: MalformedContentTypeWithGenericStringCommandInput, + cb: (err: any, data?: MalformedContentTypeWithGenericStringCommandOutput) => void + ): void; + public malformedContentTypeWithGenericString( + args: MalformedContentTypeWithGenericStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedContentTypeWithGenericStringCommandOutput) => void + ): void; + public malformedContentTypeWithGenericString( + args: MalformedContentTypeWithGenericStringCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: MalformedContentTypeWithGenericStringCommandOutput) => void), + cb?: (err: any, data?: MalformedContentTypeWithGenericStringCommandOutput) => void + ): Promise | void { + const command = new MalformedContentTypeWithGenericStringCommand(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 malformedContentTypeWithoutBody( + args: MalformedContentTypeWithoutBodyCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedContentTypeWithoutBody( + args: MalformedContentTypeWithoutBodyCommandInput, + cb: (err: any, data?: MalformedContentTypeWithoutBodyCommandOutput) => void + ): void; + public malformedContentTypeWithoutBody( + args: MalformedContentTypeWithoutBodyCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedContentTypeWithoutBodyCommandOutput) => void + ): void; + public malformedContentTypeWithoutBody( + args: MalformedContentTypeWithoutBodyCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedContentTypeWithoutBodyCommandOutput) => void), + cb?: (err: any, data?: MalformedContentTypeWithoutBodyCommandOutput) => void + ): Promise | void { + const command = new MalformedContentTypeWithoutBodyCommand(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 malformedContentTypeWithPayload( + args: MalformedContentTypeWithPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedContentTypeWithPayload( + args: MalformedContentTypeWithPayloadCommandInput, + cb: (err: any, data?: MalformedContentTypeWithPayloadCommandOutput) => void + ): void; + public malformedContentTypeWithPayload( + args: MalformedContentTypeWithPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedContentTypeWithPayloadCommandOutput) => void + ): void; + public malformedContentTypeWithPayload( + args: MalformedContentTypeWithPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedContentTypeWithPayloadCommandOutput) => void), + cb?: (err: any, data?: MalformedContentTypeWithPayloadCommandOutput) => void + ): Promise | void { + const command = new MalformedContentTypeWithPayloadCommand(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 malformedDouble( + args: MalformedDoubleCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedDouble( + args: MalformedDoubleCommandInput, + cb: (err: any, data?: MalformedDoubleCommandOutput) => void + ): void; + public malformedDouble( + args: MalformedDoubleCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedDoubleCommandOutput) => void + ): void; + public malformedDouble( + args: MalformedDoubleCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedDoubleCommandOutput) => void), + cb?: (err: any, data?: MalformedDoubleCommandOutput) => void + ): Promise | void { + const command = new MalformedDoubleCommand(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 malformedFloat( + args: MalformedFloatCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedFloat( + args: MalformedFloatCommandInput, + cb: (err: any, data?: MalformedFloatCommandOutput) => void + ): void; + public malformedFloat( + args: MalformedFloatCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedFloatCommandOutput) => void + ): void; + public malformedFloat( + args: MalformedFloatCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedFloatCommandOutput) => void), + cb?: (err: any, data?: MalformedFloatCommandOutput) => void + ): Promise | void { + const command = new MalformedFloatCommand(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 malformedInteger( + args: MalformedIntegerCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedInteger( + args: MalformedIntegerCommandInput, + cb: (err: any, data?: MalformedIntegerCommandOutput) => void + ): void; + public malformedInteger( + args: MalformedIntegerCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedIntegerCommandOutput) => void + ): void; + public malformedInteger( + args: MalformedIntegerCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedIntegerCommandOutput) => void), + cb?: (err: any, data?: MalformedIntegerCommandOutput) => void + ): Promise | void { + const command = new MalformedIntegerCommand(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 malformedList( + args: MalformedListCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedList( + args: MalformedListCommandInput, + cb: (err: any, data?: MalformedListCommandOutput) => void + ): void; + public malformedList( + args: MalformedListCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedListCommandOutput) => void + ): void; + public malformedList( + args: MalformedListCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedListCommandOutput) => void), + cb?: (err: any, data?: MalformedListCommandOutput) => void + ): Promise | void { + const command = new MalformedListCommand(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 malformedLong( + args: MalformedLongCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedLong( + args: MalformedLongCommandInput, + cb: (err: any, data?: MalformedLongCommandOutput) => void + ): void; + public malformedLong( + args: MalformedLongCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedLongCommandOutput) => void + ): void; + public malformedLong( + args: MalformedLongCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedLongCommandOutput) => void), + cb?: (err: any, data?: MalformedLongCommandOutput) => void + ): Promise | void { + const command = new MalformedLongCommand(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 malformedMap( + args: MalformedMapCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedMap(args: MalformedMapCommandInput, cb: (err: any, data?: MalformedMapCommandOutput) => void): void; + public malformedMap( + args: MalformedMapCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedMapCommandOutput) => void + ): void; + public malformedMap( + args: MalformedMapCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedMapCommandOutput) => void), + cb?: (err: any, data?: MalformedMapCommandOutput) => void + ): Promise | void { + const command = new MalformedMapCommand(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 malformedRequestBody( + args: MalformedRequestBodyCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedRequestBody( + args: MalformedRequestBodyCommandInput, + cb: (err: any, data?: MalformedRequestBodyCommandOutput) => void + ): void; + public malformedRequestBody( + args: MalformedRequestBodyCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedRequestBodyCommandOutput) => void + ): void; + public malformedRequestBody( + args: MalformedRequestBodyCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedRequestBodyCommandOutput) => void), + cb?: (err: any, data?: MalformedRequestBodyCommandOutput) => void + ): Promise | void { + const command = new MalformedRequestBodyCommand(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 malformedSet( + args: MalformedSetCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedSet(args: MalformedSetCommandInput, cb: (err: any, data?: MalformedSetCommandOutput) => void): void; + public malformedSet( + args: MalformedSetCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedSetCommandOutput) => void + ): void; + public malformedSet( + args: MalformedSetCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedSetCommandOutput) => void), + cb?: (err: any, data?: MalformedSetCommandOutput) => void + ): Promise | void { + const command = new MalformedSetCommand(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 malformedShort( + args: MalformedShortCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedShort( + args: MalformedShortCommandInput, + cb: (err: any, data?: MalformedShortCommandOutput) => void + ): void; + public malformedShort( + args: MalformedShortCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedShortCommandOutput) => void + ): void; + public malformedShort( + args: MalformedShortCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedShortCommandOutput) => void), + cb?: (err: any, data?: MalformedShortCommandOutput) => void + ): Promise | void { + const command = new MalformedShortCommand(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 malformedString( + args: MalformedStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedString( + args: MalformedStringCommandInput, + cb: (err: any, data?: MalformedStringCommandOutput) => void + ): void; + public malformedString( + args: MalformedStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedStringCommandOutput) => void + ): void; + public malformedString( + args: MalformedStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedStringCommandOutput) => void), + cb?: (err: any, data?: MalformedStringCommandOutput) => void + ): Promise | void { + const command = new MalformedStringCommand(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 malformedTimestampBodyDateTime( + args: MalformedTimestampBodyDateTimeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampBodyDateTime( + args: MalformedTimestampBodyDateTimeCommandInput, + cb: (err: any, data?: MalformedTimestampBodyDateTimeCommandOutput) => void + ): void; + public malformedTimestampBodyDateTime( + args: MalformedTimestampBodyDateTimeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampBodyDateTimeCommandOutput) => void + ): void; + public malformedTimestampBodyDateTime( + args: MalformedTimestampBodyDateTimeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampBodyDateTimeCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampBodyDateTimeCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampBodyDateTimeCommand(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 malformedTimestampBodyDefault( + args: MalformedTimestampBodyDefaultCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampBodyDefault( + args: MalformedTimestampBodyDefaultCommandInput, + cb: (err: any, data?: MalformedTimestampBodyDefaultCommandOutput) => void + ): void; + public malformedTimestampBodyDefault( + args: MalformedTimestampBodyDefaultCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampBodyDefaultCommandOutput) => void + ): void; + public malformedTimestampBodyDefault( + args: MalformedTimestampBodyDefaultCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampBodyDefaultCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampBodyDefaultCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampBodyDefaultCommand(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 malformedTimestampBodyHttpDate( + args: MalformedTimestampBodyHttpDateCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampBodyHttpDate( + args: MalformedTimestampBodyHttpDateCommandInput, + cb: (err: any, data?: MalformedTimestampBodyHttpDateCommandOutput) => void + ): void; + public malformedTimestampBodyHttpDate( + args: MalformedTimestampBodyHttpDateCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampBodyHttpDateCommandOutput) => void + ): void; + public malformedTimestampBodyHttpDate( + args: MalformedTimestampBodyHttpDateCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampBodyHttpDateCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampBodyHttpDateCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampBodyHttpDateCommand(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 malformedTimestampHeaderDateTime( + args: MalformedTimestampHeaderDateTimeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampHeaderDateTime( + args: MalformedTimestampHeaderDateTimeCommandInput, + cb: (err: any, data?: MalformedTimestampHeaderDateTimeCommandOutput) => void + ): void; + public malformedTimestampHeaderDateTime( + args: MalformedTimestampHeaderDateTimeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampHeaderDateTimeCommandOutput) => void + ): void; + public malformedTimestampHeaderDateTime( + args: MalformedTimestampHeaderDateTimeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampHeaderDateTimeCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampHeaderDateTimeCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampHeaderDateTimeCommand(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 malformedTimestampHeaderDefault( + args: MalformedTimestampHeaderDefaultCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampHeaderDefault( + args: MalformedTimestampHeaderDefaultCommandInput, + cb: (err: any, data?: MalformedTimestampHeaderDefaultCommandOutput) => void + ): void; + public malformedTimestampHeaderDefault( + args: MalformedTimestampHeaderDefaultCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampHeaderDefaultCommandOutput) => void + ): void; + public malformedTimestampHeaderDefault( + args: MalformedTimestampHeaderDefaultCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampHeaderDefaultCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampHeaderDefaultCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampHeaderDefaultCommand(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 malformedTimestampHeaderEpoch( + args: MalformedTimestampHeaderEpochCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampHeaderEpoch( + args: MalformedTimestampHeaderEpochCommandInput, + cb: (err: any, data?: MalformedTimestampHeaderEpochCommandOutput) => void + ): void; + public malformedTimestampHeaderEpoch( + args: MalformedTimestampHeaderEpochCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampHeaderEpochCommandOutput) => void + ): void; + public malformedTimestampHeaderEpoch( + args: MalformedTimestampHeaderEpochCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampHeaderEpochCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampHeaderEpochCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampHeaderEpochCommand(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 malformedTimestampPathDefault( + args: MalformedTimestampPathDefaultCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampPathDefault( + args: MalformedTimestampPathDefaultCommandInput, + cb: (err: any, data?: MalformedTimestampPathDefaultCommandOutput) => void + ): void; + public malformedTimestampPathDefault( + args: MalformedTimestampPathDefaultCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampPathDefaultCommandOutput) => void + ): void; + public malformedTimestampPathDefault( + args: MalformedTimestampPathDefaultCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampPathDefaultCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampPathDefaultCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampPathDefaultCommand(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 malformedTimestampPathEpoch( + args: MalformedTimestampPathEpochCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampPathEpoch( + args: MalformedTimestampPathEpochCommandInput, + cb: (err: any, data?: MalformedTimestampPathEpochCommandOutput) => void + ): void; + public malformedTimestampPathEpoch( + args: MalformedTimestampPathEpochCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampPathEpochCommandOutput) => void + ): void; + public malformedTimestampPathEpoch( + args: MalformedTimestampPathEpochCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampPathEpochCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampPathEpochCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampPathEpochCommand(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 malformedTimestampPathHttpDate( + args: MalformedTimestampPathHttpDateCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampPathHttpDate( + args: MalformedTimestampPathHttpDateCommandInput, + cb: (err: any, data?: MalformedTimestampPathHttpDateCommandOutput) => void + ): void; + public malformedTimestampPathHttpDate( + args: MalformedTimestampPathHttpDateCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampPathHttpDateCommandOutput) => void + ): void; + public malformedTimestampPathHttpDate( + args: MalformedTimestampPathHttpDateCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampPathHttpDateCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampPathHttpDateCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampPathHttpDateCommand(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 malformedTimestampQueryDefault( + args: MalformedTimestampQueryDefaultCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampQueryDefault( + args: MalformedTimestampQueryDefaultCommandInput, + cb: (err: any, data?: MalformedTimestampQueryDefaultCommandOutput) => void + ): void; + public malformedTimestampQueryDefault( + args: MalformedTimestampQueryDefaultCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampQueryDefaultCommandOutput) => void + ): void; + public malformedTimestampQueryDefault( + args: MalformedTimestampQueryDefaultCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampQueryDefaultCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampQueryDefaultCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampQueryDefaultCommand(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 malformedTimestampQueryEpoch( + args: MalformedTimestampQueryEpochCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampQueryEpoch( + args: MalformedTimestampQueryEpochCommandInput, + cb: (err: any, data?: MalformedTimestampQueryEpochCommandOutput) => void + ): void; + public malformedTimestampQueryEpoch( + args: MalformedTimestampQueryEpochCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampQueryEpochCommandOutput) => void + ): void; + public malformedTimestampQueryEpoch( + args: MalformedTimestampQueryEpochCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampQueryEpochCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampQueryEpochCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampQueryEpochCommand(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 malformedTimestampQueryHttpDate( + args: MalformedTimestampQueryHttpDateCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedTimestampQueryHttpDate( + args: MalformedTimestampQueryHttpDateCommandInput, + cb: (err: any, data?: MalformedTimestampQueryHttpDateCommandOutput) => void + ): void; + public malformedTimestampQueryHttpDate( + args: MalformedTimestampQueryHttpDateCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedTimestampQueryHttpDateCommandOutput) => void + ): void; + public malformedTimestampQueryHttpDate( + args: MalformedTimestampQueryHttpDateCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedTimestampQueryHttpDateCommandOutput) => void), + cb?: (err: any, data?: MalformedTimestampQueryHttpDateCommandOutput) => void + ): Promise | void { + const command = new MalformedTimestampQueryHttpDateCommand(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 malformedUnion( + args: MalformedUnionCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public malformedUnion( + args: MalformedUnionCommandInput, + cb: (err: any, data?: MalformedUnionCommandOutput) => void + ): void; + public malformedUnion( + args: MalformedUnionCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MalformedUnionCommandOutput) => void + ): void; + public malformedUnion( + args: MalformedUnionCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MalformedUnionCommandOutput) => void), + cb?: (err: any, data?: MalformedUnionCommandOutput) => void + ): Promise | void { + const command = new MalformedUnionCommand(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 ensures that mediaType strings are base64 encoded in headers. */ diff --git a/protocol_tests/aws-restjson/src/RestJsonProtocolClient.ts b/protocol_tests/aws-restjson/src/RestJsonProtocolClient.ts index 2fad3b738c81..c59738cacb33 100644 --- a/protocol_tests/aws-restjson/src/RestJsonProtocolClient.ts +++ b/protocol_tests/aws-restjson/src/RestJsonProtocolClient.ts @@ -126,6 +126,99 @@ import { JsonListsCommandInput, JsonListsCommandOutput } from "./commands/JsonLi import { JsonMapsCommandInput, JsonMapsCommandOutput } from "./commands/JsonMapsCommand"; import { JsonTimestampsCommandInput, JsonTimestampsCommandOutput } from "./commands/JsonTimestampsCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; +import { + MalformedAcceptWithBodyCommandInput, + MalformedAcceptWithBodyCommandOutput, +} from "./commands/MalformedAcceptWithBodyCommand"; +import { + MalformedAcceptWithGenericStringCommandInput, + MalformedAcceptWithGenericStringCommandOutput, +} from "./commands/MalformedAcceptWithGenericStringCommand"; +import { + MalformedAcceptWithPayloadCommandInput, + MalformedAcceptWithPayloadCommandOutput, +} from "./commands/MalformedAcceptWithPayloadCommand"; +import { MalformedBlobCommandInput, MalformedBlobCommandOutput } from "./commands/MalformedBlobCommand"; +import { MalformedBooleanCommandInput, MalformedBooleanCommandOutput } from "./commands/MalformedBooleanCommand"; +import { MalformedByteCommandInput, MalformedByteCommandOutput } from "./commands/MalformedByteCommand"; +import { + MalformedContentTypeWithBodyCommandInput, + MalformedContentTypeWithBodyCommandOutput, +} from "./commands/MalformedContentTypeWithBodyCommand"; +import { + MalformedContentTypeWithGenericStringCommandInput, + MalformedContentTypeWithGenericStringCommandOutput, +} from "./commands/MalformedContentTypeWithGenericStringCommand"; +import { + MalformedContentTypeWithoutBodyCommandInput, + MalformedContentTypeWithoutBodyCommandOutput, +} from "./commands/MalformedContentTypeWithoutBodyCommand"; +import { + MalformedContentTypeWithPayloadCommandInput, + MalformedContentTypeWithPayloadCommandOutput, +} from "./commands/MalformedContentTypeWithPayloadCommand"; +import { MalformedDoubleCommandInput, MalformedDoubleCommandOutput } from "./commands/MalformedDoubleCommand"; +import { MalformedFloatCommandInput, MalformedFloatCommandOutput } from "./commands/MalformedFloatCommand"; +import { MalformedIntegerCommandInput, MalformedIntegerCommandOutput } from "./commands/MalformedIntegerCommand"; +import { MalformedListCommandInput, MalformedListCommandOutput } from "./commands/MalformedListCommand"; +import { MalformedLongCommandInput, MalformedLongCommandOutput } from "./commands/MalformedLongCommand"; +import { MalformedMapCommandInput, MalformedMapCommandOutput } from "./commands/MalformedMapCommand"; +import { + MalformedRequestBodyCommandInput, + MalformedRequestBodyCommandOutput, +} from "./commands/MalformedRequestBodyCommand"; +import { MalformedSetCommandInput, MalformedSetCommandOutput } from "./commands/MalformedSetCommand"; +import { MalformedShortCommandInput, MalformedShortCommandOutput } from "./commands/MalformedShortCommand"; +import { MalformedStringCommandInput, MalformedStringCommandOutput } from "./commands/MalformedStringCommand"; +import { + MalformedTimestampBodyDateTimeCommandInput, + MalformedTimestampBodyDateTimeCommandOutput, +} from "./commands/MalformedTimestampBodyDateTimeCommand"; +import { + MalformedTimestampBodyDefaultCommandInput, + MalformedTimestampBodyDefaultCommandOutput, +} from "./commands/MalformedTimestampBodyDefaultCommand"; +import { + MalformedTimestampBodyHttpDateCommandInput, + MalformedTimestampBodyHttpDateCommandOutput, +} from "./commands/MalformedTimestampBodyHttpDateCommand"; +import { + MalformedTimestampHeaderDateTimeCommandInput, + MalformedTimestampHeaderDateTimeCommandOutput, +} from "./commands/MalformedTimestampHeaderDateTimeCommand"; +import { + MalformedTimestampHeaderDefaultCommandInput, + MalformedTimestampHeaderDefaultCommandOutput, +} from "./commands/MalformedTimestampHeaderDefaultCommand"; +import { + MalformedTimestampHeaderEpochCommandInput, + MalformedTimestampHeaderEpochCommandOutput, +} from "./commands/MalformedTimestampHeaderEpochCommand"; +import { + MalformedTimestampPathDefaultCommandInput, + MalformedTimestampPathDefaultCommandOutput, +} from "./commands/MalformedTimestampPathDefaultCommand"; +import { + MalformedTimestampPathEpochCommandInput, + MalformedTimestampPathEpochCommandOutput, +} from "./commands/MalformedTimestampPathEpochCommand"; +import { + MalformedTimestampPathHttpDateCommandInput, + MalformedTimestampPathHttpDateCommandOutput, +} from "./commands/MalformedTimestampPathHttpDateCommand"; +import { + MalformedTimestampQueryDefaultCommandInput, + MalformedTimestampQueryDefaultCommandOutput, +} from "./commands/MalformedTimestampQueryDefaultCommand"; +import { + MalformedTimestampQueryEpochCommandInput, + MalformedTimestampQueryEpochCommandOutput, +} from "./commands/MalformedTimestampQueryEpochCommand"; +import { + MalformedTimestampQueryHttpDateCommandInput, + MalformedTimestampQueryHttpDateCommandOutput, +} from "./commands/MalformedTimestampQueryHttpDateCommand"; +import { MalformedUnionCommandInput, MalformedUnionCommandOutput } from "./commands/MalformedUnionCommand"; import { MediaTypeHeaderCommandInput, MediaTypeHeaderCommandOutput } from "./commands/MediaTypeHeaderCommand"; import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; @@ -202,6 +295,39 @@ export type ServiceInputTypes = | JsonMapsCommandInput | JsonTimestampsCommandInput | JsonUnionsCommandInput + | MalformedAcceptWithBodyCommandInput + | MalformedAcceptWithGenericStringCommandInput + | MalformedAcceptWithPayloadCommandInput + | MalformedBlobCommandInput + | MalformedBooleanCommandInput + | MalformedByteCommandInput + | MalformedContentTypeWithBodyCommandInput + | MalformedContentTypeWithGenericStringCommandInput + | MalformedContentTypeWithPayloadCommandInput + | MalformedContentTypeWithoutBodyCommandInput + | MalformedDoubleCommandInput + | MalformedFloatCommandInput + | MalformedIntegerCommandInput + | MalformedListCommandInput + | MalformedLongCommandInput + | MalformedMapCommandInput + | MalformedRequestBodyCommandInput + | MalformedSetCommandInput + | MalformedShortCommandInput + | MalformedStringCommandInput + | MalformedTimestampBodyDateTimeCommandInput + | MalformedTimestampBodyDefaultCommandInput + | MalformedTimestampBodyHttpDateCommandInput + | MalformedTimestampHeaderDateTimeCommandInput + | MalformedTimestampHeaderDefaultCommandInput + | MalformedTimestampHeaderEpochCommandInput + | MalformedTimestampPathDefaultCommandInput + | MalformedTimestampPathEpochCommandInput + | MalformedTimestampPathHttpDateCommandInput + | MalformedTimestampQueryDefaultCommandInput + | MalformedTimestampQueryEpochCommandInput + | MalformedTimestampQueryHttpDateCommandInput + | MalformedUnionCommandInput | MediaTypeHeaderCommandInput | NoInputAndNoOutputCommandInput | NoInputAndOutputCommandInput @@ -250,6 +376,39 @@ export type ServiceOutputTypes = | JsonMapsCommandOutput | JsonTimestampsCommandOutput | JsonUnionsCommandOutput + | MalformedAcceptWithBodyCommandOutput + | MalformedAcceptWithGenericStringCommandOutput + | MalformedAcceptWithPayloadCommandOutput + | MalformedBlobCommandOutput + | MalformedBooleanCommandOutput + | MalformedByteCommandOutput + | MalformedContentTypeWithBodyCommandOutput + | MalformedContentTypeWithGenericStringCommandOutput + | MalformedContentTypeWithPayloadCommandOutput + | MalformedContentTypeWithoutBodyCommandOutput + | MalformedDoubleCommandOutput + | MalformedFloatCommandOutput + | MalformedIntegerCommandOutput + | MalformedListCommandOutput + | MalformedLongCommandOutput + | MalformedMapCommandOutput + | MalformedRequestBodyCommandOutput + | MalformedSetCommandOutput + | MalformedShortCommandOutput + | MalformedStringCommandOutput + | MalformedTimestampBodyDateTimeCommandOutput + | MalformedTimestampBodyDefaultCommandOutput + | MalformedTimestampBodyHttpDateCommandOutput + | MalformedTimestampHeaderDateTimeCommandOutput + | MalformedTimestampHeaderDefaultCommandOutput + | MalformedTimestampHeaderEpochCommandOutput + | MalformedTimestampPathDefaultCommandOutput + | MalformedTimestampPathEpochCommandOutput + | MalformedTimestampPathHttpDateCommandOutput + | MalformedTimestampQueryDefaultCommandOutput + | MalformedTimestampQueryEpochCommandOutput + | MalformedTimestampQueryHttpDateCommandOutput + | MalformedUnionCommandOutput | MediaTypeHeaderCommandOutput | NoInputAndNoOutputCommandOutput | NoInputAndOutputCommandOutput diff --git a/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithBodyCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithBodyCommand.ts new file mode 100644 index 000000000000..5924cd4115f6 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithBodyCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { GreetingStruct } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedAcceptWithBodyCommand, + serializeAws_restJson1MalformedAcceptWithBodyCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedAcceptWithBodyCommandInput {} +export interface MalformedAcceptWithBodyCommandOutput extends GreetingStruct, __MetadataBearer {} + +export class MalformedAcceptWithBodyCommand extends $Command< + MalformedAcceptWithBodyCommandInput, + MalformedAcceptWithBodyCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedAcceptWithBodyCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedAcceptWithBodyCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingStruct.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedAcceptWithBodyCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedAcceptWithBodyCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedAcceptWithBodyCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts new file mode 100644 index 000000000000..4c1c26c29af6 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedAcceptWithGenericStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedAcceptWithGenericStringCommand, + serializeAws_restJson1MalformedAcceptWithGenericStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedAcceptWithGenericStringCommandInput extends MalformedAcceptWithGenericStringInput {} +export interface MalformedAcceptWithGenericStringCommandOutput extends __MetadataBearer {} + +export class MalformedAcceptWithGenericStringCommand extends $Command< + MalformedAcceptWithGenericStringCommandInput, + MalformedAcceptWithGenericStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedAcceptWithGenericStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedAcceptWithGenericStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedAcceptWithGenericStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedAcceptWithGenericStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedAcceptWithGenericStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedAcceptWithGenericStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts new file mode 100644 index 000000000000..f35ceeefbb7f --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedAcceptWithPayloadInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedAcceptWithPayloadCommand, + serializeAws_restJson1MalformedAcceptWithPayloadCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedAcceptWithPayloadCommandInput {} +export interface MalformedAcceptWithPayloadCommandOutput extends MalformedAcceptWithPayloadInput, __MetadataBearer {} + +export class MalformedAcceptWithPayloadCommand extends $Command< + MalformedAcceptWithPayloadCommandInput, + MalformedAcceptWithPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedAcceptWithPayloadCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedAcceptWithPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: MalformedAcceptWithPayloadInput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedAcceptWithPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedAcceptWithPayloadCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedAcceptWithPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedBlobCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedBlobCommand.ts new file mode 100644 index 000000000000..3e6965af7561 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedBlobCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedBlobInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedBlobCommand, + serializeAws_restJson1MalformedBlobCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedBlobCommandInput extends MalformedBlobInput {} +export interface MalformedBlobCommandOutput extends __MetadataBearer {} + +export class MalformedBlobCommand extends $Command< + MalformedBlobCommandInput, + MalformedBlobCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedBlobCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedBlobCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedBlobInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedBlobCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedBlobCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedBlobCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedBooleanCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedBooleanCommand.ts new file mode 100644 index 000000000000..98a5aad1d3ea --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedBooleanCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedBooleanInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedBooleanCommand, + serializeAws_restJson1MalformedBooleanCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedBooleanCommandInput extends MalformedBooleanInput {} +export interface MalformedBooleanCommandOutput extends __MetadataBearer {} + +export class MalformedBooleanCommand extends $Command< + MalformedBooleanCommandInput, + MalformedBooleanCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedBooleanCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedBooleanCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedBooleanInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedBooleanCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedBooleanCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedBooleanCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedByteCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedByteCommand.ts new file mode 100644 index 000000000000..9f8fb7a12cba --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedByteCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedByteInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedByteCommand, + serializeAws_restJson1MalformedByteCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedByteCommandInput extends MalformedByteInput {} +export interface MalformedByteCommandOutput extends __MetadataBearer {} + +export class MalformedByteCommand extends $Command< + MalformedByteCommandInput, + MalformedByteCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedByteCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedByteCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedByteInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedByteCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedByteCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedByteCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts new file mode 100644 index 000000000000..13a2d1722b92 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { GreetingStruct } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedContentTypeWithBodyCommand, + serializeAws_restJson1MalformedContentTypeWithBodyCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedContentTypeWithBodyCommandInput extends GreetingStruct {} +export interface MalformedContentTypeWithBodyCommandOutput extends __MetadataBearer {} + +export class MalformedContentTypeWithBodyCommand extends $Command< + MalformedContentTypeWithBodyCommandInput, + MalformedContentTypeWithBodyCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedContentTypeWithBodyCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedContentTypeWithBodyCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: GreetingStruct.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedContentTypeWithBodyCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedContentTypeWithBodyCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedContentTypeWithBodyCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts new file mode 100644 index 000000000000..ffd29dc98f01 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedContentTypeWithGenericStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedContentTypeWithGenericStringCommand, + serializeAws_restJson1MalformedContentTypeWithGenericStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedContentTypeWithGenericStringCommandInput extends MalformedContentTypeWithGenericStringInput {} +export interface MalformedContentTypeWithGenericStringCommandOutput extends __MetadataBearer {} + +export class MalformedContentTypeWithGenericStringCommand extends $Command< + MalformedContentTypeWithGenericStringCommandInput, + MalformedContentTypeWithGenericStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedContentTypeWithGenericStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedContentTypeWithGenericStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedContentTypeWithGenericStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedContentTypeWithGenericStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedContentTypeWithGenericStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedContentTypeWithGenericStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts new file mode 100644 index 000000000000..3a01c271afdd --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedContentTypeWithPayloadInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedContentTypeWithPayloadCommand, + serializeAws_restJson1MalformedContentTypeWithPayloadCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedContentTypeWithPayloadCommandInput extends MalformedContentTypeWithPayloadInput {} +export interface MalformedContentTypeWithPayloadCommandOutput extends __MetadataBearer {} + +export class MalformedContentTypeWithPayloadCommand extends $Command< + MalformedContentTypeWithPayloadCommandInput, + MalformedContentTypeWithPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedContentTypeWithPayloadCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedContentTypeWithPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedContentTypeWithPayloadInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedContentTypeWithPayloadCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedContentTypeWithPayloadCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedContentTypeWithPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts new file mode 100644 index 000000000000..30771b24accd --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts @@ -0,0 +1,83 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { + deserializeAws_restJson1MalformedContentTypeWithoutBodyCommand, + serializeAws_restJson1MalformedContentTypeWithoutBodyCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedContentTypeWithoutBodyCommandInput {} +export interface MalformedContentTypeWithoutBodyCommandOutput extends __MetadataBearer {} + +export class MalformedContentTypeWithoutBodyCommand extends $Command< + MalformedContentTypeWithoutBodyCommandInput, + MalformedContentTypeWithoutBodyCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedContentTypeWithoutBodyCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedContentTypeWithoutBodyCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedContentTypeWithoutBodyCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedContentTypeWithoutBodyCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedContentTypeWithoutBodyCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedDoubleCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedDoubleCommand.ts new file mode 100644 index 000000000000..fd616d073aff --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedDoubleCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedDoubleInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedDoubleCommand, + serializeAws_restJson1MalformedDoubleCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedDoubleCommandInput extends MalformedDoubleInput {} +export interface MalformedDoubleCommandOutput extends __MetadataBearer {} + +export class MalformedDoubleCommand extends $Command< + MalformedDoubleCommandInput, + MalformedDoubleCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedDoubleCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedDoubleCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedDoubleInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedDoubleCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedDoubleCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedDoubleCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedFloatCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedFloatCommand.ts new file mode 100644 index 000000000000..848f2f385de0 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedFloatCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedFloatInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedFloatCommand, + serializeAws_restJson1MalformedFloatCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedFloatCommandInput extends MalformedFloatInput {} +export interface MalformedFloatCommandOutput extends __MetadataBearer {} + +export class MalformedFloatCommand extends $Command< + MalformedFloatCommandInput, + MalformedFloatCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedFloatCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedFloatCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedFloatInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedFloatCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedFloatCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedFloatCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedIntegerCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedIntegerCommand.ts new file mode 100644 index 000000000000..245c7ac610db --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedIntegerCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedIntegerInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedIntegerCommand, + serializeAws_restJson1MalformedIntegerCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedIntegerCommandInput extends MalformedIntegerInput {} +export interface MalformedIntegerCommandOutput extends __MetadataBearer {} + +export class MalformedIntegerCommand extends $Command< + MalformedIntegerCommandInput, + MalformedIntegerCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedIntegerCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedIntegerCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedIntegerInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedIntegerCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedIntegerCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedIntegerCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedListCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedListCommand.ts new file mode 100644 index 000000000000..bd83dc11d480 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedListCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedListInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedListCommand, + serializeAws_restJson1MalformedListCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedListCommandInput extends MalformedListInput {} +export interface MalformedListCommandOutput extends __MetadataBearer {} + +export class MalformedListCommand extends $Command< + MalformedListCommandInput, + MalformedListCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedListCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedListCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedListInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedListCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedListCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedListCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedLongCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedLongCommand.ts new file mode 100644 index 000000000000..684fbe6741af --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedLongCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedLongInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedLongCommand, + serializeAws_restJson1MalformedLongCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedLongCommandInput extends MalformedLongInput {} +export interface MalformedLongCommandOutput extends __MetadataBearer {} + +export class MalformedLongCommand extends $Command< + MalformedLongCommandInput, + MalformedLongCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedLongCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedLongCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedLongInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedLongCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedLongCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedLongCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedMapCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedMapCommand.ts new file mode 100644 index 000000000000..080b8be8cb49 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedMapCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedMapInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedMapCommand, + serializeAws_restJson1MalformedMapCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedMapCommandInput extends MalformedMapInput {} +export interface MalformedMapCommandOutput extends __MetadataBearer {} + +export class MalformedMapCommand extends $Command< + MalformedMapCommandInput, + MalformedMapCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedMapCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedMapCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedMapInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedMapCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedMapCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedRequestBodyCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedRequestBodyCommand.ts new file mode 100644 index 000000000000..82d284ed749e --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedRequestBodyCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedRequestBodyInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedRequestBodyCommand, + serializeAws_restJson1MalformedRequestBodyCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedRequestBodyCommandInput extends MalformedRequestBodyInput {} +export interface MalformedRequestBodyCommandOutput extends __MetadataBearer {} + +export class MalformedRequestBodyCommand extends $Command< + MalformedRequestBodyCommandInput, + MalformedRequestBodyCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedRequestBodyCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedRequestBodyCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedRequestBodyInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedRequestBodyCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedRequestBodyCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedRequestBodyCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedSetCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedSetCommand.ts new file mode 100644 index 000000000000..22d543ddf07e --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedSetCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedSetInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedSetCommand, + serializeAws_restJson1MalformedSetCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedSetCommandInput extends MalformedSetInput {} +export interface MalformedSetCommandOutput extends __MetadataBearer {} + +export class MalformedSetCommand extends $Command< + MalformedSetCommandInput, + MalformedSetCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedSetCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedSetCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedSetInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedSetCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedSetCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedSetCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedShortCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedShortCommand.ts new file mode 100644 index 000000000000..f769c8fc8155 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedShortCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedShortInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedShortCommand, + serializeAws_restJson1MalformedShortCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedShortCommandInput extends MalformedShortInput {} +export interface MalformedShortCommandOutput extends __MetadataBearer {} + +export class MalformedShortCommand extends $Command< + MalformedShortCommandInput, + MalformedShortCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedShortCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedShortCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedShortInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedShortCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedShortCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedShortCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedStringCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedStringCommand.ts new file mode 100644 index 000000000000..b3f509c7404b --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedStringCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedStringCommand, + serializeAws_restJson1MalformedStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedStringCommandInput extends MalformedStringInput {} +export interface MalformedStringCommandOutput extends __MetadataBearer {} + +export class MalformedStringCommand extends $Command< + MalformedStringCommandInput, + MalformedStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedStringCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedStringCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts new file mode 100644 index 000000000000..3b90e4391dcd --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampBodyDateTimeInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampBodyDateTimeCommand, + serializeAws_restJson1MalformedTimestampBodyDateTimeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampBodyDateTimeCommandInput extends MalformedTimestampBodyDateTimeInput {} +export interface MalformedTimestampBodyDateTimeCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampBodyDateTimeCommand extends $Command< + MalformedTimestampBodyDateTimeCommandInput, + MalformedTimestampBodyDateTimeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampBodyDateTimeCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampBodyDateTimeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampBodyDateTimeInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampBodyDateTimeCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampBodyDateTimeCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampBodyDateTimeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts new file mode 100644 index 000000000000..a591ad5eaeca --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampBodyDefaultInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampBodyDefaultCommand, + serializeAws_restJson1MalformedTimestampBodyDefaultCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampBodyDefaultCommandInput extends MalformedTimestampBodyDefaultInput {} +export interface MalformedTimestampBodyDefaultCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampBodyDefaultCommand extends $Command< + MalformedTimestampBodyDefaultCommandInput, + MalformedTimestampBodyDefaultCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampBodyDefaultCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampBodyDefaultCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampBodyDefaultInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedTimestampBodyDefaultCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampBodyDefaultCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampBodyDefaultCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts new file mode 100644 index 000000000000..13a80d458cb0 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampBodyHttpDateInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampBodyHttpDateCommand, + serializeAws_restJson1MalformedTimestampBodyHttpDateCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampBodyHttpDateCommandInput extends MalformedTimestampBodyHttpDateInput {} +export interface MalformedTimestampBodyHttpDateCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampBodyHttpDateCommand extends $Command< + MalformedTimestampBodyHttpDateCommandInput, + MalformedTimestampBodyHttpDateCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampBodyHttpDateCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampBodyHttpDateCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampBodyHttpDateInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampBodyHttpDateCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampBodyHttpDateCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampBodyHttpDateCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts new file mode 100644 index 000000000000..4001c1250f31 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampHeaderDateTimeInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommand, + serializeAws_restJson1MalformedTimestampHeaderDateTimeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampHeaderDateTimeCommandInput extends MalformedTimestampHeaderDateTimeInput {} +export interface MalformedTimestampHeaderDateTimeCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampHeaderDateTimeCommand extends $Command< + MalformedTimestampHeaderDateTimeCommandInput, + MalformedTimestampHeaderDateTimeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampHeaderDateTimeCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampHeaderDateTimeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampHeaderDateTimeInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampHeaderDateTimeCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampHeaderDateTimeCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts new file mode 100644 index 000000000000..f13adc566c26 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampHeaderDefaultInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampHeaderDefaultCommand, + serializeAws_restJson1MalformedTimestampHeaderDefaultCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampHeaderDefaultCommandInput extends MalformedTimestampHeaderDefaultInput {} +export interface MalformedTimestampHeaderDefaultCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampHeaderDefaultCommand extends $Command< + MalformedTimestampHeaderDefaultCommandInput, + MalformedTimestampHeaderDefaultCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampHeaderDefaultCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampHeaderDefaultCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampHeaderDefaultInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampHeaderDefaultCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampHeaderDefaultCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampHeaderDefaultCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts new file mode 100644 index 000000000000..2e39dadfdd7b --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampHeaderEpochInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampHeaderEpochCommand, + serializeAws_restJson1MalformedTimestampHeaderEpochCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampHeaderEpochCommandInput extends MalformedTimestampHeaderEpochInput {} +export interface MalformedTimestampHeaderEpochCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampHeaderEpochCommand extends $Command< + MalformedTimestampHeaderEpochCommandInput, + MalformedTimestampHeaderEpochCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampHeaderEpochCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampHeaderEpochCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampHeaderEpochInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedTimestampHeaderEpochCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampHeaderEpochCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampHeaderEpochCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts new file mode 100644 index 000000000000..5314c67f55dc --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampPathDefaultInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampPathDefaultCommand, + serializeAws_restJson1MalformedTimestampPathDefaultCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampPathDefaultCommandInput extends MalformedTimestampPathDefaultInput {} +export interface MalformedTimestampPathDefaultCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampPathDefaultCommand extends $Command< + MalformedTimestampPathDefaultCommandInput, + MalformedTimestampPathDefaultCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampPathDefaultCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampPathDefaultCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampPathDefaultInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedTimestampPathDefaultCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampPathDefaultCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampPathDefaultCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathEpochCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathEpochCommand.ts new file mode 100644 index 000000000000..70eb25fbe197 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathEpochCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampPathEpochInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampPathEpochCommand, + serializeAws_restJson1MalformedTimestampPathEpochCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampPathEpochCommandInput extends MalformedTimestampPathEpochInput {} +export interface MalformedTimestampPathEpochCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampPathEpochCommand extends $Command< + MalformedTimestampPathEpochCommandInput, + MalformedTimestampPathEpochCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampPathEpochCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampPathEpochCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampPathEpochInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedTimestampPathEpochCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampPathEpochCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampPathEpochCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts new file mode 100644 index 000000000000..4b9f3ed93a8b --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampPathHttpDateInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampPathHttpDateCommand, + serializeAws_restJson1MalformedTimestampPathHttpDateCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampPathHttpDateCommandInput extends MalformedTimestampPathHttpDateInput {} +export interface MalformedTimestampPathHttpDateCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampPathHttpDateCommand extends $Command< + MalformedTimestampPathHttpDateCommandInput, + MalformedTimestampPathHttpDateCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampPathHttpDateCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampPathHttpDateCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampPathHttpDateInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampPathHttpDateCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampPathHttpDateCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampPathHttpDateCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts new file mode 100644 index 000000000000..eebe83963a5f --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampQueryDefaultInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampQueryDefaultCommand, + serializeAws_restJson1MalformedTimestampQueryDefaultCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampQueryDefaultCommandInput extends MalformedTimestampQueryDefaultInput {} +export interface MalformedTimestampQueryDefaultCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampQueryDefaultCommand extends $Command< + MalformedTimestampQueryDefaultCommandInput, + MalformedTimestampQueryDefaultCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampQueryDefaultCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampQueryDefaultCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampQueryDefaultInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampQueryDefaultCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampQueryDefaultCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampQueryDefaultCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts new file mode 100644 index 000000000000..5473b9e4ce03 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts @@ -0,0 +1,81 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampQueryEpochInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampQueryEpochCommand, + serializeAws_restJson1MalformedTimestampQueryEpochCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampQueryEpochCommandInput extends MalformedTimestampQueryEpochInput {} +export interface MalformedTimestampQueryEpochCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampQueryEpochCommand extends $Command< + MalformedTimestampQueryEpochCommandInput, + MalformedTimestampQueryEpochCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampQueryEpochCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampQueryEpochCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampQueryEpochInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedTimestampQueryEpochCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampQueryEpochCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampQueryEpochCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts new file mode 100644 index 000000000000..6b60c4f74eaf --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts @@ -0,0 +1,84 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedTimestampQueryHttpDateInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedTimestampQueryHttpDateCommand, + serializeAws_restJson1MalformedTimestampQueryHttpDateCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedTimestampQueryHttpDateCommandInput extends MalformedTimestampQueryHttpDateInput {} +export interface MalformedTimestampQueryHttpDateCommandOutput extends __MetadataBearer {} + +export class MalformedTimestampQueryHttpDateCommand extends $Command< + MalformedTimestampQueryHttpDateCommandInput, + MalformedTimestampQueryHttpDateCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedTimestampQueryHttpDateCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedTimestampQueryHttpDateCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedTimestampQueryHttpDateInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: MalformedTimestampQueryHttpDateCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedTimestampQueryHttpDateCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1MalformedTimestampQueryHttpDateCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/commands/MalformedUnionCommand.ts b/protocol_tests/aws-restjson/src/commands/MalformedUnionCommand.ts new file mode 100644 index 000000000000..9741bee2f504 --- /dev/null +++ b/protocol_tests/aws-restjson/src/commands/MalformedUnionCommand.ts @@ -0,0 +1,78 @@ +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, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { MalformedUnionInput } from "../models/models_0"; +import { + deserializeAws_restJson1MalformedUnionCommand, + serializeAws_restJson1MalformedUnionCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MalformedUnionCommandInput extends MalformedUnionInput {} +export interface MalformedUnionCommandOutput extends __MetadataBearer {} + +export class MalformedUnionCommand extends $Command< + MalformedUnionCommandInput, + MalformedUnionCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MalformedUnionCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "MalformedUnionCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MalformedUnionInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MalformedUnionCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MalformedUnionCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MalformedUnionCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/src/index.ts b/protocol_tests/aws-restjson/src/index.ts index af6cd9238166..0534bb6b1974 100644 --- a/protocol_tests/aws-restjson/src/index.ts +++ b/protocol_tests/aws-restjson/src/index.ts @@ -31,6 +31,39 @@ export * from "./commands/JsonListsCommand"; export * from "./commands/JsonMapsCommand"; export * from "./commands/JsonTimestampsCommand"; export * from "./commands/JsonUnionsCommand"; +export * from "./commands/MalformedAcceptWithBodyCommand"; +export * from "./commands/MalformedAcceptWithGenericStringCommand"; +export * from "./commands/MalformedAcceptWithPayloadCommand"; +export * from "./commands/MalformedBlobCommand"; +export * from "./commands/MalformedBooleanCommand"; +export * from "./commands/MalformedByteCommand"; +export * from "./commands/MalformedContentTypeWithBodyCommand"; +export * from "./commands/MalformedContentTypeWithGenericStringCommand"; +export * from "./commands/MalformedContentTypeWithoutBodyCommand"; +export * from "./commands/MalformedContentTypeWithPayloadCommand"; +export * from "./commands/MalformedDoubleCommand"; +export * from "./commands/MalformedFloatCommand"; +export * from "./commands/MalformedIntegerCommand"; +export * from "./commands/MalformedListCommand"; +export * from "./commands/MalformedLongCommand"; +export * from "./commands/MalformedMapCommand"; +export * from "./commands/MalformedRequestBodyCommand"; +export * from "./commands/MalformedSetCommand"; +export * from "./commands/MalformedShortCommand"; +export * from "./commands/MalformedStringCommand"; +export * from "./commands/MalformedTimestampBodyDateTimeCommand"; +export * from "./commands/MalformedTimestampBodyDefaultCommand"; +export * from "./commands/MalformedTimestampBodyHttpDateCommand"; +export * from "./commands/MalformedTimestampHeaderDateTimeCommand"; +export * from "./commands/MalformedTimestampHeaderDefaultCommand"; +export * from "./commands/MalformedTimestampHeaderEpochCommand"; +export * from "./commands/MalformedTimestampPathDefaultCommand"; +export * from "./commands/MalformedTimestampPathEpochCommand"; +export * from "./commands/MalformedTimestampPathHttpDateCommand"; +export * from "./commands/MalformedTimestampQueryDefaultCommand"; +export * from "./commands/MalformedTimestampQueryEpochCommand"; +export * from "./commands/MalformedTimestampQueryHttpDateCommand"; +export * from "./commands/MalformedUnionCommand"; export * from "./commands/MediaTypeHeaderCommand"; export * from "./commands/NoInputAndNoOutputCommand"; export * from "./commands/NoInputAndOutputCommand"; diff --git a/protocol_tests/aws-restjson/src/models/models_0.ts b/protocol_tests/aws-restjson/src/models/models_0.ts index 1fa6feab2d75..bfe279dd3bec 100644 --- a/protocol_tests/aws-restjson/src/models/models_0.ts +++ b/protocol_tests/aws-restjson/src/models/models_0.ts @@ -842,6 +842,462 @@ export namespace UnionInputOutput { }); } +export interface MalformedAcceptWithGenericStringInput { + payload?: Uint8Array; +} + +export namespace MalformedAcceptWithGenericStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedAcceptWithGenericStringInput): any => ({ + ...obj, + }); +} + +export interface MalformedAcceptWithPayloadInput { + payload?: Uint8Array; +} + +export namespace MalformedAcceptWithPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedAcceptWithPayloadInput): any => ({ + ...obj, + }); +} + +export interface MalformedBlobInput { + blob?: Uint8Array; +} + +export namespace MalformedBlobInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedBlobInput): any => ({ + ...obj, + }); +} + +export interface MalformedBooleanInput { + booleanInBody?: boolean; + booleanInPath: boolean | undefined; + booleanInQuery?: boolean; + booleanInHeader?: boolean; +} + +export namespace MalformedBooleanInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedBooleanInput): any => ({ + ...obj, + }); +} + +export interface MalformedByteInput { + byteInBody?: number; + byteInPath: number | undefined; + byteInQuery?: number; + byteInHeader?: number; +} + +export namespace MalformedByteInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedByteInput): any => ({ + ...obj, + }); +} + +export interface MalformedContentTypeWithGenericStringInput { + payload?: string; +} + +export namespace MalformedContentTypeWithGenericStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedContentTypeWithGenericStringInput): any => ({ + ...obj, + }); +} + +export interface MalformedContentTypeWithPayloadInput { + payload?: Uint8Array; +} + +export namespace MalformedContentTypeWithPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedContentTypeWithPayloadInput): any => ({ + ...obj, + }); +} + +export interface MalformedDoubleInput { + doubleInBody?: number; + doubleInPath: number | undefined; + doubleInQuery?: number; + doubleInHeader?: number; +} + +export namespace MalformedDoubleInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedDoubleInput): any => ({ + ...obj, + }); +} + +export interface MalformedFloatInput { + floatInBody?: number; + floatInPath: number | undefined; + floatInQuery?: number; + floatInHeader?: number; +} + +export namespace MalformedFloatInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedFloatInput): any => ({ + ...obj, + }); +} + +export interface MalformedIntegerInput { + integerInBody?: number; + integerInPath: number | undefined; + integerInQuery?: number; + integerInHeader?: number; +} + +export namespace MalformedIntegerInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedIntegerInput): any => ({ + ...obj, + }); +} + +export interface MalformedListInput { + bodyList?: string[]; +} + +export namespace MalformedListInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedListInput): any => ({ + ...obj, + }); +} + +export interface MalformedLongInput { + longInBody?: number; + longInPath: number | undefined; + longInQuery?: number; + longInHeader?: number; +} + +export namespace MalformedLongInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedLongInput): any => ({ + ...obj, + }); +} + +export interface MalformedMapInput { + bodyMap?: { [key: string]: string }; +} + +export namespace MalformedMapInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedMapInput): any => ({ + ...obj, + }); +} + +export interface MalformedRequestBodyInput { + int?: number; + float?: number; +} + +export namespace MalformedRequestBodyInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedRequestBodyInput): any => ({ + ...obj, + }); +} + +export interface MalformedSetInput { + set?: string[]; +} + +export namespace MalformedSetInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedSetInput): any => ({ + ...obj, + }); +} + +export interface MalformedShortInput { + shortInBody?: number; + shortInPath: number | undefined; + shortInQuery?: number; + shortInHeader?: number; +} + +export namespace MalformedShortInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedShortInput): any => ({ + ...obj, + }); +} + +export interface MalformedStringInput { + blob?: __LazyJsonString | string; +} + +export namespace MalformedStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedStringInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampBodyDateTimeInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyDateTimeInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyDateTimeInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampBodyDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyDefaultInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampBodyHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyHttpDateInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampHeaderDateTimeInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderDateTimeInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderDateTimeInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampHeaderDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderDefaultInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampHeaderEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderEpochInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampPathDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathDefaultInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampPathEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathEpochInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampPathHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathHttpDateInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampQueryDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryDefaultInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampQueryEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryEpochInput): any => ({ + ...obj, + }); +} + +export interface MalformedTimestampQueryHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryHttpDateInput): any => ({ + ...obj, + }); +} + +export type SimpleUnion = SimpleUnion.IntMember | SimpleUnion.StringMember | SimpleUnion.$UnknownMember; + +export namespace SimpleUnion { + export interface IntMember { + int: number; + string?: never; + $unknown?: never; + } + + export interface StringMember { + int?: never; + string: string; + $unknown?: never; + } + + export interface $UnknownMember { + int?: never; + string?: never; + $unknown: [string, any]; + } + + export interface Visitor { + int: (value: number) => T; + string: (value: string) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: SimpleUnion, visitor: Visitor): T => { + if (value.int !== undefined) return visitor.int(value.int); + if (value.string !== undefined) return visitor.string(value.string); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleUnion): any => { + if (obj.int !== undefined) return { int: obj.int }; + if (obj.string !== undefined) return { string: obj.string }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; +} + +export interface MalformedUnionInput { + union?: SimpleUnion; +} + +export namespace MalformedUnionInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedUnionInput): any => ({ + ...obj, + ...(obj.union && { union: SimpleUnion.filterSensitiveLog(obj.union) }), + }); +} + export interface MediaTypeHeaderInput { json?: __LazyJsonString | string; } diff --git a/protocol_tests/aws-restjson/src/protocols/Aws_restJson1.ts b/protocol_tests/aws-restjson/src/protocols/Aws_restJson1.ts index b31de7a67a17..8b5b7e8f07a2 100644 --- a/protocol_tests/aws-restjson/src/protocols/Aws_restJson1.ts +++ b/protocol_tests/aws-restjson/src/protocols/Aws_restJson1.ts @@ -124,6 +124,99 @@ import { JsonListsCommandInput, JsonListsCommandOutput } from "../commands/JsonL import { JsonMapsCommandInput, JsonMapsCommandOutput } from "../commands/JsonMapsCommand"; import { JsonTimestampsCommandInput, JsonTimestampsCommandOutput } from "../commands/JsonTimestampsCommand"; import { JsonUnionsCommandInput, JsonUnionsCommandOutput } from "../commands/JsonUnionsCommand"; +import { + MalformedAcceptWithBodyCommandInput, + MalformedAcceptWithBodyCommandOutput, +} from "../commands/MalformedAcceptWithBodyCommand"; +import { + MalformedAcceptWithGenericStringCommandInput, + MalformedAcceptWithGenericStringCommandOutput, +} from "../commands/MalformedAcceptWithGenericStringCommand"; +import { + MalformedAcceptWithPayloadCommandInput, + MalformedAcceptWithPayloadCommandOutput, +} from "../commands/MalformedAcceptWithPayloadCommand"; +import { MalformedBlobCommandInput, MalformedBlobCommandOutput } from "../commands/MalformedBlobCommand"; +import { MalformedBooleanCommandInput, MalformedBooleanCommandOutput } from "../commands/MalformedBooleanCommand"; +import { MalformedByteCommandInput, MalformedByteCommandOutput } from "../commands/MalformedByteCommand"; +import { + MalformedContentTypeWithBodyCommandInput, + MalformedContentTypeWithBodyCommandOutput, +} from "../commands/MalformedContentTypeWithBodyCommand"; +import { + MalformedContentTypeWithGenericStringCommandInput, + MalformedContentTypeWithGenericStringCommandOutput, +} from "../commands/MalformedContentTypeWithGenericStringCommand"; +import { + MalformedContentTypeWithoutBodyCommandInput, + MalformedContentTypeWithoutBodyCommandOutput, +} from "../commands/MalformedContentTypeWithoutBodyCommand"; +import { + MalformedContentTypeWithPayloadCommandInput, + MalformedContentTypeWithPayloadCommandOutput, +} from "../commands/MalformedContentTypeWithPayloadCommand"; +import { MalformedDoubleCommandInput, MalformedDoubleCommandOutput } from "../commands/MalformedDoubleCommand"; +import { MalformedFloatCommandInput, MalformedFloatCommandOutput } from "../commands/MalformedFloatCommand"; +import { MalformedIntegerCommandInput, MalformedIntegerCommandOutput } from "../commands/MalformedIntegerCommand"; +import { MalformedListCommandInput, MalformedListCommandOutput } from "../commands/MalformedListCommand"; +import { MalformedLongCommandInput, MalformedLongCommandOutput } from "../commands/MalformedLongCommand"; +import { MalformedMapCommandInput, MalformedMapCommandOutput } from "../commands/MalformedMapCommand"; +import { + MalformedRequestBodyCommandInput, + MalformedRequestBodyCommandOutput, +} from "../commands/MalformedRequestBodyCommand"; +import { MalformedSetCommandInput, MalformedSetCommandOutput } from "../commands/MalformedSetCommand"; +import { MalformedShortCommandInput, MalformedShortCommandOutput } from "../commands/MalformedShortCommand"; +import { MalformedStringCommandInput, MalformedStringCommandOutput } from "../commands/MalformedStringCommand"; +import { + MalformedTimestampBodyDateTimeCommandInput, + MalformedTimestampBodyDateTimeCommandOutput, +} from "../commands/MalformedTimestampBodyDateTimeCommand"; +import { + MalformedTimestampBodyDefaultCommandInput, + MalformedTimestampBodyDefaultCommandOutput, +} from "../commands/MalformedTimestampBodyDefaultCommand"; +import { + MalformedTimestampBodyHttpDateCommandInput, + MalformedTimestampBodyHttpDateCommandOutput, +} from "../commands/MalformedTimestampBodyHttpDateCommand"; +import { + MalformedTimestampHeaderDateTimeCommandInput, + MalformedTimestampHeaderDateTimeCommandOutput, +} from "../commands/MalformedTimestampHeaderDateTimeCommand"; +import { + MalformedTimestampHeaderDefaultCommandInput, + MalformedTimestampHeaderDefaultCommandOutput, +} from "../commands/MalformedTimestampHeaderDefaultCommand"; +import { + MalformedTimestampHeaderEpochCommandInput, + MalformedTimestampHeaderEpochCommandOutput, +} from "../commands/MalformedTimestampHeaderEpochCommand"; +import { + MalformedTimestampPathDefaultCommandInput, + MalformedTimestampPathDefaultCommandOutput, +} from "../commands/MalformedTimestampPathDefaultCommand"; +import { + MalformedTimestampPathEpochCommandInput, + MalformedTimestampPathEpochCommandOutput, +} from "../commands/MalformedTimestampPathEpochCommand"; +import { + MalformedTimestampPathHttpDateCommandInput, + MalformedTimestampPathHttpDateCommandOutput, +} from "../commands/MalformedTimestampPathHttpDateCommand"; +import { + MalformedTimestampQueryDefaultCommandInput, + MalformedTimestampQueryDefaultCommandOutput, +} from "../commands/MalformedTimestampQueryDefaultCommand"; +import { + MalformedTimestampQueryEpochCommandInput, + MalformedTimestampQueryEpochCommandOutput, +} from "../commands/MalformedTimestampQueryEpochCommand"; +import { + MalformedTimestampQueryHttpDateCommandInput, + MalformedTimestampQueryHttpDateCommandOutput, +} from "../commands/MalformedTimestampQueryHttpDateCommand"; +import { MalformedUnionCommandInput, MalformedUnionCommandOutput } from "../commands/MalformedUnionCommand"; import { MediaTypeHeaderCommandInput, MediaTypeHeaderCommandOutput } from "../commands/MediaTypeHeaderCommand"; import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; @@ -178,6 +271,7 @@ import { RecursiveShapesInputOutputNested1, RecursiveShapesInputOutputNested2, RenamedGreeting, + SimpleUnion, StructureListMember, } from "../models/models_0"; @@ -1276,40 +1370,43 @@ export const serializeAws_restJson1JsonUnionsCommand = async ( }); }; -export const serializeAws_restJson1MediaTypeHeaderCommand = async ( - input: MediaTypeHeaderCommandInput, +export const serializeAws_restJson1MalformedAcceptWithBodyCommand = async ( + input: MalformedAcceptWithBodyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - ...(isSerializableHeaderValue(input.json) && { - "x-json": context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.json!))), - }), + "content-type": "application/json", }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MediaTypeHeader"; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedAcceptWithBody"; let body: any; + body = ""; return new __HttpRequest({ protocol, hostname, port, - method: "GET", + method: "POST", headers, path: resolvedPath, body, }); }; -export const serializeAws_restJson1NoInputAndNoOutputCommand = async ( - input: NoInputAndNoOutputCommandInput, +export const serializeAws_restJson1MalformedAcceptWithGenericStringCommand = async ( + input: MalformedAcceptWithGenericStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - "content-type": "application/json", + "content-type": "application/octet-stream", }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndNoOutput"; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedAcceptWithGenericString"; let body: any; - body = ""; + if (input.payload !== undefined) { + body = input.payload; + } return new __HttpRequest({ protocol, hostname, @@ -1321,8 +1418,8 @@ export const serializeAws_restJson1NoInputAndNoOutputCommand = async ( }); }; -export const serializeAws_restJson1NoInputAndOutputCommand = async ( - input: NoInputAndOutputCommandInput, +export const serializeAws_restJson1MalformedAcceptWithPayloadCommand = async ( + input: MalformedAcceptWithPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); @@ -1330,7 +1427,7 @@ export const serializeAws_restJson1NoInputAndOutputCommand = async ( "content-type": "application/json", }; const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndOutputOutput"; + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedAcceptWithPayload"; let body: any; body = ""; return new __HttpRequest({ @@ -1344,72 +1441,101 @@ export const serializeAws_restJson1NoInputAndOutputCommand = async ( }); }; -export const serializeAws_restJson1NullAndEmptyHeadersClientCommand = async ( - input: NullAndEmptyHeadersClientCommandInput, +export const serializeAws_restJson1MalformedBlobCommand = async ( + input: MalformedBlobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), - ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), - ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry as any).join(", ") }), + "content-type": "application/json", }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersClient"; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedBlob"; let body: any; + body = JSON.stringify({ + ...(input.blob !== undefined && input.blob !== null && { blob: context.base64Encoder(input.blob) }), + }); return new __HttpRequest({ protocol, hostname, port, - method: "GET", + method: "POST", headers, path: resolvedPath, body, }); }; -export const serializeAws_restJson1NullAndEmptyHeadersServerCommand = async ( - input: NullAndEmptyHeadersServerCommandInput, +export const serializeAws_restJson1MalformedBooleanCommand = async ( + input: MalformedBooleanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), - ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), - ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry as any).join(", ") }), + "content-type": "application/json", + ...(isSerializableHeaderValue(input.booleanInHeader) && { booleaninheader: input.booleanInHeader!.toString() }), + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedBoolean/{booleanInPath}"; + if (input.booleanInPath !== undefined) { + const labelValue: string = input.booleanInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: booleanInPath."); + } + resolvedPath = resolvedPath.replace("{booleanInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: booleanInPath."); + } + const query: any = { + ...(input.booleanInQuery !== undefined && { booleanInQuery: input.booleanInQuery.toString() }), }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersServer"; let body: any; + body = JSON.stringify({ + ...(input.booleanInBody !== undefined && input.booleanInBody !== null && { booleanInBody: input.booleanInBody }), + }); return new __HttpRequest({ protocol, hostname, port, - method: "GET", + method: "POST", headers, path: resolvedPath, + query, body, }); }; -export const serializeAws_restJson1OmitsNullSerializesEmptyStringCommand = async ( - input: OmitsNullSerializesEmptyStringCommandInput, +export const serializeAws_restJson1MalformedByteCommand = async ( + input: MalformedByteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = {}; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/OmitsNullSerializesEmptyString"; + const headers: any = { + "content-type": "application/json", + ...(isSerializableHeaderValue(input.byteInHeader) && { byteinheader: input.byteInHeader!.toString() }), + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedByte/{byteInPath}"; + if (input.byteInPath !== undefined) { + const labelValue: string = input.byteInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: byteInPath."); + } + resolvedPath = resolvedPath.replace("{byteInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: byteInPath."); + } const query: any = { - ...(input.nullValue !== undefined && { Null: input.nullValue }), - ...(input.emptyString !== undefined && { Empty: input.emptyString }), + ...(input.byteInQuery !== undefined && { byteInQuery: input.byteInQuery.toString() }), }; let body: any; + body = JSON.stringify({ + ...(input.byteInBody !== undefined && input.byteInBody !== null && { byteInBody: input.byteInBody }), + }); return new __HttpRequest({ protocol, hostname, port, - method: "GET", + method: "POST", headers, path: resolvedPath, query, @@ -1417,18 +1543,45 @@ export const serializeAws_restJson1OmitsNullSerializesEmptyStringCommand = async }); }; -export const serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand = async ( - input: QueryIdempotencyTokenAutoFillCommandInput, +export const serializeAws_restJson1MalformedContentTypeWithBodyCommand = async ( + input: MalformedContentTypeWithBodyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = {}; + const headers: any = { + "content-type": "application/json", + }; const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/QueryIdempotencyTokenAutoFill"; - const query: any = { - ...(input.token !== undefined && { token: input.token }), + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedContentTypeWithBody"; + let body: any; + body = JSON.stringify({ + ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedContentTypeWithGenericStringCommand = async ( + input: MalformedContentTypeWithGenericStringCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "text/plain", }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedContentTypeWithGenericString"; let body: any; + if (input.payload !== undefined) { + body = input.payload; + } return new __HttpRequest({ protocol, hostname, @@ -1436,23 +1589,22 @@ export const serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand = async method: "POST", headers, path: resolvedPath, - query, body, }); }; -export const serializeAws_restJson1QueryParamsAsStringListMapCommand = async ( - input: QueryParamsAsStringListMapCommandInput, +export const serializeAws_restJson1MalformedContentTypeWithoutBodyCommand = async ( + input: MalformedContentTypeWithoutBodyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = {}; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StringListMap"; - const query: any = { - ...(input.foo !== undefined && input.foo), - ...(input.qux !== undefined && { corge: input.qux }), + const headers: any = { + "content-type": "application/json", }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedContentTypeWithoutBody"; let body: any; + body = ""; return new __HttpRequest({ protocol, hostname, @@ -1460,23 +1612,24 @@ export const serializeAws_restJson1QueryParamsAsStringListMapCommand = async ( method: "POST", headers, path: resolvedPath, - query, body, }); }; -export const serializeAws_restJson1QueryPrecedenceCommand = async ( - input: QueryPrecedenceCommandInput, +export const serializeAws_restJson1MalformedContentTypeWithPayloadCommand = async ( + input: MalformedContentTypeWithPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = {}; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Precedence"; - const query: any = { - ...(input.baz !== undefined && input.baz), - ...(input.foo !== undefined && { bar: input.foo }), + const headers: any = { + "content-type": "image/jpeg", }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedContentTypeWithPayload"; let body: any; + if (input.payload !== undefined) { + body = input.payload; + } return new __HttpRequest({ protocol, hostname, @@ -1484,90 +1637,125 @@ export const serializeAws_restJson1QueryPrecedenceCommand = async ( method: "POST", headers, path: resolvedPath, - query, body, }); }; -export const serializeAws_restJson1RecursiveShapesCommand = async ( - input: RecursiveShapesCommandInput, +export const serializeAws_restJson1MalformedDoubleCommand = async ( + input: MalformedDoubleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", + ...(isSerializableHeaderValue(input.doubleInHeader) && { + doubleinheader: input.doubleInHeader! % 1 == 0 ? input.doubleInHeader! + ".0" : input.doubleInHeader!.toString(), + }), + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedDouble/{doubleInPath}"; + if (input.doubleInPath !== undefined) { + const labelValue: string = input.doubleInPath % 1 == 0 ? input.doubleInPath + ".0" : input.doubleInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: doubleInPath."); + } + resolvedPath = resolvedPath.replace("{doubleInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: doubleInPath."); + } + const query: any = { + ...(input.doubleInQuery !== undefined && { + doubleInQuery: input.doubleInQuery % 1 == 0 ? input.doubleInQuery + ".0" : input.doubleInQuery.toString(), + }), }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; let body: any; body = JSON.stringify({ - ...(input.nested !== undefined && - input.nested !== null && { - nested: serializeAws_restJson1RecursiveShapesInputOutputNested1(input.nested, context), - }), + ...(input.doubleInBody !== undefined && + input.doubleInBody !== null && { doubleInBody: __serializeFloat(input.doubleInBody) }), }); return new __HttpRequest({ protocol, hostname, port, - method: "PUT", + method: "POST", headers, path: resolvedPath, + query, body, }); }; -export const serializeAws_restJson1SimpleScalarPropertiesCommand = async ( - input: SimpleScalarPropertiesCommandInput, +export const serializeAws_restJson1MalformedFloatCommand = async ( + input: MalformedFloatCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + ...(isSerializableHeaderValue(input.floatInHeader) && { + floatinheader: input.floatInHeader! % 1 == 0 ? input.floatInHeader! + ".0" : input.floatInHeader!.toString(), + }), + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedFloat/{floatInPath}"; + if (input.floatInPath !== undefined) { + const labelValue: string = input.floatInPath % 1 == 0 ? input.floatInPath + ".0" : input.floatInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: floatInPath."); + } + resolvedPath = resolvedPath.replace("{floatInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: floatInPath."); + } + const query: any = { + ...(input.floatInQuery !== undefined && { + floatInQuery: input.floatInQuery % 1 == 0 ? input.floatInQuery + ".0" : input.floatInQuery.toString(), + }), }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; let body: any; body = JSON.stringify({ - ...(input.byteValue !== undefined && input.byteValue !== null && { byteValue: input.byteValue }), - ...(input.doubleValue !== undefined && - input.doubleValue !== null && { DoubleDribble: __serializeFloat(input.doubleValue) }), - ...(input.falseBooleanValue !== undefined && - input.falseBooleanValue !== null && { falseBooleanValue: input.falseBooleanValue }), - ...(input.floatValue !== undefined && - input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), - ...(input.integerValue !== undefined && input.integerValue !== null && { integerValue: input.integerValue }), - ...(input.longValue !== undefined && input.longValue !== null && { longValue: input.longValue }), - ...(input.shortValue !== undefined && input.shortValue !== null && { shortValue: input.shortValue }), - ...(input.stringValue !== undefined && input.stringValue !== null && { stringValue: input.stringValue }), - ...(input.trueBooleanValue !== undefined && - input.trueBooleanValue !== null && { trueBooleanValue: input.trueBooleanValue }), + ...(input.floatInBody !== undefined && + input.floatInBody !== null && { floatInBody: __serializeFloat(input.floatInBody) }), }); return new __HttpRequest({ protocol, hostname, port, - method: "PUT", + method: "POST", headers, path: resolvedPath, + query, body, }); }; -export const serializeAws_restJson1StreamingTraitsCommand = async ( - input: StreamingTraitsCommandInput, +export const serializeAws_restJson1MalformedIntegerCommand = async ( + input: MalformedIntegerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - "content-type": "application/octet-stream", - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + "content-type": "application/json", + ...(isSerializableHeaderValue(input.integerInHeader) && { integerinheader: input.integerInHeader!.toString() }), }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraits"; - let body: any; - if (input.blob !== undefined) { - body = input.blob; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedInteger/{integerInPath}"; + if (input.integerInPath !== undefined) { + const labelValue: string = input.integerInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: integerInPath."); + } + resolvedPath = resolvedPath.replace("{integerInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: integerInPath."); } + const query: any = { + ...(input.integerInQuery !== undefined && { integerInQuery: input.integerInQuery.toString() }), + }; + let body: any; + body = JSON.stringify({ + ...(input.integerInBody !== undefined && input.integerInBody !== null && { integerInBody: input.integerInBody }), + }); return new __HttpRequest({ protocol, hostname, @@ -1575,25 +1763,25 @@ export const serializeAws_restJson1StreamingTraitsCommand = async ( method: "POST", headers, path: resolvedPath, + query, body, }); }; -export const serializeAws_restJson1StreamingTraitsRequireLengthCommand = async ( - input: StreamingTraitsRequireLengthCommandInput, +export const serializeAws_restJson1MalformedListCommand = async ( + input: MalformedListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - "content-type": "application/octet-stream", - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + "content-type": "application/json", }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsRequireLength"; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedList"; let body: any; - if (input.blob !== undefined) { - body = input.blob; - } + body = JSON.stringify({ + ...(input.bodyList !== undefined && + input.bodyList !== null && { bodyList: serializeAws_restJson1SimpleList(input.bodyList, context) }), + }); return new __HttpRequest({ protocol, hostname, @@ -1605,21 +1793,33 @@ export const serializeAws_restJson1StreamingTraitsRequireLengthCommand = async ( }); }; -export const serializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async ( - input: StreamingTraitsWithMediaTypeCommandInput, +export const serializeAws_restJson1MalformedLongCommand = async ( + input: MalformedLongCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - "content-type": "text/plain", - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + "content-type": "application/json", + ...(isSerializableHeaderValue(input.longInHeader) && { longinheader: input.longInHeader!.toString() }), }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsWithMediaType"; - let body: any; - if (input.blob !== undefined) { - body = input.blob; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedLong/{longInPath}"; + if (input.longInPath !== undefined) { + const labelValue: string = input.longInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: longInPath."); + } + resolvedPath = resolvedPath.replace("{longInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: longInPath."); } + const query: any = { + ...(input.longInQuery !== undefined && { longInQuery: input.longInQuery.toString() }), + }; + let body: any; + body = JSON.stringify({ + ...(input.longInBody !== undefined && input.longInBody !== null && { longInBody: input.longInBody }), + }); return new __HttpRequest({ protocol, hostname, @@ -1627,70 +1827,2423 @@ export const serializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async ( method: "POST", headers, path: resolvedPath, + query, body, }); }; -export const serializeAws_restJson1TimestampFormatHeadersCommand = async ( - input: TimestampFormatHeadersCommandInput, +export const serializeAws_restJson1MalformedMapCommand = async ( + input: MalformedMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { - ...(isSerializableHeaderValue(input.memberEpochSeconds) && { - "x-memberepochseconds": Math.round(input.memberEpochSeconds!.getTime() / 1000).toString(), - }), - ...(isSerializableHeaderValue(input.memberHttpDate) && { - "x-memberhttpdate": __dateToUtcString(input.memberHttpDate!).toString(), - }), - ...(isSerializableHeaderValue(input.memberDateTime) && { - "x-memberdatetime": (input.memberDateTime!.toISOString().split(".")[0] + "Z").toString(), - }), - ...(isSerializableHeaderValue(input.defaultFormat) && { - "x-defaultformat": __dateToUtcString(input.defaultFormat!).toString(), - }), - ...(isSerializableHeaderValue(input.targetEpochSeconds) && { - "x-targetepochseconds": Math.round(input.targetEpochSeconds!.getTime() / 1000).toString(), + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedMap"; + let body: any; + body = JSON.stringify({ + ...(input.bodyMap !== undefined && + input.bodyMap !== null && { bodyMap: serializeAws_restJson1SimpleMap(input.bodyMap, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedRequestBodyCommand = async ( + input: MalformedRequestBodyCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedRequestBody"; + let body: any; + body = JSON.stringify({ + ...(input.float !== undefined && input.float !== null && { float: __serializeFloat(input.float) }), + ...(input.int !== undefined && input.int !== null && { int: input.int }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedSetCommand = async ( + input: MalformedSetCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedSet"; + let body: any; + body = JSON.stringify({ + ...(input.set !== undefined && input.set !== null && { set: serializeAws_restJson1SimpleSet(input.set, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedShortCommand = async ( + input: MalformedShortCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + ...(isSerializableHeaderValue(input.shortInHeader) && { shortinheader: input.shortInHeader!.toString() }), + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedShort/{shortInPath}"; + if (input.shortInPath !== undefined) { + const labelValue: string = input.shortInPath.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: shortInPath."); + } + resolvedPath = resolvedPath.replace("{shortInPath}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: shortInPath."); + } + const query: any = { + ...(input.shortInQuery !== undefined && { shortInQuery: input.shortInQuery.toString() }), + }; + let body: any; + body = JSON.stringify({ + ...(input.shortInBody !== undefined && input.shortInBody !== null && { shortInBody: input.shortInBody }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedStringCommand = async ( + input: MalformedStringCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.blob) && { + "amz-media-typed-header": context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.blob!))), }), - ...(isSerializableHeaderValue(input.targetHttpDate) && { - "x-targethttpdate": __dateToUtcString(input.targetHttpDate!).toString(), + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedString"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampBodyDateTimeCommand = async ( + input: MalformedTimestampBodyDateTimeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyDateTime"; + let body: any; + body = JSON.stringify({ + ...(input.timestamp !== undefined && + input.timestamp !== null && { timestamp: input.timestamp.toISOString().split(".")[0] + "Z" }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampBodyDefaultCommand = async ( + input: MalformedTimestampBodyDefaultCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyDefault"; + let body: any; + body = JSON.stringify({ + ...(input.timestamp !== undefined && + input.timestamp !== null && { timestamp: Math.round(input.timestamp.getTime() / 1000) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampBodyHttpDateCommand = async ( + input: MalformedTimestampBodyHttpDateCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyHttpDate"; + let body: any; + body = JSON.stringify({ + ...(input.timestamp !== undefined && input.timestamp !== null && { timestamp: __dateToUtcString(input.timestamp) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampHeaderDateTimeCommand = async ( + input: MalformedTimestampHeaderDateTimeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.timestamp) && { + timestamp: (input.timestamp!.toISOString().split(".")[0] + "Z").toString(), }), - ...(isSerializableHeaderValue(input.targetDateTime) && { - "x-targetdatetime": (input.targetDateTime!.toISOString().split(".")[0] + "Z").toString(), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampHeaderDateTime"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampHeaderDefaultCommand = async ( + input: MalformedTimestampHeaderDefaultCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.timestamp) && { timestamp: __dateToUtcString(input.timestamp!).toString() }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampHeaderDefault"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampHeaderEpochCommand = async ( + input: MalformedTimestampHeaderEpochCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.timestamp) && { + timestamp: Math.round(input.timestamp!.getTime() / 1000).toString(), }), }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TimestampFormatHeaders"; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampHeaderEpoch"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampPathDefaultCommand = async ( + input: MalformedTimestampPathDefaultCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/MalformedTimestampPathDefault/{timestamp}"; + if (input.timestamp !== undefined) { + const labelValue: string = (input.timestamp.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: timestamp."); + } + resolvedPath = resolvedPath.replace("{timestamp}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: timestamp."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampPathEpochCommand = async ( + input: MalformedTimestampPathEpochCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampPathEpoch/{timestamp}"; + if (input.timestamp !== undefined) { + const labelValue: string = Math.round(input.timestamp.getTime() / 1000).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: timestamp."); + } + resolvedPath = resolvedPath.replace("{timestamp}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: timestamp."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampPathHttpDateCommand = async ( + input: MalformedTimestampPathHttpDateCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/MalformedTimestampPathHttpDate/{timestamp}"; + if (input.timestamp !== undefined) { + const labelValue: string = __dateToUtcString(input.timestamp).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: timestamp."); + } + resolvedPath = resolvedPath.replace("{timestamp}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: timestamp."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampQueryDefaultCommand = async ( + input: MalformedTimestampQueryDefaultCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampQueryDefault"; + const query: any = { + ...(input.timestamp !== undefined && { timestamp: (input.timestamp.toISOString().split(".")[0] + "Z").toString() }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampQueryEpochCommand = async ( + input: MalformedTimestampQueryEpochCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampQueryEpoch"; + const query: any = { + ...(input.timestamp !== undefined && { timestamp: Math.round(input.timestamp.getTime() / 1000).toString() }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedTimestampQueryHttpDateCommand = async ( + input: MalformedTimestampQueryHttpDateCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampQueryHttpDate"; + const query: any = { + ...(input.timestamp !== undefined && { timestamp: __dateToUtcString(input.timestamp).toString() }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedUnionCommand = async ( + input: MalformedUnionCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedUnion"; + let body: any; + body = JSON.stringify({ + ...(input.union !== undefined && + input.union !== null && { union: serializeAws_restJson1SimpleUnion(input.union, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MediaTypeHeaderCommand = async ( + input: MediaTypeHeaderCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.json) && { + "x-json": context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.json!))), + }), + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MediaTypeHeader"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1NoInputAndNoOutputCommand = async ( + input: NoInputAndNoOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndNoOutput"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1NoInputAndOutputCommand = async ( + input: NoInputAndOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndOutputOutput"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1NullAndEmptyHeadersClientCommand = async ( + input: NullAndEmptyHeadersClientCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), + ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), + ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry as any).join(", ") }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersClient"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1NullAndEmptyHeadersServerCommand = async ( + input: NullAndEmptyHeadersServerCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), + ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), + ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry as any).join(", ") }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersServer"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1OmitsNullSerializesEmptyStringCommand = async ( + input: OmitsNullSerializesEmptyStringCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/OmitsNullSerializesEmptyString"; + const query: any = { + ...(input.nullValue !== undefined && { Null: input.nullValue }), + ...(input.emptyString !== undefined && { Empty: input.emptyString }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand = async ( + input: QueryIdempotencyTokenAutoFillCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/QueryIdempotencyTokenAutoFill"; + const query: any = { + ...(input.token !== undefined && { token: input.token }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1QueryParamsAsStringListMapCommand = async ( + input: QueryParamsAsStringListMapCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StringListMap"; + const query: any = { + ...(input.foo !== undefined && input.foo), + ...(input.qux !== undefined && { corge: input.qux }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1QueryPrecedenceCommand = async ( + input: QueryPrecedenceCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = {}; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Precedence"; + const query: any = { + ...(input.baz !== undefined && input.baz), + ...(input.foo !== undefined && { bar: input.foo }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1RecursiveShapesCommand = async ( + input: RecursiveShapesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; + let body: any; + body = JSON.stringify({ + ...(input.nested !== undefined && + input.nested !== null && { + nested: serializeAws_restJson1RecursiveShapesInputOutputNested1(input.nested, context), + }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1SimpleScalarPropertiesCommand = async ( + input: SimpleScalarPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; + let body: any; + body = JSON.stringify({ + ...(input.byteValue !== undefined && input.byteValue !== null && { byteValue: input.byteValue }), + ...(input.doubleValue !== undefined && + input.doubleValue !== null && { DoubleDribble: __serializeFloat(input.doubleValue) }), + ...(input.falseBooleanValue !== undefined && + input.falseBooleanValue !== null && { falseBooleanValue: input.falseBooleanValue }), + ...(input.floatValue !== undefined && + input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), + ...(input.integerValue !== undefined && input.integerValue !== null && { integerValue: input.integerValue }), + ...(input.longValue !== undefined && input.longValue !== null && { longValue: input.longValue }), + ...(input.shortValue !== undefined && input.shortValue !== null && { shortValue: input.shortValue }), + ...(input.stringValue !== undefined && input.stringValue !== null && { stringValue: input.stringValue }), + ...(input.trueBooleanValue !== undefined && + input.trueBooleanValue !== null && { trueBooleanValue: input.trueBooleanValue }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1StreamingTraitsCommand = async ( + input: StreamingTraitsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/octet-stream", + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraits"; + let body: any; + if (input.blob !== undefined) { + body = input.blob; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1StreamingTraitsRequireLengthCommand = async ( + input: StreamingTraitsRequireLengthCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/octet-stream", + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsRequireLength"; + let body: any; + if (input.blob !== undefined) { + body = input.blob; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async ( + input: StreamingTraitsWithMediaTypeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "text/plain", + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsWithMediaType"; + let body: any; + if (input.blob !== undefined) { + body = input.blob; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1TimestampFormatHeadersCommand = async ( + input: TimestampFormatHeadersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.memberEpochSeconds) && { + "x-memberepochseconds": Math.round(input.memberEpochSeconds!.getTime() / 1000).toString(), + }), + ...(isSerializableHeaderValue(input.memberHttpDate) && { + "x-memberhttpdate": __dateToUtcString(input.memberHttpDate!).toString(), + }), + ...(isSerializableHeaderValue(input.memberDateTime) && { + "x-memberdatetime": (input.memberDateTime!.toISOString().split(".")[0] + "Z").toString(), + }), + ...(isSerializableHeaderValue(input.defaultFormat) && { + "x-defaultformat": __dateToUtcString(input.defaultFormat!).toString(), + }), + ...(isSerializableHeaderValue(input.targetEpochSeconds) && { + "x-targetepochseconds": Math.round(input.targetEpochSeconds!.getTime() / 1000).toString(), + }), + ...(isSerializableHeaderValue(input.targetHttpDate) && { + "x-targethttpdate": __dateToUtcString(input.targetHttpDate!).toString(), + }), + ...(isSerializableHeaderValue(input.targetDateTime) && { + "x-targetdatetime": (input.targetDateTime!.toISOString().split(".")[0] + "Z").toString(), + }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TimestampFormatHeaders"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const deserializeAws_restJson1AllQueryStringTypesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1AllQueryStringTypesCommandError(output, context); + } + const contents: AllQueryStringTypesCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1AllQueryStringTypesCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1ConstantAndVariableQueryStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1ConstantAndVariableQueryStringCommandError(output, context); + } + const contents: ConstantAndVariableQueryStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1ConstantAndVariableQueryStringCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1ConstantQueryStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1ConstantQueryStringCommandError(output, context); + } + const contents: ConstantQueryStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1ConstantQueryStringCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1DocumentTypeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1DocumentTypeCommandError(output, context); + } + const contents: DocumentTypeCommandOutput = { + $metadata: deserializeMetadata(output), + documentValue: undefined, + stringValue: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.documentValue !== undefined && data.documentValue !== null) { + contents.documentValue = deserializeAws_restJson1Document(data.documentValue, context); + } + if (data.stringValue !== undefined && data.stringValue !== null) { + contents.stringValue = __expectString(data.stringValue); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1DocumentTypeCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1DocumentTypeAsPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1DocumentTypeAsPayloadCommandError(output, context); + } + const contents: DocumentTypeAsPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + documentValue: undefined, + }; + const data: any = await collectBodyString(output.body, context); + contents.documentValue = data; + contents.documentValue = JSON.parse(data); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1DocumentTypeAsPayloadCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1EmptyInputAndEmptyOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1EmptyInputAndEmptyOutputCommandError(output, context); + } + const contents: EmptyInputAndEmptyOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1EmptyInputAndEmptyOutputCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1EndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1EndpointOperationCommandError(output, context); + } + const contents: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1EndpointOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1EndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1EndpointWithHostLabelOperationCommandError(output, context); + } + const contents: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1EndpointWithHostLabelOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1GreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1GreetingWithErrorsCommandError(output, context); + } + const contents: GreetingWithErrorsCommandOutput = { + $metadata: deserializeMetadata(output), + greeting: undefined, + }; + if (output.headers["x-greeting"] !== undefined) { + contents.greeting = output.headers["x-greeting"]; + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1GreetingWithErrorsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "ComplexError": + case "aws.protocoltests.restjson#ComplexError": + response = { + ...(await deserializeAws_restJson1ComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "FooError": + case "aws.protocoltests.restjson#FooError": + response = { + ...(await deserializeAws_restJson1FooErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.restjson#InvalidGreeting": + response = { + ...(await deserializeAws_restJson1InvalidGreetingResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HostWithPathOperationCommandError(output, context); + } + const contents: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpChecksumRequiredCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpChecksumRequiredCommandError(output, context); + } + const contents: HttpChecksumRequiredCommandOutput = { + $metadata: deserializeMetadata(output), + foo: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.foo !== undefined && data.foo !== null) { + contents.foo = __expectString(data.foo); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpChecksumRequiredCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpEnumPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpEnumPayloadCommandError(output, context); + } + const contents: HttpEnumPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + payload: undefined, + }; + const data: any = await collectBodyString(output.body, context); + contents.payload = __expectString(data); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpEnumPayloadCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpPayloadTraitsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpPayloadTraitsCommandError(output, context); + } + const contents: HttpPayloadTraitsCommandOutput = { + $metadata: deserializeMetadata(output), + blob: undefined, + foo: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: any = await collectBody(output.body, context); + contents.blob = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpPayloadTraitsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommandError(output, context); + } + const contents: HttpPayloadTraitsWithMediaTypeCommandOutput = { + $metadata: deserializeMetadata(output), + blob: undefined, + foo: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: any = await collectBody(output.body, context); + contents.blob = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpPayloadWithStructureCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpPayloadWithStructureCommandError(output, context); + } + const contents: HttpPayloadWithStructureCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.nested = deserializeAws_restJson1NestedPayload(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpPayloadWithStructureCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpPrefixHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpPrefixHeadersCommandError(output, context); + } + const contents: HttpPrefixHeadersCommandOutput = { + $metadata: deserializeMetadata(output), + foo: undefined, + fooMap: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + Object.keys(output.headers).forEach((header) => { + if (contents.fooMap === undefined) { + contents.fooMap = {}; + } + if (header.startsWith("x-foo-")) { + contents.fooMap[header.substring(6)] = output.headers[header]; + } + }); + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpPrefixHeadersCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpPrefixHeadersResponseCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpPrefixHeadersResponseCommandError(output, context); + } + const contents: HttpPrefixHeadersResponseCommandOutput = { + $metadata: deserializeMetadata(output), + prefixHeaders: undefined, + }; + Object.keys(output.headers).forEach((header) => { + if (contents.prefixHeaders === undefined) { + contents.prefixHeaders = {}; + } + if (header.startsWith("")) { + contents.prefixHeaders[header.substring(0)] = output.headers[header]; + } + }); + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpPrefixHeadersResponseCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpRequestWithFloatLabelsCommandError(output, context); + } + const contents: HttpRequestWithFloatLabelsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpRequestWithFloatLabelsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommandError(output, context); + } + const contents: HttpRequestWithGreedyLabelInPathCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpRequestWithLabelsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpRequestWithLabelsCommandError(output, context); + } + const contents: HttpRequestWithLabelsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpRequestWithLabelsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommandError(output, context); + } + const contents: HttpRequestWithLabelsAndTimestampFormatCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpResponseCodeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpResponseCodeCommandError(output, context); + } + const contents: HttpResponseCodeCommandOutput = { + $metadata: deserializeMetadata(output), + Status: undefined, + }; + if (contents.Status === undefined) { + contents.Status = output.statusCode; + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpResponseCodeCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1HttpStringPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HttpStringPayloadCommandError(output, context); + } + const contents: HttpStringPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + payload: undefined, + }; + const data: any = await collectBodyString(output.body, context); + contents.payload = __expectString(data); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HttpStringPayloadCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1IgnoreQueryParamsInResponseCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1IgnoreQueryParamsInResponseCommandError(output, context); + } + const contents: IgnoreQueryParamsInResponseCommandOutput = { + $metadata: deserializeMetadata(output), + baz: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.baz !== undefined && data.baz !== null) { + contents.baz = __expectString(data.baz); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1IgnoreQueryParamsInResponseCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1InputAndOutputWithHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1InputAndOutputWithHeadersCommandError(output, context); + } + const contents: InputAndOutputWithHeadersCommandOutput = { + $metadata: deserializeMetadata(output), + headerBooleanList: undefined, + headerByte: undefined, + headerDouble: undefined, + headerEnum: undefined, + headerEnumList: undefined, + headerFalseBool: undefined, + headerFloat: undefined, + headerInteger: undefined, + headerIntegerList: undefined, + headerLong: undefined, + headerShort: undefined, + headerString: undefined, + headerStringList: undefined, + headerStringSet: undefined, + headerTimestampList: undefined, + headerTrueBool: undefined, + }; + if (output.headers["x-string"] !== undefined) { + contents.headerString = output.headers["x-string"]; + } + if (output.headers["x-byte"] !== undefined) { + contents.headerByte = __strictParseByte(output.headers["x-byte"]); + } + if (output.headers["x-short"] !== undefined) { + contents.headerShort = __strictParseShort(output.headers["x-short"]); + } + if (output.headers["x-integer"] !== undefined) { + contents.headerInteger = __strictParseInt32(output.headers["x-integer"]); + } + if (output.headers["x-long"] !== undefined) { + contents.headerLong = __strictParseLong(output.headers["x-long"]); + } + if (output.headers["x-float"] !== undefined) { + contents.headerFloat = __strictParseFloat(output.headers["x-float"]); + } + if (output.headers["x-double"] !== undefined) { + contents.headerDouble = __strictParseDouble(output.headers["x-double"]); + } + if (output.headers["x-boolean1"] !== undefined) { + contents.headerTrueBool = __parseBoolean(output.headers["x-boolean1"]); + } + if (output.headers["x-boolean2"] !== undefined) { + contents.headerFalseBool = __parseBoolean(output.headers["x-boolean2"]); + } + if (output.headers["x-stringlist"] !== undefined) { + contents.headerStringList = (output.headers["x-stringlist"] || "").split(",").map((_entry) => _entry.trim() as any); + } + if (output.headers["x-stringset"] !== undefined) { + contents.headerStringSet = (output.headers["x-stringset"] || "").split(",").map((_entry) => _entry.trim() as any); + } + if (output.headers["x-integerlist"] !== undefined) { + contents.headerIntegerList = (output.headers["x-integerlist"] || "") + .split(",") + .map((_entry) => __strictParseInt32(_entry.trim()) as any); + } + if (output.headers["x-booleanlist"] !== undefined) { + contents.headerBooleanList = (output.headers["x-booleanlist"] || "") + .split(",") + .map((_entry) => __parseBoolean(_entry.trim()) as any); + } + if (output.headers["x-timestamplist"] !== undefined) { + contents.headerTimestampList = __splitEvery(output.headers["x-timestamplist"] || "", ",", 2).map( + (_entry) => __expectNonNull(__parseRfc7231DateTime(_entry.trim())) as any + ); + } + if (output.headers["x-enum"] !== undefined) { + contents.headerEnum = output.headers["x-enum"]; + } + if (output.headers["x-enumlist"] !== undefined) { + contents.headerEnumList = (output.headers["x-enumlist"] || "").split(",").map((_entry) => _entry.trim() as any); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1InputAndOutputWithHeadersCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1JsonBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonBlobsCommandError(output, context); + } + const contents: JsonBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + data: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.data !== undefined && data.data !== null) { + contents.data = context.base64Decoder(data.data); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonBlobsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1JsonEnumsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonEnumsCommandError(output, context); + } + const contents: JsonEnumsCommandOutput = { + $metadata: deserializeMetadata(output), + fooEnum1: undefined, + fooEnum2: undefined, + fooEnum3: undefined, + fooEnumList: undefined, + fooEnumMap: undefined, + fooEnumSet: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.fooEnum1 !== undefined && data.fooEnum1 !== null) { + contents.fooEnum1 = __expectString(data.fooEnum1); + } + if (data.fooEnum2 !== undefined && data.fooEnum2 !== null) { + contents.fooEnum2 = __expectString(data.fooEnum2); + } + if (data.fooEnum3 !== undefined && data.fooEnum3 !== null) { + contents.fooEnum3 = __expectString(data.fooEnum3); + } + if (data.fooEnumList !== undefined && data.fooEnumList !== null) { + contents.fooEnumList = deserializeAws_restJson1FooEnumList(data.fooEnumList, context); + } + if (data.fooEnumMap !== undefined && data.fooEnumMap !== null) { + contents.fooEnumMap = deserializeAws_restJson1FooEnumMap(data.fooEnumMap, context); + } + if (data.fooEnumSet !== undefined && data.fooEnumSet !== null) { + contents.fooEnumSet = deserializeAws_restJson1FooEnumSet(data.fooEnumSet, context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonEnumsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1JsonListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonListsCommandError(output, context); + } + const contents: JsonListsCommandOutput = { + $metadata: deserializeMetadata(output), + booleanList: undefined, + enumList: undefined, + integerList: undefined, + nestedStringList: undefined, + sparseStringList: undefined, + stringList: undefined, + stringSet: undefined, + structureList: undefined, + timestampList: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.booleanList !== undefined && data.booleanList !== null) { + contents.booleanList = deserializeAws_restJson1BooleanList(data.booleanList, context); + } + if (data.enumList !== undefined && data.enumList !== null) { + contents.enumList = deserializeAws_restJson1FooEnumList(data.enumList, context); + } + if (data.integerList !== undefined && data.integerList !== null) { + contents.integerList = deserializeAws_restJson1IntegerList(data.integerList, context); + } + if (data.nestedStringList !== undefined && data.nestedStringList !== null) { + contents.nestedStringList = deserializeAws_restJson1NestedStringList(data.nestedStringList, context); + } + if (data.sparseStringList !== undefined && data.sparseStringList !== null) { + contents.sparseStringList = deserializeAws_restJson1SparseStringList(data.sparseStringList, context); + } + if (data.stringList !== undefined && data.stringList !== null) { + contents.stringList = deserializeAws_restJson1StringList(data.stringList, context); + } + if (data.stringSet !== undefined && data.stringSet !== null) { + contents.stringSet = deserializeAws_restJson1StringSet(data.stringSet, context); + } + if (data.myStructureList !== undefined && data.myStructureList !== null) { + contents.structureList = deserializeAws_restJson1StructureList(data.myStructureList, context); + } + if (data.timestampList !== undefined && data.timestampList !== null) { + contents.timestampList = deserializeAws_restJson1TimestampList(data.timestampList, context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonListsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1JsonMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonMapsCommandError(output, context); + } + const contents: JsonMapsCommandOutput = { + $metadata: deserializeMetadata(output), + denseBooleanMap: undefined, + denseNumberMap: undefined, + denseSetMap: undefined, + denseStringMap: undefined, + denseStructMap: undefined, + sparseBooleanMap: undefined, + sparseNumberMap: undefined, + sparseSetMap: undefined, + sparseStringMap: undefined, + sparseStructMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.denseBooleanMap !== undefined && data.denseBooleanMap !== null) { + contents.denseBooleanMap = deserializeAws_restJson1DenseBooleanMap(data.denseBooleanMap, context); + } + if (data.denseNumberMap !== undefined && data.denseNumberMap !== null) { + contents.denseNumberMap = deserializeAws_restJson1DenseNumberMap(data.denseNumberMap, context); + } + if (data.denseSetMap !== undefined && data.denseSetMap !== null) { + contents.denseSetMap = deserializeAws_restJson1DenseSetMap(data.denseSetMap, context); + } + if (data.denseStringMap !== undefined && data.denseStringMap !== null) { + contents.denseStringMap = deserializeAws_restJson1DenseStringMap(data.denseStringMap, context); + } + if (data.denseStructMap !== undefined && data.denseStructMap !== null) { + contents.denseStructMap = deserializeAws_restJson1DenseStructMap(data.denseStructMap, context); + } + if (data.sparseBooleanMap !== undefined && data.sparseBooleanMap !== null) { + contents.sparseBooleanMap = deserializeAws_restJson1SparseBooleanMap(data.sparseBooleanMap, context); + } + if (data.sparseNumberMap !== undefined && data.sparseNumberMap !== null) { + contents.sparseNumberMap = deserializeAws_restJson1SparseNumberMap(data.sparseNumberMap, context); + } + if (data.sparseSetMap !== undefined && data.sparseSetMap !== null) { + contents.sparseSetMap = deserializeAws_restJson1SparseSetMap(data.sparseSetMap, context); + } + if (data.sparseStringMap !== undefined && data.sparseStringMap !== null) { + contents.sparseStringMap = deserializeAws_restJson1SparseStringMap(data.sparseStringMap, context); + } + if (data.sparseStructMap !== undefined && data.sparseStructMap !== null) { + contents.sparseStructMap = deserializeAws_restJson1SparseStructMap(data.sparseStructMap, context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonMapsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1AllQueryStringTypesCommand = async ( +export const deserializeAws_restJson1JsonTimestampsCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1AllQueryStringTypesCommandError(output, context); + return deserializeAws_restJson1JsonTimestampsCommandError(output, context); } - const contents: AllQueryStringTypesCommandOutput = { + const contents: JsonTimestampsCommandOutput = { $metadata: deserializeMetadata(output), + dateTime: undefined, + epochSeconds: undefined, + httpDate: undefined, + normal: undefined, }; - await collectBody(output.body, context); + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.dateTime !== undefined && data.dateTime !== null) { + contents.dateTime = __expectNonNull(__parseRfc3339DateTime(data.dateTime)); + } + if (data.epochSeconds !== undefined && data.epochSeconds !== null) { + contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSeconds))); + } + if (data.httpDate !== undefined && data.httpDate !== null) { + contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data.httpDate)); + } + if (data.normal !== undefined && data.normal !== null) { + contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); + } return Promise.resolve(contents); }; -const deserializeAws_restJson1AllQueryStringTypesCommandError = async ( +const deserializeAws_restJson1JsonTimestampsCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1716,24 +4269,28 @@ const deserializeAws_restJson1AllQueryStringTypesCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1ConstantAndVariableQueryStringCommand = async ( +export const deserializeAws_restJson1JsonUnionsCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1ConstantAndVariableQueryStringCommandError(output, context); + return deserializeAws_restJson1JsonUnionsCommandError(output, context); } - const contents: ConstantAndVariableQueryStringCommandOutput = { + const contents: JsonUnionsCommandOutput = { $metadata: deserializeMetadata(output), + contents: undefined, }; - await collectBody(output.body, context); + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.contents !== undefined && data.contents !== null) { + contents.contents = deserializeAws_restJson1MyUnion(__expectUnion(data.contents), context); + } return Promise.resolve(contents); }; -const deserializeAws_restJson1ConstantAndVariableQueryStringCommandError = async ( +const deserializeAws_restJson1JsonUnionsCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1759,24 +4316,28 @@ const deserializeAws_restJson1ConstantAndVariableQueryStringCommandError = async return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1ConstantQueryStringCommand = async ( +export const deserializeAws_restJson1MalformedAcceptWithBodyCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1ConstantQueryStringCommandError(output, context); + return deserializeAws_restJson1MalformedAcceptWithBodyCommandError(output, context); } - const contents: ConstantQueryStringCommandOutput = { + const contents: MalformedAcceptWithBodyCommandOutput = { $metadata: deserializeMetadata(output), + hi: undefined, }; - await collectBody(output.body, context); + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.hi !== undefined && data.hi !== null) { + contents.hi = __expectString(data.hi); + } return Promise.resolve(contents); }; -const deserializeAws_restJson1ConstantQueryStringCommandError = async ( +const deserializeAws_restJson1MalformedAcceptWithBodyCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1802,32 +4363,24 @@ const deserializeAws_restJson1ConstantQueryStringCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1DocumentTypeCommand = async ( +export const deserializeAws_restJson1MalformedAcceptWithGenericStringCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1DocumentTypeCommandError(output, context); + return deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError(output, context); } - const contents: DocumentTypeCommandOutput = { + const contents: MalformedAcceptWithGenericStringCommandOutput = { $metadata: deserializeMetadata(output), - documentValue: undefined, - stringValue: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.documentValue !== undefined && data.documentValue !== null) { - contents.documentValue = deserializeAws_restJson1Document(data.documentValue, context); - } - if (data.stringValue !== undefined && data.stringValue !== null) { - contents.stringValue = __expectString(data.stringValue); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1DocumentTypeCommandError = async ( +const deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1853,27 +4406,26 @@ const deserializeAws_restJson1DocumentTypeCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1DocumentTypeAsPayloadCommand = async ( +export const deserializeAws_restJson1MalformedAcceptWithPayloadCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1DocumentTypeAsPayloadCommandError(output, context); + return deserializeAws_restJson1MalformedAcceptWithPayloadCommandError(output, context); } - const contents: DocumentTypeAsPayloadCommandOutput = { + const contents: MalformedAcceptWithPayloadCommandOutput = { $metadata: deserializeMetadata(output), - documentValue: undefined, + payload: undefined, }; - const data: any = await collectBodyString(output.body, context); - contents.documentValue = data; - contents.documentValue = JSON.parse(data); + const data: any = await collectBody(output.body, context); + contents.payload = data; return Promise.resolve(contents); }; -const deserializeAws_restJson1DocumentTypeAsPayloadCommandError = async ( +const deserializeAws_restJson1MalformedAcceptWithPayloadCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1899,24 +4451,24 @@ const deserializeAws_restJson1DocumentTypeAsPayloadCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1EmptyInputAndEmptyOutputCommand = async ( +export const deserializeAws_restJson1MalformedBlobCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1EmptyInputAndEmptyOutputCommandError(output, context); + return deserializeAws_restJson1MalformedBlobCommandError(output, context); } - const contents: EmptyInputAndEmptyOutputCommandOutput = { + const contents: MalformedBlobCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1EmptyInputAndEmptyOutputCommandError = async ( +const deserializeAws_restJson1MalformedBlobCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1942,24 +4494,24 @@ const deserializeAws_restJson1EmptyInputAndEmptyOutputCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1EndpointOperationCommand = async ( +export const deserializeAws_restJson1MalformedBooleanCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1EndpointOperationCommandError(output, context); + return deserializeAws_restJson1MalformedBooleanCommandError(output, context); } - const contents: EndpointOperationCommandOutput = { + const contents: MalformedBooleanCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1EndpointOperationCommandError = async ( +const deserializeAws_restJson1MalformedBooleanCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -1985,24 +4537,24 @@ const deserializeAws_restJson1EndpointOperationCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1EndpointWithHostLabelOperationCommand = async ( +export const deserializeAws_restJson1MalformedByteCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1EndpointWithHostLabelOperationCommandError(output, context); + return deserializeAws_restJson1MalformedByteCommandError(output, context); } - const contents: EndpointWithHostLabelOperationCommandOutput = { + const contents: MalformedByteCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1EndpointWithHostLabelOperationCommandError = async ( +const deserializeAws_restJson1MalformedByteCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2028,28 +4580,24 @@ const deserializeAws_restJson1EndpointWithHostLabelOperationCommandError = async return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1GreetingWithErrorsCommand = async ( +export const deserializeAws_restJson1MalformedContentTypeWithBodyCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1GreetingWithErrorsCommandError(output, context); + return deserializeAws_restJson1MalformedContentTypeWithBodyCommandError(output, context); } - const contents: GreetingWithErrorsCommandOutput = { + const contents: MalformedContentTypeWithBodyCommandOutput = { $metadata: deserializeMetadata(output), - greeting: undefined, }; - if (output.headers["x-greeting"] !== undefined) { - contents.greeting = output.headers["x-greeting"]; - } await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1GreetingWithErrorsCommandError = async ( +const deserializeAws_restJson1MalformedContentTypeWithBodyCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2058,30 +4606,92 @@ const deserializeAws_restJson1GreetingWithErrorsCommandError = async ( let errorCode = "UnknownError"; errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { - case "ComplexError": - case "aws.protocoltests.restjson#ComplexError": - response = { - ...(await deserializeAws_restJson1ComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "FooError": - case "aws.protocoltests.restjson#FooError": + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; response = { - ...(await deserializeAws_restJson1FooErrorResponse(parsedOutput, context)), - name: errorCode, + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.restjson#InvalidGreeting": + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1MalformedContentTypeWithGenericStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedContentTypeWithGenericStringCommandError(output, context); + } + const contents: MalformedContentTypeWithGenericStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedContentTypeWithGenericStringCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; response = { - ...(await deserializeAws_restJson1InvalidGreetingResponse(parsedOutput, context)), - name: errorCode, + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", $metadata: deserializeMetadata(output), - }; - break; + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1MalformedContentTypeWithoutBodyCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedContentTypeWithoutBodyCommandError(output, context); + } + const contents: MalformedContentTypeWithoutBodyCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedContentTypeWithoutBodyCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { default: const parsedBody = parsedOutput.body; errorCode = parsedBody.code || parsedBody.Code || errorCode; @@ -2099,24 +4709,24 @@ const deserializeAws_restJson1GreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HostWithPathOperationCommand = async ( +export const deserializeAws_restJson1MalformedContentTypeWithPayloadCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HostWithPathOperationCommandError(output, context); + return deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError(output, context); } - const contents: HostWithPathOperationCommandOutput = { + const contents: MalformedContentTypeWithPayloadCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HostWithPathOperationCommandError = async ( +const deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2142,28 +4752,24 @@ const deserializeAws_restJson1HostWithPathOperationCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpChecksumRequiredCommand = async ( +export const deserializeAws_restJson1MalformedDoubleCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpChecksumRequiredCommandError(output, context); + return deserializeAws_restJson1MalformedDoubleCommandError(output, context); } - const contents: HttpChecksumRequiredCommandOutput = { + const contents: MalformedDoubleCommandOutput = { $metadata: deserializeMetadata(output), - foo: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.foo !== undefined && data.foo !== null) { - contents.foo = __expectString(data.foo); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpChecksumRequiredCommandError = async ( +const deserializeAws_restJson1MalformedDoubleCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2189,26 +4795,24 @@ const deserializeAws_restJson1HttpChecksumRequiredCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpEnumPayloadCommand = async ( +export const deserializeAws_restJson1MalformedFloatCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpEnumPayloadCommandError(output, context); + return deserializeAws_restJson1MalformedFloatCommandError(output, context); } - const contents: HttpEnumPayloadCommandOutput = { + const contents: MalformedFloatCommandOutput = { $metadata: deserializeMetadata(output), - payload: undefined, }; - const data: any = await collectBodyString(output.body, context); - contents.payload = __expectString(data); + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpEnumPayloadCommandError = async ( +const deserializeAws_restJson1MalformedFloatCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2234,30 +4838,24 @@ const deserializeAws_restJson1HttpEnumPayloadCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpPayloadTraitsCommand = async ( +export const deserializeAws_restJson1MalformedIntegerCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpPayloadTraitsCommandError(output, context); + return deserializeAws_restJson1MalformedIntegerCommandError(output, context); } - const contents: HttpPayloadTraitsCommandOutput = { + const contents: MalformedIntegerCommandOutput = { $metadata: deserializeMetadata(output), - blob: undefined, - foo: undefined, }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: any = await collectBody(output.body, context); - contents.blob = data; + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpPayloadTraitsCommandError = async ( +const deserializeAws_restJson1MalformedIntegerCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2283,30 +4881,24 @@ const deserializeAws_restJson1HttpPayloadTraitsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand = async ( +export const deserializeAws_restJson1MalformedListCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommandError(output, context); + return deserializeAws_restJson1MalformedListCommandError(output, context); } - const contents: HttpPayloadTraitsWithMediaTypeCommandOutput = { + const contents: MalformedListCommandOutput = { $metadata: deserializeMetadata(output), - blob: undefined, - foo: undefined, }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: any = await collectBody(output.body, context); - contents.blob = data; + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommandError = async ( +const deserializeAws_restJson1MalformedListCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2332,26 +4924,24 @@ const deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommandError = async return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpPayloadWithStructureCommand = async ( +export const deserializeAws_restJson1MalformedLongCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpPayloadWithStructureCommandError(output, context); + return deserializeAws_restJson1MalformedLongCommandError(output, context); } - const contents: HttpPayloadWithStructureCommandOutput = { + const contents: MalformedLongCommandOutput = { $metadata: deserializeMetadata(output), - nested: undefined, }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = deserializeAws_restJson1NestedPayload(data, context); + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpPayloadWithStructureCommandError = async ( +const deserializeAws_restJson1MalformedLongCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2377,37 +4967,24 @@ const deserializeAws_restJson1HttpPayloadWithStructureCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpPrefixHeadersCommand = async ( +export const deserializeAws_restJson1MalformedMapCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpPrefixHeadersCommandError(output, context); + return deserializeAws_restJson1MalformedMapCommandError(output, context); } - const contents: HttpPrefixHeadersCommandOutput = { + const contents: MalformedMapCommandOutput = { $metadata: deserializeMetadata(output), - foo: undefined, - fooMap: undefined, }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - Object.keys(output.headers).forEach((header) => { - if (contents.fooMap === undefined) { - contents.fooMap = {}; - } - if (header.startsWith("x-foo-")) { - contents.fooMap[header.substring(6)] = output.headers[header]; - } - }); await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpPrefixHeadersCommandError = async ( +const deserializeAws_restJson1MalformedMapCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2433,33 +5010,24 @@ const deserializeAws_restJson1HttpPrefixHeadersCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpPrefixHeadersResponseCommand = async ( +export const deserializeAws_restJson1MalformedRequestBodyCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpPrefixHeadersResponseCommandError(output, context); + return deserializeAws_restJson1MalformedRequestBodyCommandError(output, context); } - const contents: HttpPrefixHeadersResponseCommandOutput = { + const contents: MalformedRequestBodyCommandOutput = { $metadata: deserializeMetadata(output), - prefixHeaders: undefined, }; - Object.keys(output.headers).forEach((header) => { - if (contents.prefixHeaders === undefined) { - contents.prefixHeaders = {}; - } - if (header.startsWith("")) { - contents.prefixHeaders[header.substring(0)] = output.headers[header]; - } - }); await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpPrefixHeadersResponseCommandError = async ( +const deserializeAws_restJson1MalformedRequestBodyCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2485,24 +5053,24 @@ const deserializeAws_restJson1HttpPrefixHeadersResponseCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( +export const deserializeAws_restJson1MalformedSetCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpRequestWithFloatLabelsCommandError(output, context); + return deserializeAws_restJson1MalformedSetCommandError(output, context); } - const contents: HttpRequestWithFloatLabelsCommandOutput = { + const contents: MalformedSetCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpRequestWithFloatLabelsCommandError = async ( +const deserializeAws_restJson1MalformedSetCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2528,24 +5096,24 @@ const deserializeAws_restJson1HttpRequestWithFloatLabelsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = async ( +export const deserializeAws_restJson1MalformedShortCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommandError(output, context); + return deserializeAws_restJson1MalformedShortCommandError(output, context); } - const contents: HttpRequestWithGreedyLabelInPathCommandOutput = { + const contents: MalformedShortCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommandError = async ( +const deserializeAws_restJson1MalformedShortCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2571,24 +5139,24 @@ const deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommandError = asy return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpRequestWithLabelsCommand = async ( +export const deserializeAws_restJson1MalformedStringCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpRequestWithLabelsCommandError(output, context); + return deserializeAws_restJson1MalformedStringCommandError(output, context); } - const contents: HttpRequestWithLabelsCommandOutput = { + const contents: MalformedStringCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpRequestWithLabelsCommandError = async ( +const deserializeAws_restJson1MalformedStringCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2614,24 +5182,24 @@ const deserializeAws_restJson1HttpRequestWithLabelsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand = async ( +export const deserializeAws_restJson1MalformedTimestampBodyDateTimeCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError(output, context); } - const contents: HttpRequestWithLabelsAndTimestampFormatCommandOutput = { + const contents: MalformedTimestampBodyDateTimeCommandOutput = { $metadata: deserializeMetadata(output), }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommandError = async ( +const deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2657,28 +5225,24 @@ const deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommandErro return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpResponseCodeCommand = async ( +export const deserializeAws_restJson1MalformedTimestampBodyDefaultCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpResponseCodeCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError(output, context); } - const contents: HttpResponseCodeCommandOutput = { + const contents: MalformedTimestampBodyDefaultCommandOutput = { $metadata: deserializeMetadata(output), - Status: undefined, }; - if (contents.Status === undefined) { - contents.Status = output.statusCode; - } await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpResponseCodeCommandError = async ( +const deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2704,26 +5268,24 @@ const deserializeAws_restJson1HttpResponseCodeCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1HttpStringPayloadCommand = async ( +export const deserializeAws_restJson1MalformedTimestampBodyHttpDateCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1HttpStringPayloadCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError(output, context); } - const contents: HttpStringPayloadCommandOutput = { + const contents: MalformedTimestampBodyHttpDateCommandOutput = { $metadata: deserializeMetadata(output), - payload: undefined, }; - const data: any = await collectBodyString(output.body, context); - contents.payload = __expectString(data); + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1HttpStringPayloadCommandError = async ( +const deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2749,28 +5311,24 @@ const deserializeAws_restJson1HttpStringPayloadCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1IgnoreQueryParamsInResponseCommand = async ( +export const deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1IgnoreQueryParamsInResponseCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError(output, context); } - const contents: IgnoreQueryParamsInResponseCommandOutput = { + const contents: MalformedTimestampHeaderDateTimeCommandOutput = { $metadata: deserializeMetadata(output), - baz: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.baz !== undefined && data.baz !== null) { - contents.baz = __expectString(data.baz); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1IgnoreQueryParamsInResponseCommandError = async ( +const deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2796,94 +5354,67 @@ const deserializeAws_restJson1IgnoreQueryParamsInResponseCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1InputAndOutputWithHeadersCommand = async ( +export const deserializeAws_restJson1MalformedTimestampHeaderDefaultCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1InputAndOutputWithHeadersCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampHeaderDefaultCommandError(output, context); } - const contents: InputAndOutputWithHeadersCommandOutput = { + const contents: MalformedTimestampHeaderDefaultCommandOutput = { $metadata: deserializeMetadata(output), - headerBooleanList: undefined, - headerByte: undefined, - headerDouble: undefined, - headerEnum: undefined, - headerEnumList: undefined, - headerFalseBool: undefined, - headerFloat: undefined, - headerInteger: undefined, - headerIntegerList: undefined, - headerLong: undefined, - headerShort: undefined, - headerString: undefined, - headerStringList: undefined, - headerStringSet: undefined, - headerTimestampList: undefined, - headerTrueBool: undefined, }; - if (output.headers["x-string"] !== undefined) { - contents.headerString = output.headers["x-string"]; - } - if (output.headers["x-byte"] !== undefined) { - contents.headerByte = __strictParseByte(output.headers["x-byte"]); - } - if (output.headers["x-short"] !== undefined) { - contents.headerShort = __strictParseShort(output.headers["x-short"]); - } - if (output.headers["x-integer"] !== undefined) { - contents.headerInteger = __strictParseInt32(output.headers["x-integer"]); - } - if (output.headers["x-long"] !== undefined) { - contents.headerLong = __strictParseLong(output.headers["x-long"]); - } - if (output.headers["x-float"] !== undefined) { - contents.headerFloat = __strictParseFloat(output.headers["x-float"]); - } - if (output.headers["x-double"] !== undefined) { - contents.headerDouble = __strictParseDouble(output.headers["x-double"]); - } - if (output.headers["x-boolean1"] !== undefined) { - contents.headerTrueBool = __parseBoolean(output.headers["x-boolean1"]); - } - if (output.headers["x-boolean2"] !== undefined) { - contents.headerFalseBool = __parseBoolean(output.headers["x-boolean2"]); - } - if (output.headers["x-stringlist"] !== undefined) { - contents.headerStringList = (output.headers["x-stringlist"] || "").split(",").map((_entry) => _entry.trim() as any); - } - if (output.headers["x-stringset"] !== undefined) { - contents.headerStringSet = (output.headers["x-stringset"] || "").split(",").map((_entry) => _entry.trim() as any); - } - if (output.headers["x-integerlist"] !== undefined) { - contents.headerIntegerList = (output.headers["x-integerlist"] || "") - .split(",") - .map((_entry) => __strictParseInt32(_entry.trim()) as any); - } - if (output.headers["x-booleanlist"] !== undefined) { - contents.headerBooleanList = (output.headers["x-booleanlist"] || "") - .split(",") - .map((_entry) => __parseBoolean(_entry.trim()) as any); - } - if (output.headers["x-timestamplist"] !== undefined) { - contents.headerTimestampList = __splitEvery(output.headers["x-timestamplist"] || "", ",", 2).map( - (_entry) => __expectNonNull(__parseRfc7231DateTime(_entry.trim())) as any - ); - } - if (output.headers["x-enum"] !== undefined) { - contents.headerEnum = output.headers["x-enum"]; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampHeaderDefaultCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; } - if (output.headers["x-enumlist"] !== undefined) { - contents.headerEnumList = (output.headers["x-enumlist"] || "").split(",").map((_entry) => _entry.trim() as any); + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1MalformedTimestampHeaderEpochCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampHeaderEpochCommandError(output, context); } + const contents: MalformedTimestampHeaderEpochCommandOutput = { + $metadata: deserializeMetadata(output), + }; await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1InputAndOutputWithHeadersCommandError = async ( +const deserializeAws_restJson1MalformedTimestampHeaderEpochCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2909,28 +5440,24 @@ const deserializeAws_restJson1InputAndOutputWithHeadersCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonBlobsCommand = async ( +export const deserializeAws_restJson1MalformedTimestampPathDefaultCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonBlobsCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampPathDefaultCommandError(output, context); } - const contents: JsonBlobsCommandOutput = { + const contents: MalformedTimestampPathDefaultCommandOutput = { $metadata: deserializeMetadata(output), - data: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.data !== undefined && data.data !== null) { - contents.data = context.base64Decoder(data.data); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonBlobsCommandError = async ( +const deserializeAws_restJson1MalformedTimestampPathDefaultCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -2956,48 +5483,24 @@ const deserializeAws_restJson1JsonBlobsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonEnumsCommand = async ( +export const deserializeAws_restJson1MalformedTimestampPathEpochCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonEnumsCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampPathEpochCommandError(output, context); } - const contents: JsonEnumsCommandOutput = { + const contents: MalformedTimestampPathEpochCommandOutput = { $metadata: deserializeMetadata(output), - fooEnum1: undefined, - fooEnum2: undefined, - fooEnum3: undefined, - fooEnumList: undefined, - fooEnumMap: undefined, - fooEnumSet: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.fooEnum1 !== undefined && data.fooEnum1 !== null) { - contents.fooEnum1 = __expectString(data.fooEnum1); - } - if (data.fooEnum2 !== undefined && data.fooEnum2 !== null) { - contents.fooEnum2 = __expectString(data.fooEnum2); - } - if (data.fooEnum3 !== undefined && data.fooEnum3 !== null) { - contents.fooEnum3 = __expectString(data.fooEnum3); - } - if (data.fooEnumList !== undefined && data.fooEnumList !== null) { - contents.fooEnumList = deserializeAws_restJson1FooEnumList(data.fooEnumList, context); - } - if (data.fooEnumMap !== undefined && data.fooEnumMap !== null) { - contents.fooEnumMap = deserializeAws_restJson1FooEnumMap(data.fooEnumMap, context); - } - if (data.fooEnumSet !== undefined && data.fooEnumSet !== null) { - contents.fooEnumSet = deserializeAws_restJson1FooEnumSet(data.fooEnumSet, context); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonEnumsCommandError = async ( +const deserializeAws_restJson1MalformedTimestampPathEpochCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -3023,60 +5526,24 @@ const deserializeAws_restJson1JsonEnumsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonListsCommand = async ( +export const deserializeAws_restJson1MalformedTimestampPathHttpDateCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonListsCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError(output, context); } - const contents: JsonListsCommandOutput = { + const contents: MalformedTimestampPathHttpDateCommandOutput = { $metadata: deserializeMetadata(output), - booleanList: undefined, - enumList: undefined, - integerList: undefined, - nestedStringList: undefined, - sparseStringList: undefined, - stringList: undefined, - stringSet: undefined, - structureList: undefined, - timestampList: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.booleanList !== undefined && data.booleanList !== null) { - contents.booleanList = deserializeAws_restJson1BooleanList(data.booleanList, context); - } - if (data.enumList !== undefined && data.enumList !== null) { - contents.enumList = deserializeAws_restJson1FooEnumList(data.enumList, context); - } - if (data.integerList !== undefined && data.integerList !== null) { - contents.integerList = deserializeAws_restJson1IntegerList(data.integerList, context); - } - if (data.nestedStringList !== undefined && data.nestedStringList !== null) { - contents.nestedStringList = deserializeAws_restJson1NestedStringList(data.nestedStringList, context); - } - if (data.sparseStringList !== undefined && data.sparseStringList !== null) { - contents.sparseStringList = deserializeAws_restJson1SparseStringList(data.sparseStringList, context); - } - if (data.stringList !== undefined && data.stringList !== null) { - contents.stringList = deserializeAws_restJson1StringList(data.stringList, context); - } - if (data.stringSet !== undefined && data.stringSet !== null) { - contents.stringSet = deserializeAws_restJson1StringSet(data.stringSet, context); - } - if (data.myStructureList !== undefined && data.myStructureList !== null) { - contents.structureList = deserializeAws_restJson1StructureList(data.myStructureList, context); - } - if (data.timestampList !== undefined && data.timestampList !== null) { - contents.timestampList = deserializeAws_restJson1TimestampList(data.timestampList, context); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonListsCommandError = async ( +const deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -3102,64 +5569,24 @@ const deserializeAws_restJson1JsonListsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonMapsCommand = async ( +export const deserializeAws_restJson1MalformedTimestampQueryDefaultCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonMapsCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError(output, context); } - const contents: JsonMapsCommandOutput = { + const contents: MalformedTimestampQueryDefaultCommandOutput = { $metadata: deserializeMetadata(output), - denseBooleanMap: undefined, - denseNumberMap: undefined, - denseSetMap: undefined, - denseStringMap: undefined, - denseStructMap: undefined, - sparseBooleanMap: undefined, - sparseNumberMap: undefined, - sparseSetMap: undefined, - sparseStringMap: undefined, - sparseStructMap: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.denseBooleanMap !== undefined && data.denseBooleanMap !== null) { - contents.denseBooleanMap = deserializeAws_restJson1DenseBooleanMap(data.denseBooleanMap, context); - } - if (data.denseNumberMap !== undefined && data.denseNumberMap !== null) { - contents.denseNumberMap = deserializeAws_restJson1DenseNumberMap(data.denseNumberMap, context); - } - if (data.denseSetMap !== undefined && data.denseSetMap !== null) { - contents.denseSetMap = deserializeAws_restJson1DenseSetMap(data.denseSetMap, context); - } - if (data.denseStringMap !== undefined && data.denseStringMap !== null) { - contents.denseStringMap = deserializeAws_restJson1DenseStringMap(data.denseStringMap, context); - } - if (data.denseStructMap !== undefined && data.denseStructMap !== null) { - contents.denseStructMap = deserializeAws_restJson1DenseStructMap(data.denseStructMap, context); - } - if (data.sparseBooleanMap !== undefined && data.sparseBooleanMap !== null) { - contents.sparseBooleanMap = deserializeAws_restJson1SparseBooleanMap(data.sparseBooleanMap, context); - } - if (data.sparseNumberMap !== undefined && data.sparseNumberMap !== null) { - contents.sparseNumberMap = deserializeAws_restJson1SparseNumberMap(data.sparseNumberMap, context); - } - if (data.sparseSetMap !== undefined && data.sparseSetMap !== null) { - contents.sparseSetMap = deserializeAws_restJson1SparseSetMap(data.sparseSetMap, context); - } - if (data.sparseStringMap !== undefined && data.sparseStringMap !== null) { - contents.sparseStringMap = deserializeAws_restJson1SparseStringMap(data.sparseStringMap, context); - } - if (data.sparseStructMap !== undefined && data.sparseStructMap !== null) { - contents.sparseStructMap = deserializeAws_restJson1SparseStructMap(data.sparseStructMap, context); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonMapsCommandError = async ( +const deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -3185,40 +5612,67 @@ const deserializeAws_restJson1JsonMapsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonTimestampsCommand = async ( +export const deserializeAws_restJson1MalformedTimestampQueryEpochCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonTimestampsCommandError(output, context); + return deserializeAws_restJson1MalformedTimestampQueryEpochCommandError(output, context); } - const contents: JsonTimestampsCommandOutput = { + const contents: MalformedTimestampQueryEpochCommandOutput = { $metadata: deserializeMetadata(output), - dateTime: undefined, - epochSeconds: undefined, - httpDate: undefined, - normal: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.dateTime !== undefined && data.dateTime !== null) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTime(data.dateTime)); - } - if (data.epochSeconds !== undefined && data.epochSeconds !== null) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSeconds))); - } - if (data.httpDate !== undefined && data.httpDate !== null) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data.httpDate)); + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampQueryEpochCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; } - if (data.normal !== undefined && data.normal !== null) { - contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + +export const deserializeAws_restJson1MalformedTimestampQueryHttpDateCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampQueryHttpDateCommandError(output, context); } + const contents: MalformedTimestampQueryHttpDateCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonTimestampsCommandError = async ( +const deserializeAws_restJson1MalformedTimestampQueryHttpDateCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -3244,28 +5698,24 @@ const deserializeAws_restJson1JsonTimestampsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; -export const deserializeAws_restJson1JsonUnionsCommand = async ( +export const deserializeAws_restJson1MalformedUnionCommand = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonUnionsCommandError(output, context); + return deserializeAws_restJson1MalformedUnionCommandError(output, context); } - const contents: JsonUnionsCommandOutput = { + const contents: MalformedUnionCommandOutput = { $metadata: deserializeMetadata(output), - contents: undefined, }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.contents !== undefined && data.contents !== null) { - contents.contents = deserializeAws_restJson1MyUnion(__expectUnion(data.contents), context); - } + await collectBody(output.body, context); return Promise.resolve(contents); }; -const deserializeAws_restJson1JsonUnionsCommandError = async ( +const deserializeAws_restJson1MalformedUnionCommandError = async ( output: __HttpResponse, context: __SerdeContext -): Promise => { +): Promise => { const parsedOutput: any = { ...output, body: await parseBody(output.body, context), @@ -4227,6 +6677,48 @@ const serializeAws_restJson1RecursiveShapesInputOutputNested2 = ( }; }; +const serializeAws_restJson1SimpleList = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1SimpleMap = (input: { [key: string]: string }, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: value, + }; + }, {}); +}; + +const serializeAws_restJson1SimpleSet = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1SimpleUnion = (input: SimpleUnion, context: __SerdeContext): any => { + return SimpleUnion.visit(input, { + int: (value) => ({ int: value }), + string: (value) => ({ string: value }), + _: (name, value) => ({ name: value } as any), + }); +}; + const serializeAws_restJson1SparseBooleanMap = (input: { [key: string]: boolean }, context: __SerdeContext): any => { return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { if (value === null) { diff --git a/protocol_tests/aws-restjson/test/functional/restjson1.spec.ts b/protocol_tests/aws-restjson/test/functional/restjson1.spec.ts index f32d959622a5..879c3fd9d52f 100644 --- a/protocol_tests/aws-restjson/test/functional/restjson1.spec.ts +++ b/protocol_tests/aws-restjson/test/functional/restjson1.spec.ts @@ -6177,6 +6177,9 @@ it.skip("RestJsonNoInputAndOutput:Request", async () => { expect(r.method).toBe("POST"); expect(r.path).toBe("/NoInputAndOutputOutput"); + expect(r.headers["accept"]).toBeDefined(); + expect(r.headers["accept"]).toBe("application/json"); + expect(r.body).toBeFalsy(); } });