From 74bfbf216d4ff21326c276d813ccbe2de2dd7cf4 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Oct 2021 22:53:56 +0000 Subject: [PATCH 01/11] chore(protocol_tests): : prefix aws-protocol_tests for protocol_tests --- .../aws-protocoltests-ec2/.gitignore | 9 + .../aws-protocoltests-ec2/CHANGELOG.md | 775 ++ protocol_tests/aws-protocoltests-ec2/LICENSE | 201 + .../aws-protocoltests-ec2/README.md | 203 + .../aws-protocoltests-ec2/package.json | 96 + .../aws-protocoltests-ec2/src/EC2Protocol.ts | 752 ++ .../src/EC2ProtocolClient.ts | 295 + .../EmptyInputAndEmptyOutputCommand.ts | 98 + .../src/commands/EndpointOperationCommand.ts | 77 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/GreetingWithErrorsCommand.ts | 99 + .../commands/HostWithPathOperationCommand.ts | 77 + .../commands/IgnoresWrappingXmlNameCommand.ts | 97 + .../src/commands/NestedStructuresCommand.ts | 95 + .../src/commands/NoInputAndOutputCommand.ts | 98 + .../QueryIdempotencyTokenAutoFillCommand.ts | 98 + .../src/commands/QueryListsCommand.ts | 92 + .../src/commands/QueryTimestampsCommand.ts | 96 + .../src/commands/RecursiveXmlShapesCommand.ts | 95 + .../src/commands/SimpleInputParamsCommand.ts | 95 + .../SimpleScalarXmlPropertiesCommand.ts | 81 + .../src/commands/XmlBlobsCommand.ts | 92 + .../src/commands/XmlEmptyBlobsCommand.ts | 75 + .../src/commands/XmlEmptyListsCommand.ts | 75 + .../src/commands/XmlEnumsCommand.ts | 92 + .../src/commands/XmlListsCommand.ts | 102 + .../src/commands/XmlNamespacesCommand.ts | 75 + .../src/commands/XmlTimestampsCommand.ts | 94 + .../src/commands/index.ts | 21 + .../aws-protocoltests-ec2/src/endpoints.ts | 62 + .../aws-protocoltests-ec2/src/index.ts | 4 + .../aws-protocoltests-ec2/src/models/index.ts | 1 + .../src/models/models_0.ts | 433 + .../src/protocols/Aws_ec2.ts | 2273 +++++ .../src/runtimeConfig.browser.ts | 37 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 40 + .../test/functional/ec2query.spec.ts | 2344 +++++ .../aws-protocoltests-ec2/tsconfig.es.json | 10 + .../aws-protocoltests-ec2/tsconfig.json | 32 + .../aws-protocoltests-ec2/tsconfig.types.json | 9 + .../aws-protocoltests-json-10/.gitignore | 9 + .../aws-protocoltests-json-10/CHANGELOG.md | 195 + .../aws-protocoltests-json-10/LICENSE | 201 + .../aws-protocoltests-json-10/README.md | 201 + .../aws-protocoltests-json-10/jest.config.js | 4 + .../aws-protocoltests-json-10/package.json | 94 + .../src/JSONRPC10.ts | 331 + .../src/JSONRPC10Client.ts | 250 + .../EmptyInputAndEmptyOutputCommand.ts | 98 + .../src/commands/EndpointOperationCommand.ts | 77 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/GreetingWithErrorsCommand.ts | 102 + .../commands/HostWithPathOperationCommand.ts | 77 + .../src/commands/JsonUnionsCommand.ts | 95 + .../src/commands/NoInputAndNoOutputCommand.ts | 96 + .../src/commands/NoInputAndOutputCommand.ts | 98 + .../commands/SimpleScalarPropertiesCommand.ts | 78 + .../src/commands/index.ts | 9 + .../src/endpoints.ts | 62 + .../aws-protocoltests-json-10/src/index.ts | 4 + .../src/models/index.ts | 1 + .../src/models/models_0.ts | 362 + .../src/protocols/Aws_json1_0.ts | 959 +++ .../src/runtimeConfig.browser.ts | 37 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 40 + .../test/functional/awsjson1_0.spec.ts | 2058 +++++ .../tsconfig.es.json | 10 + .../aws-protocoltests-json-10/tsconfig.json | 32 + .../tsconfig.types.json | 9 + .../aws-protocoltests-json/.gitignore | 9 + .../aws-protocoltests-json/CHANGELOG.md | 764 ++ protocol_tests/aws-protocoltests-json/LICENSE | 201 + .../aws-protocoltests-json/README.md | 201 + .../aws-protocoltests-json/package.json | 97 + .../src/JsonProtocol.ts | 412 + .../src/JsonProtocolClient.ts | 287 + .../src/commands/EmptyOperationCommand.ts | 77 + .../src/commands/EndpointOperationCommand.ts | 77 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/GreetingWithErrorsCommand.ts | 102 + .../commands/HostWithPathOperationCommand.ts | 77 + .../src/commands/JsonEnumsCommand.ts | 92 + .../src/commands/JsonUnionsCommand.ts | 95 + .../commands/KitchenSinkOperationCommand.ts | 78 + .../src/commands/NullOperationCommand.ts | 78 + ...OperationWithOptionalInputOutputCommand.ts | 84 + .../PutAndGetInlineDocumentsCommand.ts | 95 + .../commands/SimpleScalarPropertiesCommand.ts | 78 + .../src/commands/index.ts | 12 + .../aws-protocoltests-json/src/endpoints.ts | 62 + .../aws-protocoltests-json/src/index.ts | 4 + .../src/models/index.ts | 1 + .../src/models/models_0.ts | 504 ++ .../src/protocols/Aws_json1_1.ts | 1867 ++++ .../src/runtimeConfig.browser.ts | 41 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 46 + .../test/functional/awsjson1_1.spec.ts | 4565 ++++++++++ .../aws-protocoltests-json/tsconfig.es.json | 10 + .../aws-protocoltests-json/tsconfig.json | 32 + .../tsconfig.types.json | 9 + .../aws-protocoltests-query/.gitignore | 9 + .../aws-protocoltests-query/CHANGELOG.md | 775 ++ .../aws-protocoltests-query/LICENSE | 201 + .../aws-protocoltests-query/README.md | 203 + .../aws-protocoltests-query/package.json | 96 + .../src/QueryProtocol.ts | 1022 +++ .../src/QueryProtocolClient.ts | 325 + .../EmptyInputAndEmptyOutputCommand.ts | 98 + .../src/commands/EndpointOperationCommand.ts | 77 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/FlattenedXmlMapCommand.ts | 95 + .../FlattenedXmlMapWithXmlNameCommand.ts | 98 + .../FlattenedXmlMapWithXmlNamespaceCommand.ts | 103 + .../src/commands/GreetingWithErrorsCommand.ts | 99 + .../commands/HostWithPathOperationCommand.ts | 77 + .../commands/IgnoresWrappingXmlNameCommand.ts | 98 + .../src/commands/NestedStructuresCommand.ts | 95 + .../src/commands/NoInputAndNoOutputCommand.ts | 97 + .../src/commands/NoInputAndOutputCommand.ts | 98 + .../QueryIdempotencyTokenAutoFillCommand.ts | 98 + .../src/commands/QueryListsCommand.ts | 92 + .../src/commands/QueryMapsCommand.ts | 92 + .../src/commands/QueryTimestampsCommand.ts | 99 + .../src/commands/RecursiveXmlShapesCommand.ts | 95 + .../src/commands/SimpleInputParamsCommand.ts | 95 + .../SimpleScalarXmlPropertiesCommand.ts | 81 + .../src/commands/XmlBlobsCommand.ts | 92 + .../src/commands/XmlEmptyBlobsCommand.ts | 78 + .../src/commands/XmlEmptyListsCommand.ts | 78 + .../src/commands/XmlEmptyMapsCommand.ts | 75 + .../src/commands/XmlEnumsCommand.ts | 92 + .../src/commands/XmlListsCommand.ts | 101 + .../src/commands/XmlMapsCommand.ts | 92 + .../src/commands/XmlMapsXmlNameCommand.ts | 78 + .../src/commands/XmlNamespacesCommand.ts | 78 + .../src/commands/XmlTimestampsCommand.ts | 97 + .../src/commands/index.ts | 29 + .../aws-protocoltests-query/src/endpoints.ts | 62 + .../aws-protocoltests-query/src/index.ts | 4 + .../src/models/index.ts | 1 + .../src/models/models_0.ts | 544 ++ .../src/protocols/Aws_query.ts | 3103 +++++++ .../src/runtimeConfig.browser.ts | 37 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 40 + .../test/functional/awsquery.spec.ts | 3117 +++++++ .../aws-protocoltests-query/tsconfig.es.json | 10 + .../aws-protocoltests-query/tsconfig.json | 32 + .../tsconfig.types.json | 9 + .../aws-protocoltests-restjson/.gitignore | 9 + .../aws-protocoltests-restjson/CHANGELOG.md | 784 ++ .../aws-protocoltests-restjson/LICENSE | 201 + .../aws-protocoltests-restjson/README.md | 203 + .../aws-protocoltests-restjson/package.json | 99 + .../src/RestJsonProtocol.ts | 2796 ++++++ .../src/RestJsonProtocolClient.ts | 605 ++ .../commands/AllQueryStringTypesCommand.ts | 95 + .../ConstantAndVariableQueryStringCommand.ts | 103 + .../commands/ConstantQueryStringCommand.ts | 98 + .../commands/DocumentTypeAsPayloadCommand.ts | 95 + .../src/commands/DocumentTypeCommand.ts | 95 + .../EmptyInputAndEmptyOutputCommand.ts | 98 + .../src/commands/EndpointOperationCommand.ts | 77 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/GreetingWithErrorsCommand.ts | 104 + .../commands/HostWithPathOperationCommand.ts | 77 + .../commands/HttpChecksumRequiredCommand.ts | 97 + .../src/commands/HttpEnumPayloadCommand.ts | 78 + .../src/commands/HttpPayloadTraitsCommand.ts | 98 + .../HttpPayloadTraitsWithMediaTypeCommand.ts | 104 + .../HttpPayloadWithStructureCommand.ts | 98 + .../src/commands/HttpPrefixHeadersCommand.ts | 95 + .../HttpPrefixHeadersResponseCommand.ts | 98 + .../HttpRequestWithFloatLabelsCommand.ts | 81 + ...HttpRequestWithGreedyLabelInPathCommand.ts | 84 + ...uestWithLabelsAndTimestampFormatCommand.ts | 106 + .../commands/HttpRequestWithLabelsCommand.ts | 96 + .../src/commands/HttpResponseCodeCommand.ts | 78 + .../src/commands/HttpStringPayloadCommand.ts | 78 + .../IgnoreQueryParamsInResponseCommand.ts | 100 + .../InputAndOutputWithHeadersCommand.ts | 99 + .../src/commands/JsonBlobsCommand.ts | 95 + .../src/commands/JsonEnumsCommand.ts | 95 + .../src/commands/JsonListsCommand.ts | 101 + .../src/commands/JsonMapsCommand.ts | 95 + .../src/commands/JsonTimestampsCommand.ts | 97 + .../src/commands/JsonUnionsCommand.ts | 95 + .../MalformedAcceptWithBodyCommand.ts | 78 + ...MalformedAcceptWithGenericStringCommand.ts | 84 + .../MalformedAcceptWithPayloadCommand.ts | 81 + .../src/commands/MalformedBlobCommand.ts | 78 + .../src/commands/MalformedBooleanCommand.ts | 78 + .../src/commands/MalformedByteCommand.ts | 78 + .../MalformedContentTypeWithBodyCommand.ts | 81 + ...rmedContentTypeWithGenericStringCommand.ts | 84 + .../MalformedContentTypeWithPayloadCommand.ts | 84 + .../MalformedContentTypeWithoutBodyCommand.ts | 83 + .../src/commands/MalformedDoubleCommand.ts | 78 + .../src/commands/MalformedFloatCommand.ts | 78 + .../src/commands/MalformedIntegerCommand.ts | 78 + .../src/commands/MalformedListCommand.ts | 78 + .../src/commands/MalformedLongCommand.ts | 78 + .../src/commands/MalformedMapCommand.ts | 78 + .../commands/MalformedRequestBodyCommand.ts | 78 + .../src/commands/MalformedSetCommand.ts | 78 + .../src/commands/MalformedShortCommand.ts | 78 + .../src/commands/MalformedStringCommand.ts | 78 + .../MalformedTimestampBodyDateTimeCommand.ts | 84 + .../MalformedTimestampBodyDefaultCommand.ts | 81 + .../MalformedTimestampBodyHttpDateCommand.ts | 84 + ...MalformedTimestampHeaderDateTimeCommand.ts | 84 + .../MalformedTimestampHeaderDefaultCommand.ts | 84 + .../MalformedTimestampHeaderEpochCommand.ts | 81 + .../MalformedTimestampPathDefaultCommand.ts | 81 + .../MalformedTimestampPathEpochCommand.ts | 81 + .../MalformedTimestampPathHttpDateCommand.ts | 84 + .../MalformedTimestampQueryDefaultCommand.ts | 84 + .../MalformedTimestampQueryEpochCommand.ts | 81 + .../MalformedTimestampQueryHttpDateCommand.ts | 84 + .../src/commands/MalformedUnionCommand.ts | 78 + .../src/commands/MediaTypeHeaderCommand.ts | 95 + .../src/commands/NoInputAndNoOutputCommand.ts | 96 + .../src/commands/NoInputAndOutputCommand.ts | 98 + .../NullAndEmptyHeadersClientCommand.ts | 98 + .../NullAndEmptyHeadersServerCommand.ts | 98 + .../OmitsNullSerializesEmptyStringCommand.ts | 101 + .../QueryIdempotencyTokenAutoFillCommand.ts | 98 + .../QueryParamsAsStringListMapCommand.ts | 81 + .../src/commands/QueryPrecedenceCommand.ts | 78 + .../src/commands/RecursiveShapesCommand.ts | 95 + .../commands/SimpleScalarPropertiesCommand.ts | 78 + .../src/commands/StreamingTraitsCommand.ts | 107 + .../StreamingTraitsRequireLengthCommand.ts | 113 + .../StreamingTraitsWithMediaTypeCommand.ts | 112 + .../commands/TimestampFormatHeadersCommand.ts | 95 + .../src/commands/index.ts | 79 + .../src/endpoints.ts | 62 + .../aws-protocoltests-restjson/src/index.ts | 4 + .../src/models/index.ts | 1 + .../src/models/models_0.ts | 1530 ++++ .../src/protocols/Aws_restJson1.ts | 7387 ++++++++++++++++ .../src/runtimeConfig.browser.ts | 41 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 44 + .../test/functional/restjson1.spec.ts | 7617 +++++++++++++++++ .../tsconfig.es.json | 10 + .../aws-protocoltests-restjson/tsconfig.json | 32 + .../tsconfig.types.json | 9 + .../aws-protocoltests-restxml/.gitignore | 13 + .../aws-protocoltests-restxml/CHANGELOG.md | 797 ++ .../aws-protocoltests-restxml/LICENSE | 201 + .../aws-protocoltests-restxml/README.md | 203 + .../aws-protocoltests-restxml/package.json | 98 + .../src/RestXmlProtocol.ts | 1919 +++++ .../src/RestXmlProtocolClient.ts | 457 + .../commands/AllQueryStringTypesCommand.ts | 95 + .../src/commands/BodyWithXmlNameCommand.ts | 96 + .../ConstantAndVariableQueryStringCommand.ts | 103 + .../commands/ConstantQueryStringCommand.ts | 98 + .../EmptyInputAndEmptyOutputCommand.ts | 98 + .../src/commands/EndpointOperationCommand.ts | 77 + ...ointWithHostLabelHeaderOperationCommand.ts | 84 + .../EndpointWithHostLabelOperationCommand.ts | 84 + .../src/commands/FlattenedXmlMapCommand.ts | 95 + .../FlattenedXmlMapWithXmlNameCommand.ts | 100 + .../FlattenedXmlMapWithXmlNamespaceCommand.ts | 103 + .../src/commands/GreetingWithErrorsCommand.ts | 103 + .../src/commands/HttpPayloadTraitsCommand.ts | 98 + .../HttpPayloadTraitsWithMediaTypeCommand.ts | 104 + .../HttpPayloadWithMemberXmlNameCommand.ts | 101 + .../HttpPayloadWithStructureCommand.ts | 98 + .../commands/HttpPayloadWithXmlNameCommand.ts | 96 + ...PayloadWithXmlNamespaceAndPrefixCommand.ts | 104 + .../HttpPayloadWithXmlNamespaceCommand.ts | 100 + .../src/commands/HttpPrefixHeadersCommand.ts | 95 + .../HttpRequestWithFloatLabelsCommand.ts | 81 + ...HttpRequestWithGreedyLabelInPathCommand.ts | 84 + ...uestWithLabelsAndTimestampFormatCommand.ts | 106 + .../commands/HttpRequestWithLabelsCommand.ts | 96 + .../src/commands/HttpResponseCodeCommand.ts | 78 + .../IgnoreQueryParamsInResponseCommand.ts | 100 + .../InputAndOutputWithHeadersCommand.ts | 99 + .../src/commands/NestedXmlMapsCommand.ts | 78 + .../src/commands/NoInputAndNoOutputCommand.ts | 96 + .../src/commands/NoInputAndOutputCommand.ts | 98 + .../NullAndEmptyHeadersClientCommand.ts | 98 + .../NullAndEmptyHeadersServerCommand.ts | 98 + .../OmitsNullSerializesEmptyStringCommand.ts | 101 + .../QueryIdempotencyTokenAutoFillCommand.ts | 98 + .../QueryParamsAsStringListMapCommand.ts | 81 + .../src/commands/QueryPrecedenceCommand.ts | 78 + .../src/commands/RecursiveShapesCommand.ts | 95 + .../commands/SimpleScalarPropertiesCommand.ts | 78 + .../commands/TimestampFormatHeadersCommand.ts | 95 + .../src/commands/XmlAttributesCommand.ts | 95 + .../commands/XmlAttributesOnPayloadCommand.ts | 95 + .../src/commands/XmlBlobsCommand.ts | 92 + .../src/commands/XmlEmptyBlobsCommand.ts | 95 + .../src/commands/XmlEmptyListsCommand.ts | 78 + .../src/commands/XmlEmptyMapsCommand.ts | 78 + .../src/commands/XmlEmptyStringsCommand.ts | 78 + .../src/commands/XmlEnumsCommand.ts | 92 + .../src/commands/XmlListsCommand.ts | 103 + .../src/commands/XmlMapsCommand.ts | 92 + .../src/commands/XmlMapsXmlNameCommand.ts | 78 + .../src/commands/XmlNamespacesCommand.ts | 78 + .../src/commands/XmlTimestampsCommand.ts | 97 + .../src/commands/XmlUnionsCommand.ts | 75 + .../src/commands/index.ts | 53 + .../src/endpoints.ts | 62 + .../aws-protocoltests-restxml/src/index.ts | 4 + .../src/models/index.ts | 1 + .../src/models/models_0.ts | 1141 +++ .../src/protocols/Aws_restXml.ts | 6221 ++++++++++++++ .../src/runtimeConfig.browser.ts | 37 + .../src/runtimeConfig.native.ts | 17 + .../src/runtimeConfig.shared.ts | 17 + .../src/runtimeConfig.ts | 40 + .../test/functional/restxml.spec.ts | 6778 +++++++++++++++ .../tsconfig.es.json | 10 + .../aws-protocoltests-restxml/tsconfig.json | 32 + .../tsconfig.types.json | 9 + 330 files changed, 89235 insertions(+) create mode 100644 protocol_tests/aws-protocoltests-ec2/.gitignore create mode 100644 protocol_tests/aws-protocoltests-ec2/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-ec2/LICENSE create mode 100644 protocol_tests/aws-protocoltests-ec2/README.md create mode 100644 protocol_tests/aws-protocoltests-ec2/package.json create mode 100644 protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts create mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.types.json create mode 100644 protocol_tests/aws-protocoltests-json-10/.gitignore create mode 100644 protocol_tests/aws-protocoltests-json-10/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-json-10/LICENSE create mode 100644 protocol_tests/aws-protocoltests-json-10/README.md create mode 100644 protocol_tests/aws-protocoltests-json-10/jest.config.js create mode 100644 protocol_tests/aws-protocoltests-json-10/package.json create mode 100644 protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts create mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.types.json create mode 100644 protocol_tests/aws-protocoltests-json/.gitignore create mode 100644 protocol_tests/aws-protocoltests-json/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-json/LICENSE create mode 100644 protocol_tests/aws-protocoltests-json/README.md create mode 100644 protocol_tests/aws-protocoltests-json/package.json create mode 100644 protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts create mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.types.json create mode 100644 protocol_tests/aws-protocoltests-query/.gitignore create mode 100644 protocol_tests/aws-protocoltests-query/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-query/LICENSE create mode 100644 protocol_tests/aws-protocoltests-query/README.md create mode 100644 protocol_tests/aws-protocoltests-query/package.json create mode 100644 protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts create mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.types.json create mode 100644 protocol_tests/aws-protocoltests-restjson/.gitignore create mode 100644 protocol_tests/aws-protocoltests-restjson/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-restjson/LICENSE create mode 100644 protocol_tests/aws-protocoltests-restjson/README.md create mode 100644 protocol_tests/aws-protocoltests-restjson/package.json create mode 100644 protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBlobCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedByteCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedFloatCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedListCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedLongCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedMapCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedSetCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedShortCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedUnionCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts create mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.types.json create mode 100644 protocol_tests/aws-protocoltests-restxml/.gitignore create mode 100644 protocol_tests/aws-protocoltests-restxml/CHANGELOG.md create mode 100644 protocol_tests/aws-protocoltests-restxml/LICENSE create mode 100644 protocol_tests/aws-protocoltests-restxml/README.md create mode 100644 protocol_tests/aws-protocoltests-restxml/package.json create mode 100644 protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/index.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/endpoints.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/index.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/models/index.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts create mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.es.json create mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.json create mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.types.json diff --git a/protocol_tests/aws-protocoltests-ec2/.gitignore b/protocol_tests/aws-protocoltests-ec2/.gitignore new file mode 100644 index 000000000000..bff6121c007d --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md b/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md new file mode 100644 index 000000000000..7f11dd91a020 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md @@ -0,0 +1,775 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + + +### Bug Fixes + +* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + +### Features + +* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) + + + + + +# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) + + +### Bug Fixes + +* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) + + + + + +# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) + + +### Features + +* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) +* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) + + + + + +# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) + + +### Features + +* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) + + + + + +# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) + + +### Bug Fixes + +* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) + + + + + +# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) + + +### Bug Fixes + +* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) + + + + + +# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) + + +### Bug Fixes + +* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) + + +### Features + +* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) + + + + + +## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) + + +### Features + +* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) + + + + + +# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) + + +### Bug Fixes + +* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) + + +### Features + +* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) + + + + + +# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) + + +### Bug Fixes + +* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) + + + + + +# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) + + +### Features + +* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) + + + + + +# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) + + +### Bug Fixes + +* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) + + + + + +# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) + + +### Bug Fixes + +* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) + + + + + +# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) + + +### Bug Fixes + +* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) + + + + + +# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) + + +### Bug Fixes + +* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) + + + + + +# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) + + +### Features + +* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) +* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) + + + + + +# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) + + +### Bug Fixes + +* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) +* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) + + +### Features + +* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) + + + + + +# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) + + +### Bug Fixes + +* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) + + + + + +# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) + + +### Bug Fixes + +* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) +* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) +* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) +* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) + + +### Features + +* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) + + + + + +# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) + + +### Features + +* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) + + + + + +# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) + + +### Bug Fixes + +* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) + + +### Features + +* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) + + + + + +# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) + + +### Features + +* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) + + + + + +# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) + + +### Bug Fixes + +* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) + + + + + +# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) + + +### Features + +* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) + + + + + +# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) + + +### Bug Fixes + +* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) + + + + + +# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) + + +### Features + +* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) + + + + + +# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.9...@aws-sdk/aws-ec2@1.0.0-gamma.10) (2020-10-07) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.8...@aws-sdk/aws-ec2@1.0.0-gamma.9) (2020-09-29) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.7...@aws-sdk/aws-ec2@1.0.0-gamma.8) (2020-09-15) + + +### Bug Fixes + +* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) +* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) + + + + + +# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.6...@aws-sdk/aws-ec2@1.0.0-gamma.7) (2020-09-01) + + +### Features + +* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) + + + + + +# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.5...@aws-sdk/aws-ec2@1.0.0-gamma.6) (2020-08-25) + + +### Features + +* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) +* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) +* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) + + + + + +# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.4...@aws-sdk/aws-ec2@1.0.0-gamma.5) (2020-08-04) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.3...@aws-sdk/aws-ec2@1.0.0-gamma.4) (2020-07-21) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.2...@aws-sdk/aws-ec2@1.0.0-gamma.3) (2020-07-13) + +**Note:** Version bump only for package @aws-sdk/aws-ec2 + + + + + +# 1.0.0-gamma.2 (2020-07-08) + + +### Features + +* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) + + + +# 1.0.0-gamma.2 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.1 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.0 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-beta.0 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-ec2/LICENSE b/protocol_tests/aws-protocoltests-ec2/LICENSE new file mode 100644 index 000000000000..dd65ae06be7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-ec2/README.md b/protocol_tests/aws-protocoltests-ec2/README.md new file mode 100644 index 000000000000..c81774a0da8b --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/README.md @@ -0,0 +1,203 @@ +# @aws-sdk/aws-protocoltests-ec2 + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-ec2/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-ec2) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-ec2.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-ec2) + +## Description + +AWS SDK for JavaScript EC2Protocol Client for Node.js, Browser and React Native. + +An EC2 query service that sends query requests and XML responses. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-ec2 +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-ec2` +- `yarn add @aws-sdk/aws-protocoltests-ec2` +- `pnpm add @aws-sdk/aws-protocoltests-ec2` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `EC2ProtocolClient` and +the commands you need, for example `EmptyInputAndEmptyOutputCommand`: + +```js +// ES5 example +const { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); +``` + +```ts +// ES6+ example +import { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new EC2ProtocolClient({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new EmptyInputAndEmptyOutputCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-ec2"; +const client = new AWS.EC2Protocol({ region: "REGION" }); + +// async/await. +try { + const data = await client.emptyInputAndEmptyOutput(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .emptyInputAndEmptyOutput(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.emptyInputAndEmptyOutput(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-ec2` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-ec2/package.json b/protocol_tests/aws-protocoltests-ec2/package.json new file mode 100644 index 000000000000..1569ac1e83f0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/package.json @@ -0,0 +1,96 @@ +{ + "name": "@aws-sdk/aws-protocoltests-query", + "description": "@aws-sdk/aws-protocoltests-query client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "entities": "2.2.0", + "fast-xml-parser": "3.19.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-query", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-query" + } +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts b/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts new file mode 100644 index 000000000000..786316886587 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts @@ -0,0 +1,752 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommand, + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + GreetingWithErrorsCommand, + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, +} from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommand, + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "./commands/IgnoresWrappingXmlNameCommand"; +import { + NestedStructuresCommand, + NestedStructuresCommandInput, + NestedStructuresCommandOutput, +} from "./commands/NestedStructuresCommand"; +import { + NoInputAndOutputCommand, + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, +} from "./commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommand, + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommand, QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; +import { + QueryTimestampsCommand, + QueryTimestampsCommandInput, + QueryTimestampsCommandOutput, +} from "./commands/QueryTimestampsCommand"; +import { + RecursiveXmlShapesCommand, + RecursiveXmlShapesCommandInput, + RecursiveXmlShapesCommandOutput, +} from "./commands/RecursiveXmlShapesCommand"; +import { + SimpleInputParamsCommand, + SimpleInputParamsCommandInput, + SimpleInputParamsCommandOutput, +} from "./commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommand, + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "./commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { + XmlEmptyBlobsCommand, + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, +} from "./commands/XmlEmptyBlobsCommand"; +import { + XmlEmptyListsCommand, + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, +} from "./commands/XmlEmptyListsCommand"; +import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { + XmlNamespacesCommand, + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, +} from "./commands/XmlNamespacesCommand"; +import { + XmlTimestampsCommand, + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, +} from "./commands/XmlTimestampsCommand"; +import { EC2ProtocolClient } from "./EC2ProtocolClient"; + +/** + * An EC2 query service that sends query requests and XML responses. + */ +export class EC2Protocol extends EC2ProtocolClient { + /** + * The example tests how requests and responses are serialized when there's + * no request or response members. + * + * While this should be rare, code generators must support this. + */ + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), + cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): Promise | void { + const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 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. + * + * The wrapping element is always operation name + "Response". + */ + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): void; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): void; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void), + cb?: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): Promise | void { + const command = new IgnoresWrappingXmlNameCommand(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 test serializes nested and recursive structure members. + */ + public nestedStructures( + args: NestedStructuresCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nestedStructures( + args: NestedStructuresCommandInput, + cb: (err: any, data?: NestedStructuresCommandOutput) => void + ): void; + public nestedStructures( + args: NestedStructuresCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NestedStructuresCommandOutput) => void + ): void; + public nestedStructures( + args: NestedStructuresCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedStructuresCommandOutput) => void), + cb?: (err: any, data?: NestedStructuresCommandOutput) => void + ): Promise | void { + const command = new NestedStructuresCommand(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 example tests how requests and responses are serialized when there's + * no request payload or response members. + * + * While this should be rare, code generators must support this. + */ + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndOutputCommand(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); + } + } + + /** + * Automatically adds idempotency tokens. + */ + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), + cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): Promise | void { + const command = new QueryIdempotencyTokenAutoFillCommand(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 test serializes simple and complex lists. + */ + public queryLists(args: QueryListsCommandInput, options?: __HttpHandlerOptions): Promise; + public queryLists(args: QueryListsCommandInput, cb: (err: any, data?: QueryListsCommandOutput) => void): void; + public queryLists( + args: QueryListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryListsCommandOutput) => void + ): void; + public queryLists( + args: QueryListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryListsCommandOutput) => void), + cb?: (err: any, data?: QueryListsCommandOutput) => void + ): Promise | void { + const command = new QueryListsCommand(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 test serializes timestamps. + * + * 1. Timestamps are serialized as RFC 3339 date-time values by default. + * 2. A timestampFormat trait on a member changes the format. + * 3. A timestampFormat trait on the shape targeted by the member changes the format. + */ + public queryTimestamps( + args: QueryTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryTimestamps( + args: QueryTimestampsCommandInput, + cb: (err: any, data?: QueryTimestampsCommandOutput) => void + ): void; + public queryTimestamps( + args: QueryTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryTimestampsCommandOutput) => void + ): void; + public queryTimestamps( + args: QueryTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryTimestampsCommandOutput) => void), + cb?: (err: any, data?: QueryTimestampsCommandOutput) => void + ): Promise | void { + const command = new QueryTimestampsCommand(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); + } + } + + /** + * Recursive shapes + */ + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): void; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): void; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveXmlShapesCommandOutput) => void), + cb?: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): Promise | void { + const command = new RecursiveXmlShapesCommand(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 test serializes strings, numbers, and boolean values. + */ + public simpleInputParams( + args: SimpleInputParamsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + cb: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): void; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): void; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleInputParamsCommandOutput) => void), + cb?: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): Promise | void { + const command = new SimpleInputParamsCommand(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 simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): void; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): void; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarXmlPropertiesCommand(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); + } + } + + /** + * Blobs are base64 encoded + */ + public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlBlobsCommandOutput) => void + ): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlBlobsCommand(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 xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyBlobsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyListsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * This example serializes enums as top level properties, in lists, sets, and maps. + */ + public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; + public xmlEnums( + args: XmlEnumsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEnumsCommandOutput) => void + ): void; + public xmlEnums( + args: XmlEnumsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), + cb?: (err: any, data?: XmlEnumsCommandOutput) => void + ): Promise | void { + const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Flattened XML lists with @xmlNamespace. + * 8. Lists of structures. + */ + public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; + public xmlLists( + args: XmlListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlListsCommandOutput) => void + ): void; + public xmlLists( + args: XmlListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), + cb?: (err: any, data?: XmlListsCommandOutput) => void + ): Promise | void { + const command = new XmlListsCommand(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 xmlNamespaces( + args: XmlNamespacesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), + cb?: (err: any, data?: XmlNamespacesCommandOutput) => void + ): Promise | void { + const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + */ + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), + cb?: (err: any, data?: XmlTimestampsCommandOutput) => void + ): Promise | void { + const command = new XmlTimestampsCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts b/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts new file mode 100644 index 000000000000..85e7dacae8b0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts @@ -0,0 +1,295 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "./commands/IgnoresWrappingXmlNameCommand"; +import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "./commands/NestedStructuresCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; +import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "./commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "./commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "./commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "./commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | EmptyInputAndEmptyOutputCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput + | IgnoresWrappingXmlNameCommandInput + | NestedStructuresCommandInput + | NoInputAndOutputCommandInput + | QueryIdempotencyTokenAutoFillCommandInput + | QueryListsCommandInput + | QueryTimestampsCommandInput + | RecursiveXmlShapesCommandInput + | SimpleInputParamsCommandInput + | SimpleScalarXmlPropertiesCommandInput + | XmlBlobsCommandInput + | XmlEmptyBlobsCommandInput + | XmlEmptyListsCommandInput + | XmlEnumsCommandInput + | XmlListsCommandInput + | XmlNamespacesCommandInput + | XmlTimestampsCommandInput; + +export type ServiceOutputTypes = + | EmptyInputAndEmptyOutputCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput + | IgnoresWrappingXmlNameCommandOutput + | NestedStructuresCommandOutput + | NoInputAndOutputCommandOutput + | QueryIdempotencyTokenAutoFillCommandOutput + | QueryListsCommandOutput + | QueryTimestampsCommandOutput + | RecursiveXmlShapesCommandOutput + | SimpleInputParamsCommandOutput + | SimpleScalarXmlPropertiesCommandOutput + | XmlBlobsCommandOutput + | XmlEmptyBlobsCommandOutput + | XmlEmptyListsCommandOutput + | XmlEnumsCommandOutput + | XmlListsCommandOutput + | XmlNamespacesCommandOutput + | XmlTimestampsCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type EC2ProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of EC2ProtocolClient class constructor that set the region, credentials and other options. + */ +export interface EC2ProtocolClientConfig extends EC2ProtocolClientConfigType {} + +type EC2ProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of EC2ProtocolClient class. This is resolved and normalized from the {@link EC2ProtocolClientConfig | constructor configuration interface}. + */ +export interface EC2ProtocolClientResolvedConfig extends EC2ProtocolClientResolvedConfigType {} + +/** + * An EC2 query service that sends query requests and XML responses. + */ +export class EC2ProtocolClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + EC2ProtocolClientResolvedConfig +> { + /** + * The resolved configuration of EC2ProtocolClient class. This is resolved and normalized from the {@link EC2ProtocolClientConfig | constructor configuration interface}. + */ + readonly config: EC2ProtocolClientResolvedConfig; + + constructor(configuration: EC2ProtocolClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveUserAgentConfig(_config_4); + super(_config_5); + this.config = _config_5; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts new file mode 100644 index 000000000000..297a83eb5d00 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts @@ -0,0 +1,98 @@ +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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; +import { + deserializeAws_ec2EmptyInputAndEmptyOutputCommand, + serializeAws_ec2EmptyInputAndEmptyOutputCommand, +} from "../protocols/Aws_ec2"; + +export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} +export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response members. + * + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new EmptyInputAndEmptyOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. + * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class EmptyInputAndEmptyOutputCommand extends $Command< + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { + // 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 = "EmptyInputAndEmptyOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2EmptyInputAndEmptyOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2EmptyInputAndEmptyOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..2c9e807a9fa1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.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_ec2EndpointOperationCommand, + serializeAws_ec2EndpointOperationCommand, +} from "../protocols/Aws_ec2"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // 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 = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2EndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2EndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..e77d0478ee69 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.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 { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient"; +import { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_ec2EndpointWithHostLabelOperationCommand, + serializeAws_ec2EndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_ec2"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // 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 = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_ec2EndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_ec2EndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..f25e159ed5b4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,99 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_ec2GreetingWithErrorsCommand, + serializeAws_ec2GreetingWithErrorsCommand, +} from "../protocols/Aws_ec2"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // 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 = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2GreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2GreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..ee85445b638f --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts new file mode 100644 index 000000000000..4f0ff1a0d316 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts @@ -0,0 +1,97 @@ +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 { IgnoresWrappingXmlNameOutput } from "../models/models_0"; +import { + deserializeAws_ec2IgnoresWrappingXmlNameCommand, + serializeAws_ec2IgnoresWrappingXmlNameCommand, +} from "../protocols/Aws_ec2"; + +export interface IgnoresWrappingXmlNameCommandInput {} +export interface IgnoresWrappingXmlNameCommandOutput extends IgnoresWrappingXmlNameOutput, __MetadataBearer {} + +/** + * The xmlName trait on the output structure is ignored in AWS Query. + * + * The wrapping element is always operation name + "Response". + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, IgnoresWrappingXmlNameCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, IgnoresWrappingXmlNameCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new IgnoresWrappingXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link IgnoresWrappingXmlNameCommandInput} for command's `input` shape. + * @see {@link IgnoresWrappingXmlNameCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class IgnoresWrappingXmlNameCommand extends $Command< + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: IgnoresWrappingXmlNameCommandInput) { + // 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 = "IgnoresWrappingXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: IgnoresWrappingXmlNameOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2IgnoresWrappingXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2IgnoresWrappingXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts new file mode 100644 index 000000000000..3e05fe36a3ed --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts @@ -0,0 +1,95 @@ +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 { NestedStructuresInput } from "../models/models_0"; +import { + deserializeAws_ec2NestedStructuresCommand, + serializeAws_ec2NestedStructuresCommand, +} from "../protocols/Aws_ec2"; + +export interface NestedStructuresCommandInput extends NestedStructuresInput {} +export interface NestedStructuresCommandOutput extends __MetadataBearer {} + +/** + * This test serializes nested and recursive structure members. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, NestedStructuresCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, NestedStructuresCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new NestedStructuresCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NestedStructuresCommandInput} for command's `input` shape. + * @see {@link NestedStructuresCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NestedStructuresCommand extends $Command< + NestedStructuresCommandInput, + NestedStructuresCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NestedStructuresCommandInput) { + // 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 = "NestedStructuresCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NestedStructuresInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NestedStructuresCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2NestedStructuresCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2NestedStructuresCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts new file mode 100644 index 000000000000..f0f350cdaa5b --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts @@ -0,0 +1,98 @@ +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 { NoInputAndOutputOutput } from "../models/models_0"; +import { + deserializeAws_ec2NoInputAndOutputCommand, + serializeAws_ec2NoInputAndOutputCommand, +} from "../protocols/Aws_ec2"; + +export interface NoInputAndOutputCommandInput {} +export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request payload or response members. + * + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new NoInputAndOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndOutputCommand extends $Command< + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndOutputCommandInput) { + // 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 = "NoInputAndOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2NoInputAndOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2NoInputAndOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts new file mode 100644 index 000000000000..569261e2dbc2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts @@ -0,0 +1,98 @@ +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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; +import { + deserializeAws_ec2QueryIdempotencyTokenAutoFillCommand, + serializeAws_ec2QueryIdempotencyTokenAutoFillCommand, +} from "../protocols/Aws_ec2"; + +export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} +export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} + +/** + * Automatically adds idempotency tokens. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new QueryIdempotencyTokenAutoFillCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. + * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryIdempotencyTokenAutoFillCommand extends $Command< + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { + // 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 = "QueryIdempotencyTokenAutoFillCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2QueryIdempotencyTokenAutoFillCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_ec2QueryIdempotencyTokenAutoFillCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts new file mode 100644 index 000000000000..a517481d22d8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts @@ -0,0 +1,92 @@ +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 { QueryListsInput } from "../models/models_0"; +import { deserializeAws_ec2QueryListsCommand, serializeAws_ec2QueryListsCommand } from "../protocols/Aws_ec2"; + +export interface QueryListsCommandInput extends QueryListsInput {} +export interface QueryListsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes simple and complex lists. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, QueryListsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, QueryListsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new QueryListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryListsCommandInput} for command's `input` shape. + * @see {@link QueryListsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryListsCommand extends $Command< + QueryListsCommandInput, + QueryListsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryListsCommandInput) { + // 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 = "QueryListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryListsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2QueryListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2QueryListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts new file mode 100644 index 000000000000..2a120e7eae9d --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts @@ -0,0 +1,96 @@ +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 { QueryTimestampsInput } from "../models/models_0"; +import { deserializeAws_ec2QueryTimestampsCommand, serializeAws_ec2QueryTimestampsCommand } from "../protocols/Aws_ec2"; + +export interface QueryTimestampsCommandInput extends QueryTimestampsInput {} +export interface QueryTimestampsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes timestamps. + * + * 1. Timestamps are serialized as RFC 3339 date-time values by default. + * 2. A timestampFormat trait on a member changes the format. + * 3. A timestampFormat trait on the shape targeted by the member changes the format. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, QueryTimestampsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, QueryTimestampsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new QueryTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryTimestampsCommandInput} for command's `input` shape. + * @see {@link QueryTimestampsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryTimestampsCommand extends $Command< + QueryTimestampsCommandInput, + QueryTimestampsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryTimestampsCommandInput) { + // 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 = "QueryTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryTimestampsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2QueryTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2QueryTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts new file mode 100644 index 000000000000..3133fa2a45d4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts @@ -0,0 +1,95 @@ +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 { RecursiveXmlShapesOutput } from "../models/models_0"; +import { + deserializeAws_ec2RecursiveXmlShapesCommand, + serializeAws_ec2RecursiveXmlShapesCommand, +} from "../protocols/Aws_ec2"; + +export interface RecursiveXmlShapesCommandInput {} +export interface RecursiveXmlShapesCommandOutput extends RecursiveXmlShapesOutput, __MetadataBearer {} + +/** + * Recursive shapes + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, RecursiveXmlShapesCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, RecursiveXmlShapesCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new RecursiveXmlShapesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link RecursiveXmlShapesCommandInput} for command's `input` shape. + * @see {@link RecursiveXmlShapesCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class RecursiveXmlShapesCommand extends $Command< + RecursiveXmlShapesCommandInput, + RecursiveXmlShapesCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: RecursiveXmlShapesCommandInput) { + // 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 = "RecursiveXmlShapesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: RecursiveXmlShapesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: RecursiveXmlShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2RecursiveXmlShapesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2RecursiveXmlShapesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts new file mode 100644 index 000000000000..8b9f9a2cf2be --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts @@ -0,0 +1,95 @@ +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 { SimpleInputParamsInput } from "../models/models_0"; +import { + deserializeAws_ec2SimpleInputParamsCommand, + serializeAws_ec2SimpleInputParamsCommand, +} from "../protocols/Aws_ec2"; + +export interface SimpleInputParamsCommandInput extends SimpleInputParamsInput {} +export interface SimpleInputParamsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes strings, numbers, and boolean values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, SimpleInputParamsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, SimpleInputParamsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new SimpleInputParamsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link SimpleInputParamsCommandInput} for command's `input` shape. + * @see {@link SimpleInputParamsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class SimpleInputParamsCommand extends $Command< + SimpleInputParamsCommandInput, + SimpleInputParamsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleInputParamsCommandInput) { + // 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 = "SimpleInputParamsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleInputParamsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleInputParamsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2SimpleInputParamsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2SimpleInputParamsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts new file mode 100644 index 000000000000..8d1f1e0e2ec1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.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 { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient"; +import { SimpleScalarXmlPropertiesOutput } from "../models/models_0"; +import { + deserializeAws_ec2SimpleScalarXmlPropertiesCommand, + serializeAws_ec2SimpleScalarXmlPropertiesCommand, +} from "../protocols/Aws_ec2"; + +export interface SimpleScalarXmlPropertiesCommandInput {} +export interface SimpleScalarXmlPropertiesCommandOutput extends SimpleScalarXmlPropertiesOutput, __MetadataBearer {} + +export class SimpleScalarXmlPropertiesCommand extends $Command< + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarXmlPropertiesCommandInput) { + // 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 = "SimpleScalarXmlPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: SimpleScalarXmlPropertiesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarXmlPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2SimpleScalarXmlPropertiesCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_ec2SimpleScalarXmlPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts new file mode 100644 index 000000000000..1232529f538a --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlBlobsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlBlobsCommand, serializeAws_ec2XmlBlobsCommand } from "../protocols/Aws_ec2"; + +export interface XmlBlobsCommandInput {} +export interface XmlBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} + +/** + * Blobs are base64 encoded + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new XmlBlobsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlBlobsCommandInput} for command's `input` shape. + * @see {@link XmlBlobsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlBlobsCommand extends $Command< + XmlBlobsCommandInput, + XmlBlobsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlBlobsCommandInput) { + // 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 = "XmlBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts new file mode 100644 index 000000000000..17a9dedce164 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts @@ -0,0 +1,75 @@ +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 { XmlBlobsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlEmptyBlobsCommand, serializeAws_ec2XmlEmptyBlobsCommand } from "../protocols/Aws_ec2"; + +export interface XmlEmptyBlobsCommandInput {} +export interface XmlEmptyBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} + +export class XmlEmptyBlobsCommand extends $Command< + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyBlobsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + 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 = "XmlEmptyBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlEmptyBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlEmptyBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts new file mode 100644 index 000000000000..22e3b9bb6dbd --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts @@ -0,0 +1,75 @@ +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 { XmlListsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlEmptyListsCommand, serializeAws_ec2XmlEmptyListsCommand } from "../protocols/Aws_ec2"; + +export interface XmlEmptyListsCommandInput {} +export interface XmlEmptyListsCommandOutput extends XmlListsOutput, __MetadataBearer {} + +export class XmlEmptyListsCommand extends $Command< + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyListsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + 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 = "XmlEmptyListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlEmptyListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlEmptyListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts new file mode 100644 index 000000000000..011cd3d719b6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlEnumsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlEnumsCommand, serializeAws_ec2XmlEnumsCommand } from "../protocols/Aws_ec2"; + +export interface XmlEnumsCommandInput {} +export interface XmlEnumsCommandOutput extends XmlEnumsOutput, __MetadataBearer {} + +/** + * This example serializes enums as top level properties, in lists, sets, and maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new XmlEnumsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlEnumsCommandInput} for command's `input` shape. + * @see {@link XmlEnumsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlEnumsCommand extends $Command< + XmlEnumsCommandInput, + XmlEnumsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEnumsCommandInput) { + // 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 = "XmlEnumsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlEnumsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlEnumsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlEnumsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts new file mode 100644 index 000000000000..86034a8ee244 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts @@ -0,0 +1,102 @@ +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 { XmlListsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlListsCommand, serializeAws_ec2XmlListsCommand } from "../protocols/Aws_ec2"; + +export interface XmlListsCommandInput {} +export interface XmlListsCommandOutput extends XmlListsOutput, __MetadataBearer {} + +/** + * This test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Flattened XML lists with @xmlNamespace. + * 8. Lists of structures. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new XmlListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlListsCommandInput} for command's `input` shape. + * @see {@link XmlListsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlListsCommand extends $Command< + XmlListsCommandInput, + XmlListsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlListsCommandInput) { + // 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 = "XmlListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts new file mode 100644 index 000000000000..2ac1df84a547 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts @@ -0,0 +1,75 @@ +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 { XmlNamespacesOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlNamespacesCommand, serializeAws_ec2XmlNamespacesCommand } from "../protocols/Aws_ec2"; + +export interface XmlNamespacesCommandInput {} +export interface XmlNamespacesCommandOutput extends XmlNamespacesOutput, __MetadataBearer {} + +export class XmlNamespacesCommand extends $Command< + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlNamespacesCommandInput) { + // 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 = "XmlNamespacesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlNamespacesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlNamespacesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlNamespacesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts new file mode 100644 index 000000000000..dd84204afb33 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts @@ -0,0 +1,94 @@ +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 { XmlTimestampsOutput } from "../models/models_0"; +import { deserializeAws_ec2XmlTimestampsCommand, serializeAws_ec2XmlTimestampsCommand } from "../protocols/Aws_ec2"; + +export interface XmlTimestampsCommandInput {} +export interface XmlTimestampsCommandOutput extends XmlTimestampsOutput, __MetadataBearer {} + +/** + * This tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EC2ProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import + * // const { EC2ProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import + * const client = new EC2ProtocolClient(config); + * const command = new XmlTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlTimestampsCommandInput} for command's `input` shape. + * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. + * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlTimestampsCommand extends $Command< + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, + EC2ProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlTimestampsCommandInput) { + // 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 = "XmlTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlTimestampsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_ec2XmlTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_ec2XmlTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts new file mode 100644 index 000000000000..6193c6e3088e --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts @@ -0,0 +1,21 @@ +export * from "./EmptyInputAndEmptyOutputCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HostWithPathOperationCommand"; +export * from "./IgnoresWrappingXmlNameCommand"; +export * from "./NestedStructuresCommand"; +export * from "./NoInputAndOutputCommand"; +export * from "./QueryIdempotencyTokenAutoFillCommand"; +export * from "./QueryListsCommand"; +export * from "./QueryTimestampsCommand"; +export * from "./RecursiveXmlShapesCommand"; +export * from "./SimpleInputParamsCommand"; +export * from "./SimpleScalarXmlPropertiesCommand"; +export * from "./XmlBlobsCommand"; +export * from "./XmlEmptyBlobsCommand"; +export * from "./XmlEmptyListsCommand"; +export * from "./XmlEnumsCommand"; +export * from "./XmlListsCommand"; +export * from "./XmlNamespacesCommand"; +export * from "./XmlTimestampsCommand"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts b/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts new file mode 100644 index 000000000000..1dff9bfbb8cb --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "awsec2.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "awsec2.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "awsec2.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "awsec2.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "awsec2.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "awsec2", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-ec2/src/index.ts b/protocol_tests/aws-protocoltests-ec2/src/index.ts new file mode 100644 index 000000000000..3224cf9eac55 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/index.ts @@ -0,0 +1,4 @@ +export * from "./EC2Protocol"; +export * from "./EC2ProtocolClient"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/models/index.ts b/protocol_tests/aws-protocoltests-ec2/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts b/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts new file mode 100644 index 000000000000..fc62d3d0aa95 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts @@ -0,0 +1,433 @@ +import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputOutput {} + +export namespace EmptyInputAndEmptyOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export interface IgnoresWrappingXmlNameOutput { + foo?: string; +} + +export namespace IgnoresWrappingXmlNameOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: IgnoresWrappingXmlNameOutput): any => ({ + ...obj, + }); +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); +} + +export interface QueryIdempotencyTokenAutoFillInput { + token?: string; +} + +export namespace QueryIdempotencyTokenAutoFillInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ + ...obj, + }); +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +export interface NestedStructWithList { + ListArg?: string[]; +} + +export namespace NestedStructWithList { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedStructWithList): any => ({ + ...obj, + }); +} + +export interface QueryListsInput { + ListArg?: string[]; + ComplexListArg?: GreetingStruct[]; + ListArgWithXmlNameMember?: string[]; + ListArgWithXmlName?: string[]; + NestedWithList?: NestedStructWithList; +} + +export namespace QueryListsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryListsInput): any => ({ + ...obj, + }); +} + +export interface QueryTimestampsInput { + normalFormat?: Date; + epochMember?: Date; + epochTarget?: Date; +} + +export namespace QueryTimestampsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryTimestampsInput): any => ({ + ...obj, + }); +} + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface SimpleInputParamsInput { + Foo?: string; + Bar?: string; + Baz?: boolean; + Bam?: number; + FloatValue?: number; + Boo?: number; + Qux?: Uint8Array; + FooEnum?: FooEnum | string; + HasQueryName?: string; + HasQueryAndXmlName?: string; + UsesXmlName?: string; +} + +export namespace SimpleInputParamsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleInputParamsInput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarXmlPropertiesOutput { + stringValue?: string; + emptyStringValue?: string; + trueBooleanValue?: boolean; + falseBooleanValue?: boolean; + byteValue?: number; + shortValue?: number; + integerValue?: number; + longValue?: number; + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarXmlPropertiesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarXmlPropertiesOutput): any => ({ + ...obj, + }); +} + +export interface XmlBlobsOutput { + data?: Uint8Array; +} + +export namespace XmlBlobsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlBlobsOutput): any => ({ + ...obj, + }); +} + +export interface StructureListMember { + a?: string; + b?: string; +} + +export namespace StructureListMember { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructureListMember): any => ({ + ...obj, + }); +} + +export interface XmlListsOutput { + stringList?: string[]; + stringSet?: string[]; + integerList?: number[]; + booleanList?: boolean[]; + timestampList?: Date[]; + enumList?: (FooEnum | string)[]; + /** + * A list of lists of strings. + */ + nestedStringList?: string[][]; + + renamedListMembers?: string[]; + flattenedList?: string[]; + flattenedList2?: string[]; + flattenedListWithMemberNamespace?: string[]; + flattenedListWithNamespace?: string[]; + structureList?: StructureListMember[]; +} + +export namespace XmlListsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlListsOutput): any => ({ + ...obj, + }); +} + +export interface XmlEnumsOutput { + fooEnum1?: FooEnum | string; + fooEnum2?: FooEnum | string; + fooEnum3?: FooEnum | string; + fooEnumList?: (FooEnum | string)[]; + fooEnumSet?: (FooEnum | string)[]; + fooEnumMap?: { [key: string]: FooEnum | string }; +} + +export namespace XmlEnumsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({ + ...obj, + }); +} + +export interface XmlNamespaceNested { + foo?: string; + values?: string[]; +} + +export namespace XmlNamespaceNested { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ + ...obj, + }); +} + +export interface XmlNamespacesOutput { + nested?: XmlNamespaceNested; +} + +export namespace XmlNamespacesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespacesOutput): any => ({ + ...obj, + }); +} + +export interface XmlTimestampsOutput { + normal?: Date; + dateTime?: Date; + epochSeconds?: Date; + httpDate?: Date; +} + +export namespace XmlTimestampsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlTimestampsOutput): any => ({ + ...obj, + }); +} + +export interface StructArg { + StringArg?: string; + OtherArg?: boolean; + RecursiveArg?: StructArg; +} + +export namespace StructArg { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructArg): any => ({ + ...obj, + }); +} + +export interface NestedStructuresInput { + Nested?: StructArg; +} + +export namespace NestedStructuresInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedStructuresInput): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutputNested1 { + foo?: string; + nested?: RecursiveXmlShapesOutputNested2; +} + +export namespace RecursiveXmlShapesOutputNested1 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested1): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutputNested2 { + bar?: string; + recursiveMember?: RecursiveXmlShapesOutputNested1; +} + +export namespace RecursiveXmlShapesOutputNested2 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested2): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutput { + nested?: RecursiveXmlShapesOutputNested1; +} + +export namespace RecursiveXmlShapesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutput): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts b/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts new file mode 100644 index 000000000000..53711d9be60b --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts @@ -0,0 +1,2273 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + expectNonNull as __expectNonNull, + expectString as __expectString, + extendedEncodeURIComponent as __extendedEncodeURIComponent, + getArrayIfSingleItem as __getArrayIfSingleItem, + getValueFromTextNode as __getValueFromTextNode, + parseBoolean as __parseBoolean, + parseEpochTimestamp as __parseEpochTimestamp, + parseRfc3339DateTime as __parseRfc3339DateTime, + parseRfc7231DateTime as __parseRfc7231DateTime, + serializeFloat as __serializeFloat, + strictParseByte as __strictParseByte, + strictParseFloat as __strictParseFloat, + strictParseInt32 as __strictParseInt32, + strictParseLong as __strictParseLong, + strictParseShort as __strictParseShort, +} from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + HeaderBag as __HeaderBag, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { decodeHTML } from "entities"; +import { parse as xmlParse } from "fast-xml-parser"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "../commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "../commands/EndpointWithHostLabelOperationCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "../commands/IgnoresWrappingXmlNameCommand"; +import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "../commands/NestedStructuresCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "../commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommandInput, QueryListsCommandOutput } from "../commands/QueryListsCommand"; +import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "../commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "../commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "../commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "../commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; +import { + ComplexError, + ComplexNestedErrorData, + EmptyInputAndEmptyOutputInput, + EmptyInputAndEmptyOutputOutput, + FooEnum, + GreetingStruct, + GreetingWithErrorsOutput, + HostLabelInput, + IgnoresWrappingXmlNameOutput, + InvalidGreeting, + NestedStructuresInput, + NestedStructWithList, + NoInputAndOutputOutput, + QueryIdempotencyTokenAutoFillInput, + QueryListsInput, + QueryTimestampsInput, + RecursiveXmlShapesOutput, + RecursiveXmlShapesOutputNested1, + RecursiveXmlShapesOutputNested2, + SimpleInputParamsInput, + SimpleScalarXmlPropertiesOutput, + StructArg, + StructureListMember, + XmlBlobsOutput, + XmlEnumsOutput, + XmlListsOutput, + XmlNamespaceNested, + XmlNamespacesOutput, + XmlTimestampsOutput, +} from "../models/models_0"; + +export const serializeAws_ec2EmptyInputAndEmptyOutputCommand = async ( + input: EmptyInputAndEmptyOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2EmptyInputAndEmptyOutputInput(input, context), + Action: "EmptyInputAndEmptyOutput", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2EndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "EndpointOperation", + Version: "2020-01-08", + }); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_ec2EndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2HostLabelInput(input, context), + Action: "EndpointWithHostLabelOperation", + Version: "2020-01-08", + }); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_ec2GreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "GreetingWithErrors", + Version: "2020-01-08", + }); + 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 +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "IgnoresWrappingXmlName", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2NestedStructuresCommand = async ( + input: NestedStructuresCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2NestedStructuresInput(input, context), + Action: "NestedStructures", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2NoInputAndOutputCommand = async ( + input: NoInputAndOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "NoInputAndOutput", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2QueryIdempotencyTokenAutoFillCommand = async ( + input: QueryIdempotencyTokenAutoFillCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2QueryIdempotencyTokenAutoFillInput(input, context), + Action: "QueryIdempotencyTokenAutoFill", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2QueryListsCommand = async ( + input: QueryListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2QueryListsInput(input, context), + Action: "QueryLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2QueryTimestampsCommand = async ( + input: QueryTimestampsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2QueryTimestampsInput(input, context), + Action: "QueryTimestamps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2RecursiveXmlShapesCommand = async ( + input: RecursiveXmlShapesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "RecursiveXmlShapes", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2SimpleInputParamsCommand = async ( + input: SimpleInputParamsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_ec2SimpleInputParamsInput(input, context), + Action: "SimpleInputParams", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2SimpleScalarXmlPropertiesCommand = async ( + input: SimpleScalarXmlPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "SimpleScalarXmlProperties", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlBlobsCommand = async ( + input: XmlBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlBlobs", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlEmptyBlobsCommand = async ( + input: XmlEmptyBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEmptyBlobs", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlEmptyListsCommand = async ( + input: XmlEmptyListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEmptyLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlEnumsCommand = async ( + input: XmlEnumsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEnums", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlListsCommand = async ( + input: XmlListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlNamespacesCommand = async ( + input: XmlNamespacesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlNamespaces", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_ec2XmlTimestampsCommand = async ( + input: XmlTimestampsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlTimestamps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const deserializeAws_ec2EmptyInputAndEmptyOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2EmptyInputAndEmptyOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2EmptyInputAndEmptyOutputOutput(data, context); + const response: EmptyInputAndEmptyOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2EmptyInputAndEmptyOutputCommandError = 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_ec2EndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2EndpointOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2EndpointOperationCommandError = 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_ec2EndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2EndpointWithHostLabelOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2EndpointWithHostLabelOperationCommandError = 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_ec2GreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2GreetingWithErrorsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2GreetingWithErrorsOutput(data, context); + const response: GreetingWithErrorsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2GreetingWithErrorsCommandError = 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) { + case "ComplexError": + case "aws.protocoltests.ec2#ComplexError": + response = { + ...(await deserializeAws_ec2ComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.ec2#InvalidGreeting": + response = { + ...(await deserializeAws_ec2InvalidGreetingResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + 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_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 +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2IgnoresWrappingXmlNameCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2IgnoresWrappingXmlNameOutput(data, context); + const response: IgnoresWrappingXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2IgnoresWrappingXmlNameCommandError = 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_ec2NestedStructuresCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2NestedStructuresCommandError(output, context); + } + await collectBody(output.body, context); + const response: NestedStructuresCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2NestedStructuresCommandError = 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_ec2NoInputAndOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2NoInputAndOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2NoInputAndOutputOutput(data, context); + const response: NoInputAndOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2NoInputAndOutputCommandError = 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_ec2QueryIdempotencyTokenAutoFillCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2QueryIdempotencyTokenAutoFillCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryIdempotencyTokenAutoFillCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2QueryIdempotencyTokenAutoFillCommandError = 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_ec2QueryListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2QueryListsCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryListsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2QueryListsCommandError = 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_ec2QueryTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2QueryTimestampsCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryTimestampsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2QueryTimestampsCommandError = 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_ec2RecursiveXmlShapesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2RecursiveXmlShapesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2RecursiveXmlShapesOutput(data, context); + const response: RecursiveXmlShapesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2RecursiveXmlShapesCommandError = 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_ec2SimpleInputParamsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2SimpleInputParamsCommandError(output, context); + } + await collectBody(output.body, context); + const response: SimpleInputParamsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2SimpleInputParamsCommandError = 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_ec2SimpleScalarXmlPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2SimpleScalarXmlPropertiesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2SimpleScalarXmlPropertiesOutput(data, context); + const response: SimpleScalarXmlPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2SimpleScalarXmlPropertiesCommandError = 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_ec2XmlBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlBlobsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlBlobsOutput(data, context); + const response: XmlBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlBlobsCommandError = 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_ec2XmlEmptyBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlEmptyBlobsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlBlobsOutput(data, context); + const response: XmlEmptyBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlEmptyBlobsCommandError = 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_ec2XmlEmptyListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlEmptyListsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlListsOutput(data, context); + const response: XmlEmptyListsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlEmptyListsCommandError = 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_ec2XmlEnumsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlEnumsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlEnumsOutput(data, context); + const response: XmlEnumsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlEnumsCommandError = 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_ec2XmlListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlListsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlListsOutput(data, context); + const response: XmlListsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlListsCommandError = 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_ec2XmlNamespacesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlNamespacesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlNamespacesOutput(data, context); + const response: XmlNamespacesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlNamespacesCommandError = 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_ec2XmlTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_ec2XmlTimestampsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_ec2XmlTimestampsOutput(data, context); + const response: XmlTimestampsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_ec2XmlTimestampsCommandError = 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)); +}; + +const deserializeAws_ec2ComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_ec2ComplexError(body.Errors.Error, context); + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_ec2InvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_ec2InvalidGreeting(body.Errors.Error, context); + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const serializeAws_ec2EmptyInputAndEmptyOutputInput = ( + input: EmptyInputAndEmptyOutputInput, + context: __SerdeContext +): any => { + const entries: any = {}; + return entries; +}; + +const serializeAws_ec2HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.label !== undefined && input.label !== null) { + entries["Label"] = input.label; + } + return entries; +}; + +const serializeAws_ec2ListWithXmlName = (input: string[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`Item.${counter}`] = entry; + counter++; + } + return entries; +}; + +const serializeAws_ec2NestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.Nested !== undefined && input.Nested !== null) { + const memberEntries = serializeAws_ec2StructArg(input.Nested, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Nested.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_ec2NestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { + const entries: any = {}; + if (input.ListArg !== undefined && input.ListArg !== null) { + const memberEntries = serializeAws_ec2StringList(input.ListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArg.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_ec2QueryIdempotencyTokenAutoFillInput = ( + input: QueryIdempotencyTokenAutoFillInput, + context: __SerdeContext +): any => { + const entries: any = {}; + if (input.token === undefined) { + input.token = generateIdempotencyToken(); + } + if (input.token !== undefined && input.token !== null) { + entries["Token"] = input.token; + } + return entries; +}; + +const serializeAws_ec2QueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.ListArg !== undefined && input.ListArg !== null) { + const memberEntries = serializeAws_ec2StringList(input.ListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArg.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.ComplexListArg !== undefined && input.ComplexListArg !== null) { + const memberEntries = serializeAws_ec2GreetingList(input.ComplexListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ComplexListArg.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.ListArgWithXmlNameMember !== undefined && input.ListArgWithXmlNameMember !== null) { + const memberEntries = serializeAws_ec2ListWithXmlName(input.ListArgWithXmlNameMember, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArgWithXmlNameMember.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.ListArgWithXmlName !== undefined && input.ListArgWithXmlName !== null) { + const memberEntries = serializeAws_ec2ListWithXmlName(input.ListArgWithXmlName, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.NestedWithList !== undefined && input.NestedWithList !== null) { + const memberEntries = serializeAws_ec2NestedStructWithList(input.NestedWithList, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `NestedWithList.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_ec2QueryTimestampsInput = (input: QueryTimestampsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.normalFormat !== undefined && input.normalFormat !== null) { + entries["NormalFormat"] = input.normalFormat.toISOString().split(".")[0] + "Z"; + } + if (input.epochMember !== undefined && input.epochMember !== null) { + entries["EpochMember"] = Math.round(input.epochMember.getTime() / 1000); + } + if (input.epochTarget !== undefined && input.epochTarget !== null) { + entries["EpochTarget"] = Math.round(input.epochTarget.getTime() / 1000); + } + return entries; +}; + +const serializeAws_ec2SimpleInputParamsInput = (input: SimpleInputParamsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.Foo !== undefined && input.Foo !== null) { + entries["Foo"] = input.Foo; + } + if (input.Bar !== undefined && input.Bar !== null) { + entries["Bar"] = input.Bar; + } + if (input.Baz !== undefined && input.Baz !== null) { + entries["Baz"] = input.Baz; + } + if (input.Bam !== undefined && input.Bam !== null) { + entries["Bam"] = input.Bam; + } + if (input.FloatValue !== undefined && input.FloatValue !== null) { + entries["FloatValue"] = __serializeFloat(input.FloatValue); + } + if (input.Boo !== undefined && input.Boo !== null) { + entries["Boo"] = __serializeFloat(input.Boo); + } + if (input.Qux !== undefined && input.Qux !== null) { + entries["Qux"] = context.base64Encoder(input.Qux); + } + if (input.FooEnum !== undefined && input.FooEnum !== null) { + entries["FooEnum"] = input.FooEnum; + } + if (input.HasQueryName !== undefined && input.HasQueryName !== null) { + entries["A"] = input.HasQueryName; + } + if (input.HasQueryAndXmlName !== undefined && input.HasQueryAndXmlName !== null) { + entries["B"] = input.HasQueryAndXmlName; + } + if (input.UsesXmlName !== undefined && input.UsesXmlName !== null) { + entries["C"] = input.UsesXmlName; + } + return entries; +}; + +const serializeAws_ec2StructArg = (input: StructArg, context: __SerdeContext): any => { + const entries: any = {}; + if (input.StringArg !== undefined && input.StringArg !== null) { + entries["StringArg"] = input.StringArg; + } + if (input.OtherArg !== undefined && input.OtherArg !== null) { + entries["OtherArg"] = input.OtherArg; + } + if (input.RecursiveArg !== undefined && input.RecursiveArg !== null) { + const memberEntries = serializeAws_ec2StructArg(input.RecursiveArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `RecursiveArg.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_ec2GreetingList = (input: GreetingStruct[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = serializeAws_ec2GreetingStruct(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`Member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; +}; + +const serializeAws_ec2GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + const entries: any = {}; + if (input.hi !== undefined && input.hi !== null) { + entries["Hi"] = input.hi; + } + return entries; +}; + +const serializeAws_ec2StringList = (input: string[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`Member.${counter}`] = entry; + counter++; + } + return entries; +}; + +const deserializeAws_ec2ComplexError = (output: any, context: __SerdeContext): ComplexError => { + const contents: any = { + TopLevel: undefined, + Nested: undefined, + }; + if (output["TopLevel"] !== undefined) { + contents.TopLevel = __expectString(output["TopLevel"]); + } + if (output["Nested"] !== undefined) { + contents.Nested = deserializeAws_ec2ComplexNestedErrorData(output["Nested"], context); + } + return contents; +}; + +const deserializeAws_ec2ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { + const contents: any = { + Foo: undefined, + }; + if (output["Foo"] !== undefined) { + contents.Foo = __expectString(output["Foo"]); + } + return contents; +}; + +const deserializeAws_ec2EmptyInputAndEmptyOutputOutput = ( + output: any, + context: __SerdeContext +): EmptyInputAndEmptyOutputOutput => { + const contents: any = {}; + return contents; +}; + +const deserializeAws_ec2GreetingWithErrorsOutput = (output: any, context: __SerdeContext): GreetingWithErrorsOutput => { + const contents: any = { + greeting: undefined, + }; + if (output["greeting"] !== undefined) { + contents.greeting = __expectString(output["greeting"]); + } + return contents; +}; + +const deserializeAws_ec2IgnoresWrappingXmlNameOutput = ( + output: any, + context: __SerdeContext +): IgnoresWrappingXmlNameOutput => { + const contents: any = { + foo: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + return contents; +}; + +const deserializeAws_ec2InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { + const contents: any = { + Message: undefined, + }; + if (output["Message"] !== undefined) { + contents.Message = __expectString(output["Message"]); + } + return contents; +}; + +const deserializeAws_ec2ListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2ListWithNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInputAndOutputOutput => { + const contents: any = {}; + return contents; +}; + +const deserializeAws_ec2RecursiveXmlShapesOutput = (output: any, context: __SerdeContext): RecursiveXmlShapesOutput => { + const contents: any = { + nested: undefined, + }; + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_ec2RecursiveXmlShapesOutputNested1(output["nested"], context); + } + return contents; +}; + +const deserializeAws_ec2RecursiveXmlShapesOutputNested1 = ( + output: any, + context: __SerdeContext +): RecursiveXmlShapesOutputNested1 => { + const contents: any = { + foo: undefined, + nested: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_ec2RecursiveXmlShapesOutputNested2(output["nested"], context); + } + return contents; +}; + +const deserializeAws_ec2RecursiveXmlShapesOutputNested2 = ( + output: any, + context: __SerdeContext +): RecursiveXmlShapesOutputNested2 => { + const contents: any = { + bar: undefined, + recursiveMember: undefined, + }; + if (output["bar"] !== undefined) { + contents.bar = __expectString(output["bar"]); + } + if (output["recursiveMember"] !== undefined) { + contents.recursiveMember = deserializeAws_ec2RecursiveXmlShapesOutputNested1(output["recursiveMember"], context); + } + return contents; +}; + +const deserializeAws_ec2RenamedListMembers = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2SimpleScalarXmlPropertiesOutput = ( + output: any, + context: __SerdeContext +): SimpleScalarXmlPropertiesOutput => { + const contents: any = { + stringValue: undefined, + emptyStringValue: undefined, + trueBooleanValue: undefined, + falseBooleanValue: undefined, + byteValue: undefined, + shortValue: undefined, + integerValue: undefined, + longValue: undefined, + floatValue: undefined, + doubleValue: undefined, + }; + if (output["stringValue"] !== undefined) { + contents.stringValue = __expectString(output["stringValue"]); + } + if (output["emptyStringValue"] !== undefined) { + contents.emptyStringValue = __expectString(output["emptyStringValue"]); + } + if (output["trueBooleanValue"] !== undefined) { + contents.trueBooleanValue = __parseBoolean(output["trueBooleanValue"]); + } + if (output["falseBooleanValue"] !== undefined) { + contents.falseBooleanValue = __parseBoolean(output["falseBooleanValue"]); + } + if (output["byteValue"] !== undefined) { + contents.byteValue = __strictParseByte(output["byteValue"]) as number; + } + if (output["shortValue"] !== undefined) { + contents.shortValue = __strictParseShort(output["shortValue"]) as number; + } + if (output["integerValue"] !== undefined) { + contents.integerValue = __strictParseInt32(output["integerValue"]) as number; + } + if (output["longValue"] !== undefined) { + contents.longValue = __strictParseLong(output["longValue"]) as number; + } + if (output["floatValue"] !== undefined) { + contents.floatValue = __strictParseFloat(output["floatValue"]) as number; + } + if (output["DoubleDribble"] !== undefined) { + contents.doubleValue = __strictParseFloat(output["DoubleDribble"]) as number; + } + return contents; +}; + +const deserializeAws_ec2StructureList = (output: any, context: __SerdeContext): StructureListMember[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_ec2StructureListMember(entry, context); + }); +}; + +const deserializeAws_ec2StructureListMember = (output: any, context: __SerdeContext): StructureListMember => { + const contents: any = { + a: undefined, + b: undefined, + }; + if (output["value"] !== undefined) { + contents.a = __expectString(output["value"]); + } + if (output["other"] !== undefined) { + contents.b = __expectString(output["other"]); + } + return contents; +}; + +const deserializeAws_ec2XmlBlobsOutput = (output: any, context: __SerdeContext): XmlBlobsOutput => { + const contents: any = { + data: undefined, + }; + if (output["data"] !== undefined) { + contents.data = context.base64Decoder(output["data"]); + } + return contents; +}; + +const deserializeAws_ec2XmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput => { + const contents: any = { + fooEnum1: undefined, + fooEnum2: undefined, + fooEnum3: undefined, + fooEnumList: undefined, + fooEnumSet: undefined, + fooEnumMap: undefined, + }; + if (output["fooEnum1"] !== undefined) { + contents.fooEnum1 = __expectString(output["fooEnum1"]); + } + if (output["fooEnum2"] !== undefined) { + contents.fooEnum2 = __expectString(output["fooEnum2"]); + } + if (output["fooEnum3"] !== undefined) { + contents.fooEnum3 = __expectString(output["fooEnum3"]); + } + if (output.fooEnumList === "") { + contents.fooEnumList = []; + } + if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { + contents.fooEnumList = deserializeAws_ec2FooEnumList( + __getArrayIfSingleItem(output["fooEnumList"]["member"]), + context + ); + } + if (output.fooEnumSet === "") { + contents.fooEnumSet = []; + } + if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { + contents.fooEnumSet = deserializeAws_ec2FooEnumSet(__getArrayIfSingleItem(output["fooEnumSet"]["member"]), context); + } + if (output.fooEnumMap === "") { + contents.fooEnumMap = {}; + } + if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { + contents.fooEnumMap = deserializeAws_ec2FooEnumMap(__getArrayIfSingleItem(output["fooEnumMap"]["entry"]), context); + } + return contents; +}; + +const deserializeAws_ec2XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput => { + const contents: any = { + stringList: undefined, + stringSet: undefined, + integerList: undefined, + booleanList: undefined, + timestampList: undefined, + enumList: undefined, + nestedStringList: undefined, + renamedListMembers: undefined, + flattenedList: undefined, + flattenedList2: undefined, + flattenedListWithMemberNamespace: undefined, + flattenedListWithNamespace: undefined, + structureList: undefined, + }; + if (output.stringList === "") { + contents.stringList = []; + } + if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { + contents.stringList = deserializeAws_ec2StringList(__getArrayIfSingleItem(output["stringList"]["member"]), context); + } + if (output.stringSet === "") { + contents.stringSet = []; + } + if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { + contents.stringSet = deserializeAws_ec2StringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); + } + if (output.integerList === "") { + contents.integerList = []; + } + if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { + contents.integerList = deserializeAws_ec2IntegerList( + __getArrayIfSingleItem(output["integerList"]["member"]), + context + ); + } + if (output.booleanList === "") { + contents.booleanList = []; + } + if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { + contents.booleanList = deserializeAws_ec2BooleanList( + __getArrayIfSingleItem(output["booleanList"]["member"]), + context + ); + } + if (output.timestampList === "") { + contents.timestampList = []; + } + if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { + contents.timestampList = deserializeAws_ec2TimestampList( + __getArrayIfSingleItem(output["timestampList"]["member"]), + context + ); + } + if (output.enumList === "") { + contents.enumList = []; + } + if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { + contents.enumList = deserializeAws_ec2FooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); + } + if (output.nestedStringList === "") { + contents.nestedStringList = []; + } + if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { + contents.nestedStringList = deserializeAws_ec2NestedStringList( + __getArrayIfSingleItem(output["nestedStringList"]["member"]), + context + ); + } + if (output.renamed === "") { + contents.renamedListMembers = []; + } + if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { + contents.renamedListMembers = deserializeAws_ec2RenamedListMembers( + __getArrayIfSingleItem(output["renamed"]["item"]), + context + ); + } + if (output.flattenedList === "") { + contents.flattenedList = []; + } + if (output["flattenedList"] !== undefined) { + contents.flattenedList = deserializeAws_ec2RenamedListMembers( + __getArrayIfSingleItem(output["flattenedList"]), + context + ); + } + if (output.customName === "") { + contents.flattenedList2 = []; + } + if (output["customName"] !== undefined) { + contents.flattenedList2 = deserializeAws_ec2RenamedListMembers( + __getArrayIfSingleItem(output["customName"]), + context + ); + } + if (output.flattenedListWithMemberNamespace === "") { + contents.flattenedListWithMemberNamespace = []; + } + if (output["flattenedListWithMemberNamespace"] !== undefined) { + contents.flattenedListWithMemberNamespace = deserializeAws_ec2ListWithMemberNamespace( + __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), + context + ); + } + if (output.flattenedListWithNamespace === "") { + contents.flattenedListWithNamespace = []; + } + if (output["flattenedListWithNamespace"] !== undefined) { + contents.flattenedListWithNamespace = deserializeAws_ec2ListWithNamespace( + __getArrayIfSingleItem(output["flattenedListWithNamespace"]), + context + ); + } + if (output.myStructureList === "") { + contents.structureList = []; + } + if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { + contents.structureList = deserializeAws_ec2StructureList( + __getArrayIfSingleItem(output["myStructureList"]["item"]), + context + ); + } + return contents; +}; + +const deserializeAws_ec2XmlNamespacedList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2XmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { + const contents: any = { + foo: undefined, + values: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output.values === "") { + contents.values = []; + } + if (output["values"] !== undefined && output["values"]["member"] !== undefined) { + contents.values = deserializeAws_ec2XmlNamespacedList(__getArrayIfSingleItem(output["values"]["member"]), context); + } + return contents; +}; + +const deserializeAws_ec2XmlNamespacesOutput = (output: any, context: __SerdeContext): XmlNamespacesOutput => { + const contents: any = { + nested: undefined, + }; + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_ec2XmlNamespaceNested(output["nested"], context); + } + return contents; +}; + +const deserializeAws_ec2XmlTimestampsOutput = (output: any, context: __SerdeContext): XmlTimestampsOutput => { + const contents: any = { + normal: undefined, + dateTime: undefined, + epochSeconds: undefined, + httpDate: undefined, + }; + if (output["normal"] !== undefined) { + contents.normal = __expectNonNull(__parseRfc3339DateTime(output["normal"])); + } + if (output["dateTime"] !== undefined) { + contents.dateTime = __expectNonNull(__parseRfc3339DateTime(output["dateTime"])); + } + if (output["epochSeconds"] !== undefined) { + contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(output["epochSeconds"])); + } + if (output["httpDate"] !== undefined) { + contents.httpDate = __expectNonNull(__parseRfc7231DateTime(output["httpDate"])); + } + return contents; +}; + +const deserializeAws_ec2BooleanList = (output: any, context: __SerdeContext): boolean[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __parseBoolean(entry); + }); +}; + +const deserializeAws_ec2FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2FooEnumMap = (output: any, context: __SerdeContext): { [key: string]: FooEnum | string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["value"] === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: __expectString(pair["value"]) as any, + }; + }, {}); +}; + +const deserializeAws_ec2FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2IntegerList = (output: any, context: __SerdeContext): number[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __strictParseInt32(entry) as number; + }); +}; + +const deserializeAws_ec2NestedStringList = (output: any, context: __SerdeContext): string[][] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_ec2StringList(__getArrayIfSingleItem(entry["member"]), context); + }); +}; + +const deserializeAws_ec2StringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2StringSet = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_ec2TimestampList = (output: any, context: __SerdeContext): Date[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectNonNull(__parseRfc3339DateTime(entry)); + }); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const buildHttpRpcRequest = async ( + context: __SerdeContext, + headers: __HeaderBag, + path: string, + resolvedHostname: string | undefined, + body: any +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents: any = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers, + }; + if (resolvedHostname !== undefined) { + contents.hostname = resolvedHostname; + } + if (body !== undefined) { + contents.body = body; + } + return new __HttpRequest(contents); +}; + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + const parsedObj = xmlParse(encoded, { + attributeNamePrefix: "", + ignoreAttributes: false, + parseNodeValue: false, + trimValues: false, + tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + }); + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return __getValueFromTextNode(parsedObjToReturn); + } + return {}; + }); + +const buildFormUrlencodedString = (formEntries: { [key: string]: string }): string => + Object.entries(formEntries) + .map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value)) + .join("&"); + +const loadEc2ErrorCode = (output: __HttpResponse, data: any): string => { + if (data.Errors.Error.Code !== undefined) { + return data.Errors.Error.Code; + } + if (output.statusCode == 404) { + return "NotFound"; + } + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..aa5e0b059e47 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts @@ -0,0 +1,37 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..2d7386ac1163 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..8b25f37edde3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { defaultRegionInfoProvider } from "./endpoints"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => ({ + apiVersion: "2020-01-08", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "EC2 Protocol", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts new file mode 100644 index 000000000000..ca6e2ed871b4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts @@ -0,0 +1,40 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts b/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts new file mode 100644 index 000000000000..ae49d2885cf8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts @@ -0,0 +1,2344 @@ +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"; + +import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; +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"; +import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommand } from "../../src/commands/QueryListsCommand"; +import { QueryTimestampsCommand } from "../../src/commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommand } from "../../src/commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommand } from "../../src/commands/SimpleInputParamsCommand"; +import { SimpleScalarXmlPropertiesCommand } from "../../src/commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; +import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; +import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; +import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; +import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; +import { EC2ProtocolClient } from "../../src/EC2ProtocolClient"; +import { ComplexError, InvalidGreeting } from "../../src/models/models_0"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Empty input serializes no extra query params + */ +it("Ec2QueryEmptyInputAndEmptyOutput:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyInputAndEmptyOutputCommand({} as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EmptyInputAndEmptyOutput&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output + */ +it("Ec2QueryEmptyInputAndEmptyOutput:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + requestid + + ` + ), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("Ec2QueryEndpointTrait:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EndpointOperation&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("Ec2QueryEndpointTraitWithHostLabel:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EndpointWithHostLabelOperation&Version=2020-01-08&Label=bar`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that operations with errors successfully know how to deserialize the successful response + */ +it("Ec2GreetingWithErrors:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + Hello + requestid + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + greeting: "Hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses simple XML errors + */ +it("Ec2InvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + + InvalidGreeting + Hi + + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +it("Ec2ComplexError:Error:GreetingWithErrors", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + + ComplexError + Hi + Top level + + bar + + + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + 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 + */ +it("Ec2IgnoresWrappingXmlName:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + bar + requestid + + ` + ), + }); + + const params: any = {}; + const command = new IgnoresWrappingXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "bar", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes nested structures using dots + */ +it("Ec2NestedStructures:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NestedStructuresCommand({ + Nested: { + StringArg: "foo", + + OtherArg: true, + + RecursiveArg: { + StringArg: "baz", + } as any, + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=NestedStructures&Version=2020-01-08&Nested.StringArg=foo&Nested.OtherArg=true&Nested.RecursiveArg.StringArg=baz`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * No input serializes no payload + */ +it("Ec2QueryNoInputAndOutput:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndOutputCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=NoInputAndOutput&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output + */ +it("Ec2QueryNoInputAndOutput:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + requestid + + ` + ), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Automatically adds idempotency token when not set + */ +it("Ec2ProtocolIdempotencyTokenAutoFill:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&Token=00000000-0000-4000-8000-000000000000`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Uses the given idempotency token as-is + */ +it("Ec2ProtocolIdempotencyTokenAutoFillIsSet:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000123", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&Token=00000000-0000-4000-8000-000000000123`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query lists. All EC2 lists are flattened. + */ +it("Ec2Lists:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArg: ["foo", "bar", "baz"], + + ComplexListArg: [ + { + hi: "hello", + } as any, + + { + hi: "hola", + } as any, + ], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&ComplexListArg.1.Hi=hello&ComplexListArg.2.Hi=hola`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Does not serialize empty query lists + */ +it("Ec2EmptyQueryLists:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArg: [], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * An xmlName trait in the member of a list has no effect on the list serialization. + */ +it("Ec2ListArgWithXmlNameMember:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArgWithXmlNameMember: ["A", "B"], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&ListArgWithXmlNameMember.1=A&ListArgWithXmlNameMember.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Changes the name of the list using the xmlName trait + */ +it("Ec2ListMemberWithXmlName:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArgWithXmlName: ["A", "B"], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&Hi.1=A&Hi.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Nested structure with a list member + */ +it("Ec2ListNestedStructWithList:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + NestedWithList: { + ListArg: ["A", "B"], + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.1=A&NestedWithList.ListArg.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamps + */ +it("Ec2TimestampsInput:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryTimestampsCommand({ + normalFormat: new Date(1422172800000), + + epochMember: new Date(1422172800000), + + epochTarget: new Date(1422172800000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryTimestamps&Version=2020-01-08&NormalFormat=2015-01-25T08%3A00%3A00Z&EpochMember=1422172800&EpochTarget=1422172800`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes recursive structures + */ +it("Ec2RecursiveShapes:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + Foo1 + + Bar1 + + Foo2 + + Bar2 + + + + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new RecursiveXmlShapesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes strings + */ +it("Ec2SimpleInputParamsStrings:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Foo: "val1", + + Bar: "val2", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Bar=val2`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes booleans that are true + */ +it("Ec2SimpleInputParamsStringAndBooleanTrue:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Foo: "val1", + + Baz: true, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Baz=true`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes booleans that are false + */ +it("Ec2SimpleInputParamsStringsAndBooleanFalse:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Baz: false, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Baz=false`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes integers + */ +it("Ec2SimpleInputParamsInteger:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Bam: 10, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Bam=10`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes floats + */ +it("Ec2SimpleInputParamsFloat:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Boo: 10.8, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Boo=10.8`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Blobs are base64 encoded in the query string + */ +it("Ec2SimpleInputParamsBlob:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Qux: Uint8Array.from("value", (c) => c.charCodeAt(0)), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Qux=dmFsdWU%3D`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes enums in the query string + */ +it("Ec2Enums:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FooEnum: "Foo", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FooEnum=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query using ec2QueryName trait. + */ +it("Ec2Query:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + HasQueryName: "Hi", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&A=Hi`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * ec2QueryName trait is preferred over xmlName. + */ +it("Ec2QueryIsPreferred:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + HasQueryAndXmlName: "Hi", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&B=Hi`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * xmlName is used with the ec2 protocol, but the first character is uppercased + */ +it("Ec2XmlNameIsUppercased:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + UsesXmlName: "Hi", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&C=Hi`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("Ec2QuerySupportsNaNFloatInputs:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: NaN, + + Boo: NaN, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=NaN&Boo=NaN`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("Ec2QuerySupportsInfinityFloatInputs:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: Infinity, + + Boo: Infinity, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=Infinity&Boo=Infinity`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("Ec2QuerySupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: -Infinity, + + Boo: -Infinity, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=-Infinity&Boo=-Infinity`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("Ec2SimpleScalarProperties:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + string + + true + false + 1 + 2 + 3 + 4 + 5.5 + 6.5 + requestid + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + emptyStringValue: "", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float values. + */ +it("Ec2QuerySupportsNaNFloatOutputs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + NaN + NaN + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("Ec2QuerySupportsInfinityFloatOutputs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + Infinity + Infinity + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("Ec2QuerySupportsNegativeInfinityFloatOutputs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + -Infinity + -Infinity + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Blobs are base64 encoded + */ +it("Ec2XmlBlobs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + dmFsdWU= + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty blobs are deserialized as empty string + */ +it("Ec2XmlEmptyBlobs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty self closed blobs are deserialized as empty string + */ +it("Ec2XmlEmptySelfClosedBlobs:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes empty XML lists + */ +it("Ec2XmlEmptyLists:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: [], + + stringSet: [], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("Ec2XmlEnums:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + Foo + 0 + 1 + + Foo + 0 + + + Foo + 0 + + + + hi + Foo + + + zero + 0 + + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlEnumsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests for XML list serialization + */ +it("Ec2XmlLists:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + foo + bar + + + foo + bar + + + 1 + 2 + + + true + false + + + 2014-04-29T18:30:38Z + 2014-04-29T18:30:38Z + + + Foo + 0 + + + + foo + bar + + + baz + qux + + + + foo + bar + + hi + bye + yep + nope + a + b + a + b + + + 1 + 2 + + + 3 + 4 + + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + renamedListMembers: ["foo", "bar"], + + flattenedList: ["hi", "bye"], + + flattenedList2: ["yep", "nope"], + + flattenedListWithMemberNamespace: ["a", "b"], + + flattenedListWithNamespace: ["a", "b"], + + structureList: [ + { + a: "1", + + b: "2", + }, + + { + a: "3", + + b: "4", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML namespaces + */ +it("Ec2XmlNamespaces:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + + Foo + + Bar + Baz + + + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlNamespacesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo", + + values: ["Bar", "Baz"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests how normal timestamps are serialized + */ +it("Ec2XmlTimestamps:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + 2014-04-29T18:30:38Z + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + normal: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("Ec2XmlTimestampsWithDateTimeFormat:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + 2014-04-29T18:30:38Z + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + dateTime: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("Ec2XmlTimestampsWithEpochSecondsFormat:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + 1398796238 + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + epochSeconds: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("Ec2XmlTimestampsWithHttpDateFormat:Response", async () => { + const client = new EC2ProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml;charset=UTF-8", + }, + ` + Tue, 29 Apr 2014 18:30:38 GMT + requestid + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + httpDate: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBody: string): Object => { + const fromEntries = (components: string[][]): { [key: string]: string } => { + const parts: { [key: string]: string } = {}; + + components.forEach((component) => { + parts[component[0]] = component[1]; + }); + + return parts; + }; + + // Generate to k:v maps from query components + const expectedParts = fromEntries(expectedBody.split("&").map((part) => part.trim().split("="))); + const generatedParts = fromEntries(generatedBody.split("&").map((part) => part.trim().split("="))); + + 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-protocoltests-ec2/tsconfig.es.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-ec2/tsconfig.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-json-10/.gitignore b/protocol_tests/aws-protocoltests-json-10/.gitignore new file mode 100644 index 000000000000..54f14c9aef25 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json diff --git a/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md b/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md new file mode 100644 index 000000000000..0995571d0579 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md @@ -0,0 +1,195 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + +**Note:** Version bump only for package @aws-sdk/aws-json-10 + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* **protocol_tests:** add downlevel-dts script to aws-json-10 ([#2540](https://github.com/aws/aws-sdk-js-v3/issues/2540)) ([e77b926](https://github.com/aws/aws-sdk-js-v3/commit/e77b926c739bcf8fd673a6f2725116ef6865c6c0)) diff --git a/protocol_tests/aws-protocoltests-json-10/LICENSE b/protocol_tests/aws-protocoltests-json-10/LICENSE new file mode 100644 index 000000000000..f9e0c8672bca --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-json-10/README.md b/protocol_tests/aws-protocoltests-json-10/README.md new file mode 100644 index 000000000000..d5387252a790 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/README.md @@ -0,0 +1,201 @@ +# @aws-sdk/aws-protocoltests-json-10 + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-json-10/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json-10) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-json-10.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json-10) + +## Description + +AWS SDK for JavaScript JSONRPC10 Client for Node.js, Browser and React Native. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-json-10 +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-json-10` +- `yarn add @aws-sdk/aws-protocoltests-json-10` +- `pnpm add @aws-sdk/aws-protocoltests-json-10` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `JSONRPC10Client` and +the commands you need, for example `EmptyInputAndEmptyOutputCommand`: + +```js +// ES5 example +const { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); +``` + +```ts +// ES6+ example +import { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new JSONRPC10Client({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new EmptyInputAndEmptyOutputCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-json-10"; +const client = new AWS.JSONRPC10({ region: "REGION" }); + +// async/await. +try { + const data = await client.emptyInputAndEmptyOutput(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .emptyInputAndEmptyOutput(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.emptyInputAndEmptyOutput(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-json-10` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-json-10/jest.config.js b/protocol_tests/aws-protocoltests-json-10/jest.config.js new file mode 100644 index 000000000000..02eed352c6a8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/jest.config.js @@ -0,0 +1,4 @@ +module.exports = { + preset: "ts-jest", + testMatch: ["**/*.spec.ts", "!**/*.browser.spec.ts", "!**/*.integ.spec.ts"], +}; diff --git a/protocol_tests/aws-protocoltests-json-10/package.json b/protocol_tests/aws-protocoltests-json-10/package.json new file mode 100644 index 000000000000..e9e7e651283f --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/package.json @@ -0,0 +1,94 @@ +{ + "name": "@aws-sdk/aws-protocoltests-json-10", + "description": "@aws-sdk/aws-protocoltests-json-10 client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-json-10", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-json-10" + } +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts new file mode 100644 index 000000000000..f391f3a6375d --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts @@ -0,0 +1,331 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommand, + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + GreetingWithErrorsCommand, + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, +} from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { JsonUnionsCommand, JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; +import { + NoInputAndNoOutputCommand, + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, +} from "./commands/NoInputAndNoOutputCommand"; +import { + NoInputAndOutputCommand, + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, +} from "./commands/NoInputAndOutputCommand"; +import { + SimpleScalarPropertiesCommand, + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { JSONRPC10Client } from "./JSONRPC10Client"; + +export class JSONRPC10 extends JSONRPC10Client { + /** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + */ + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), + cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): Promise | void { + const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A ComplexError error. + * + * Implementations must be able to successfully take a response and + * properly deserialize successful and error responses. + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 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. + */ + public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; + public jsonUnions( + args: JsonUnionsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonUnionsCommandOutput) => void + ): void; + public jsonUnions( + args: JsonUnionsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), + cb?: (err: any, data?: JsonUnionsCommandOutput) => void + ): Promise | void { + const command = new JsonUnionsCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + */ + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + */ + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndOutputCommand(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 simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarPropertiesCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts new file mode 100644 index 000000000000..439cac743957 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts @@ -0,0 +1,250 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + 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"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | EmptyInputAndEmptyOutputCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput + | JsonUnionsCommandInput + | NoInputAndNoOutputCommandInput + | NoInputAndOutputCommandInput + | SimpleScalarPropertiesCommandInput; + +export type ServiceOutputTypes = + | EmptyInputAndEmptyOutputCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput + | JsonUnionsCommandOutput + | NoInputAndNoOutputCommandOutput + | NoInputAndOutputCommandOutput + | SimpleScalarPropertiesCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type JSONRPC10ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of JSONRPC10Client class constructor that set the region, credentials and other options. + */ +export interface JSONRPC10ClientConfig extends JSONRPC10ClientConfigType {} + +type JSONRPC10ClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of JSONRPC10Client class. This is resolved and normalized from the {@link JSONRPC10ClientConfig | constructor configuration interface}. + */ +export interface JSONRPC10ClientResolvedConfig extends JSONRPC10ClientResolvedConfigType {} + +export class JSONRPC10Client extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + JSONRPC10ClientResolvedConfig +> { + /** + * The resolved configuration of JSONRPC10Client class. This is resolved and normalized from the {@link JSONRPC10ClientConfig | constructor configuration interface}. + */ + readonly config: JSONRPC10ClientResolvedConfig; + + constructor(configuration: JSONRPC10ClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveUserAgentConfig(_config_4); + super(_config_5); + this.config = _config_5; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts new file mode 100644 index 000000000000..156d28111e97 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts @@ -0,0 +1,98 @@ +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 { EmptyInputAndEmptyOutputInput } from "../models/models_0"; +import { + deserializeAws_json1_0EmptyInputAndEmptyOutputCommand, + serializeAws_json1_0EmptyInputAndEmptyOutputCommand, +} from "../protocols/Aws_json1_0"; + +export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} +export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputInput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const command = new EmptyInputAndEmptyOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. + * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. + * + */ +export class EmptyInputAndEmptyOutputCommand extends $Command< + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { + // 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 = "EmptyInputAndEmptyOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + outputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0EmptyInputAndEmptyOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0EmptyInputAndEmptyOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..8ea0621a0e08 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.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_0EndpointOperationCommand, + serializeAws_json1_0EndpointOperationCommand, +} from "../protocols/Aws_json1_0"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // 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 = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0EndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0EndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..fe7d56364811 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.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 { JSONRPC10ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JSONRPC10Client"; +import { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_json1_0EndpointWithHostLabelOperationCommand, + serializeAws_json1_0EndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_json1_0"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // 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 = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_json1_0EndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_json1_0EndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..faea0676ae2a --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,102 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_json1_0GreetingWithErrorsCommand, + serializeAws_json1_0GreetingWithErrorsCommand, +} from "../protocols/Aws_json1_0"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A ComplexError error. + * + * Implementations must be able to successfully take a response and + * properly deserialize successful and error responses. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // 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 = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0GreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0GreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..9b0f527cacdb --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-json-10/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts new file mode 100644 index 000000000000..69aab9b76c7c --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts @@ -0,0 +1,95 @@ +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 { UnionInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_0JsonUnionsCommand, + serializeAws_json1_0JsonUnionsCommand, +} from "../protocols/Aws_json1_0"; + +export interface JsonUnionsCommandInput extends UnionInputOutput {} +export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} + +/** + * This operation uses unions for inputs and outputs. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const command = new JsonUnionsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonUnionsCommandInput} for command's `input` shape. + * @see {@link JsonUnionsCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonUnionsCommand extends $Command< + JsonUnionsCommandInput, + JsonUnionsCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonUnionsCommandInput) { + // 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 = "JsonUnionsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0JsonUnionsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0JsonUnionsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts new file mode 100644 index 000000000000..076599e0dc95 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts @@ -0,0 +1,96 @@ +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_0NoInputAndNoOutputCommand, + serializeAws_json1_0NoInputAndNoOutputCommand, +} from "../protocols/Aws_json1_0"; + +export interface NoInputAndNoOutputCommandInput {} +export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const command = new NoInputAndNoOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndNoOutputCommand extends $Command< + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndNoOutputCommandInput) { + // 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 = "NoInputAndNoOutputCommand"; + 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0NoInputAndNoOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0NoInputAndNoOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts new file mode 100644 index 000000000000..6ffef247a863 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts @@ -0,0 +1,98 @@ +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 { NoInputAndOutputOutput } from "../models/models_0"; +import { + deserializeAws_json1_0NoInputAndOutputCommand, + serializeAws_json1_0NoInputAndOutputCommand, +} from "../protocols/Aws_json1_0"; + +export interface NoInputAndOutputCommandInput {} +export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const command = new NoInputAndOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndOutputCommand extends $Command< + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndOutputCommandInput) { + // 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 = "NoInputAndOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0NoInputAndOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0NoInputAndOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts new file mode 100644 index 000000000000..f38a7bb73982 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.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 { JSONRPC10ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JSONRPC10Client"; +import { SimpleScalarPropertiesInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_0SimpleScalarPropertiesCommand, + serializeAws_json1_0SimpleScalarPropertiesCommand, +} from "../protocols/Aws_json1_0"; + +export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} +export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} + +export class SimpleScalarPropertiesCommand extends $Command< + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, + JSONRPC10ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarPropertiesCommandInput) { + // 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 = "SimpleScalarPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_0SimpleScalarPropertiesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_0SimpleScalarPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts new file mode 100644 index 000000000000..324ce1f9916e --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts @@ -0,0 +1,9 @@ +export * from "./EmptyInputAndEmptyOutputCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HostWithPathOperationCommand"; +export * from "./JsonUnionsCommand"; +export * from "./NoInputAndNoOutputCommand"; +export * from "./NoInputAndOutputCommand"; +export * from "./SimpleScalarPropertiesCommand"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts b/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts new file mode 100644 index 000000000000..113b0b9ec77f --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "jsonrpc10.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "jsonrpc10.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "jsonrpc10.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "jsonrpc10.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "jsonrpc10.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "jsonrpc10", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-json-10/src/index.ts b/protocol_tests/aws-protocoltests-json-10/src/index.ts new file mode 100644 index 000000000000..2c7186bc1e30 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/index.ts @@ -0,0 +1,4 @@ +export * from "./JSONRPC10"; +export * from "./JSONRPC10Client"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/models/index.ts b/protocol_tests/aws-protocoltests-json-10/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts b/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts new file mode 100644 index 000000000000..263491bd4a9d --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts @@ -0,0 +1,362 @@ +import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +/** + * This error has test cases that test some of the dark corners of Amazon service + * framework history. It should only be implemented by clients. + */ +export interface FooError extends __SmithyException, $MetadataBearer { + name: "FooError"; + $fault: "server"; +} + +export namespace FooError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FooError): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +/** + * A union with a representative set of types for members. + */ +export type MyUnion = + | MyUnion.BlobValueMember + | MyUnion.BooleanValueMember + | MyUnion.EnumValueMember + | MyUnion.ListValueMember + | MyUnion.MapValueMember + | MyUnion.NumberValueMember + | MyUnion.StringValueMember + | MyUnion.StructureValueMember + | MyUnion.TimestampValueMember + | MyUnion.$UnknownMember; + +export namespace MyUnion { + export interface StringValueMember { + stringValue: string; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface BooleanValueMember { + stringValue?: never; + booleanValue: boolean; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface NumberValueMember { + stringValue?: never; + booleanValue?: never; + numberValue: number; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface BlobValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue: Uint8Array; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface TimestampValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue: Date; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface EnumValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue: FooEnum | string; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface ListValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue: string[]; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface MapValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue: { [key: string]: string }; + structureValue?: never; + $unknown?: never; + } + + export interface StructureValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue: GreetingStruct; + $unknown?: never; + } + + export interface $UnknownMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown: [string, any]; + } + + export interface Visitor { + stringValue: (value: string) => T; + booleanValue: (value: boolean) => T; + numberValue: (value: number) => T; + blobValue: (value: Uint8Array) => T; + timestampValue: (value: Date) => T; + enumValue: (value: FooEnum | string) => T; + listValue: (value: string[]) => T; + mapValue: (value: { [key: string]: string }) => T; + structureValue: (value: GreetingStruct) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: MyUnion, visitor: Visitor): T => { + if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); + if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); + if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); + if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); + if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); + if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); + if (value.listValue !== undefined) return visitor.listValue(value.listValue); + if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); + if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: MyUnion): any => { + if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; + if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; + if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; + if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; + if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; + if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; + if (obj.listValue !== undefined) return { listValue: obj.listValue }; + if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; + if (obj.structureValue !== undefined) + return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; +} + +/** + * A shared structure that contains a single union member. + */ +export interface UnionInputOutput { + /** + * A union with a representative set of types for members. + */ + contents?: MyUnion; +} + +export namespace UnionInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ + ...obj, + ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), + }); +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarPropertiesInputOutput { + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarPropertiesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts b/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts new file mode 100644 index 000000000000..07e9cd3c78cc --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts @@ -0,0 +1,959 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + expectBoolean as __expectBoolean, + expectInt32 as __expectInt32, + expectNonNull as __expectNonNull, + expectNumber as __expectNumber, + expectString as __expectString, + expectUnion as __expectUnion, + limitedParseDouble as __limitedParseDouble, + limitedParseFloat32 as __limitedParseFloat32, + parseEpochTimestamp as __parseEpochTimestamp, + serializeFloat as __serializeFloat, +} from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + HeaderBag as __HeaderBag, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "../commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + 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"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "../commands/SimpleScalarPropertiesCommand"; +import { + ComplexError, + ComplexNestedErrorData, + EmptyInputAndEmptyOutputInput, + FooError, + GreetingStruct, + GreetingWithErrorsOutput, + HostLabelInput, + InvalidGreeting, + MyUnion, + NoInputAndOutputOutput, + SimpleScalarPropertiesInputOutput, + UnionInputOutput, +} from "../models/models_0"; + +export const serializeAws_json1_0EmptyInputAndEmptyOutputCommand = async ( + input: EmptyInputAndEmptyOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.EmptyInputAndEmptyOutput", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_0EmptyInputAndEmptyOutputInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_0EndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.EndpointOperation", + }; + const body = "{}"; + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_json1_0EndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.EndpointWithHostLabelOperation", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_0HostLabelInput(input, context)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_json1_0GreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.GreetingWithErrors", + }; + const body = "{}"; + 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 +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.JsonUnions", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_0UnionInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_0NoInputAndNoOutputCommand = async ( + input: NoInputAndNoOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.NoInputAndNoOutput", + }; + const body = "{}"; + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_0NoInputAndOutputCommand = async ( + input: NoInputAndOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.NoInputAndOutput", + }; + const body = "{}"; + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_0SimpleScalarPropertiesCommand = async ( + input: SimpleScalarPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": "JsonRpc10.SimpleScalarProperties", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_0SimpleScalarPropertiesInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const deserializeAws_json1_0EmptyInputAndEmptyOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0EmptyInputAndEmptyOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_0EmptyInputAndEmptyOutputInput(data, context); + const response: EmptyInputAndEmptyOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0EmptyInputAndEmptyOutputCommandError = 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_0EndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0EndpointOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0EndpointOperationCommandError = 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_0EndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0EndpointWithHostLabelOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0EndpointWithHostLabelOperationCommandError = 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_0GreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0GreetingWithErrorsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_0GreetingWithErrorsOutput(data, context); + const response: GreetingWithErrorsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0GreetingWithErrorsCommandError = 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.json10#ComplexError": + response = { + ...(await deserializeAws_json1_0ComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "FooError": + case "aws.protocoltests.json10#FooError": + response = { + ...(await deserializeAws_json1_0FooErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.json10#InvalidGreeting": + response = { + ...(await deserializeAws_json1_0InvalidGreetingResponse(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_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 +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0JsonUnionsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_0UnionInputOutput(data, context); + const response: JsonUnionsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0JsonUnionsCommandError = 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_0NoInputAndNoOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0NoInputAndNoOutputCommandError(output, context); + } + await collectBody(output.body, context); + const response: NoInputAndNoOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0NoInputAndNoOutputCommandError = 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_0NoInputAndOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0NoInputAndOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_0NoInputAndOutputOutput(data, context); + const response: NoInputAndOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0NoInputAndOutputCommandError = 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_0SimpleScalarPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_0SimpleScalarPropertiesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_0SimpleScalarPropertiesInputOutput(data, context); + const response: SimpleScalarPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_0SimpleScalarPropertiesCommandError = 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)); +}; + +const deserializeAws_json1_0ComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_0ComplexError(body, context); + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_0FooErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_0FooError(body, context); + const contents: FooError = { + name: "FooError", + $fault: "server", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_0InvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_0InvalidGreeting(body, context); + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const serializeAws_json1_0EmptyInputAndEmptyOutputInput = ( + input: EmptyInputAndEmptyOutputInput, + context: __SerdeContext +): any => { + return {}; +}; + +const serializeAws_json1_0HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { + return { + ...(input.label !== undefined && input.label !== null && { label: input.label }), + }; +}; + +const serializeAws_json1_0MyUnion = (input: MyUnion, context: __SerdeContext): any => { + return MyUnion.visit(input, { + blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), + booleanValue: (value) => ({ booleanValue: value }), + enumValue: (value) => ({ enumValue: value }), + listValue: (value) => ({ listValue: serializeAws_json1_0StringList(value, context) }), + mapValue: (value) => ({ mapValue: serializeAws_json1_0StringMap(value, context) }), + numberValue: (value) => ({ numberValue: value }), + stringValue: (value) => ({ stringValue: value }), + structureValue: (value) => ({ structureValue: serializeAws_json1_0GreetingStruct(value, context) }), + timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), + _: (name, value) => ({ name: value } as any), + }); +}; + +const serializeAws_json1_0SimpleScalarPropertiesInputOutput = ( + input: SimpleScalarPropertiesInputOutput, + context: __SerdeContext +): any => { + return { + ...(input.doubleValue !== undefined && + input.doubleValue !== null && { doubleValue: __serializeFloat(input.doubleValue) }), + ...(input.floatValue !== undefined && + input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), + }; +}; + +const serializeAws_json1_0UnionInputOutput = (input: UnionInputOutput, context: __SerdeContext): any => { + return { + ...(input.contents !== undefined && + input.contents !== null && { contents: serializeAws_json1_0MyUnion(input.contents, context) }), + }; +}; + +const serializeAws_json1_0GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + return { + ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), + }; +}; + +const serializeAws_json1_0StringList = (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_json1_0StringMap = (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 deserializeAws_json1_0ComplexError = (output: any, context: __SerdeContext): ComplexError => { + return { + Nested: + output.Nested !== undefined && output.Nested !== null + ? deserializeAws_json1_0ComplexNestedErrorData(output.Nested, context) + : undefined, + TopLevel: __expectString(output.TopLevel), + } as any; +}; + +const deserializeAws_json1_0ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { + return { + Foo: __expectString(output.Fooooo), + } as any; +}; + +const deserializeAws_json1_0EmptyInputAndEmptyOutputInput = ( + output: any, + context: __SerdeContext +): EmptyInputAndEmptyOutputInput => { + return {} as any; +}; + +const deserializeAws_json1_0FooError = (output: any, context: __SerdeContext): FooError => { + return {} as any; +}; + +const deserializeAws_json1_0GreetingWithErrorsOutput = ( + output: any, + context: __SerdeContext +): GreetingWithErrorsOutput => { + return { + greeting: __expectString(output.greeting), + } as any; +}; + +const deserializeAws_json1_0InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { + return { + Message: __expectString(output.Message), + } as any; +}; + +const deserializeAws_json1_0MyUnion = (output: any, context: __SerdeContext): MyUnion => { + if (output.blobValue !== undefined && output.blobValue !== null) { + return { + blobValue: context.base64Decoder(output.blobValue), + }; + } + if (__expectBoolean(output.booleanValue) !== undefined) { + return { booleanValue: __expectBoolean(output.booleanValue) as any }; + } + if (__expectString(output.enumValue) !== undefined) { + return { enumValue: __expectString(output.enumValue) as any }; + } + if (output.listValue !== undefined && output.listValue !== null) { + return { + listValue: deserializeAws_json1_0StringList(output.listValue, context), + }; + } + if (output.mapValue !== undefined && output.mapValue !== null) { + return { + mapValue: deserializeAws_json1_0StringMap(output.mapValue, context), + }; + } + if (__expectInt32(output.numberValue) !== undefined) { + return { numberValue: __expectInt32(output.numberValue) as any }; + } + if (__expectString(output.stringValue) !== undefined) { + return { stringValue: __expectString(output.stringValue) as any }; + } + if (output.structureValue !== undefined && output.structureValue !== null) { + return { + structureValue: deserializeAws_json1_0GreetingStruct(output.structureValue, context), + }; + } + if (output.timestampValue !== undefined && output.timestampValue !== null) { + return { + timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), + }; + } + return { $unknown: Object.entries(output)[0] }; +}; + +const deserializeAws_json1_0NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInputAndOutputOutput => { + return {} as any; +}; + +const deserializeAws_json1_0SimpleScalarPropertiesInputOutput = ( + output: any, + context: __SerdeContext +): SimpleScalarPropertiesInputOutput => { + return { + doubleValue: __limitedParseDouble(output.doubleValue), + floatValue: __limitedParseFloat32(output.floatValue), + } as any; +}; + +const deserializeAws_json1_0UnionInputOutput = (output: any, context: __SerdeContext): UnionInputOutput => { + return { + contents: + output.contents !== undefined && output.contents !== null + ? deserializeAws_json1_0MyUnion(__expectUnion(output.contents), context) + : undefined, + } as any; +}; + +const deserializeAws_json1_0GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { + return { + hi: __expectString(output.hi), + } as any; +}; + +const deserializeAws_json1_0StringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_json1_0StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const buildHttpRpcRequest = async ( + context: __SerdeContext, + headers: __HeaderBag, + path: string, + resolvedHostname: string | undefined, + body: any +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents: any = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers, + }; + if (resolvedHostname !== undefined) { + contents.hostname = resolvedHostname; + } + if (body !== undefined) { + contents.body = body; + } + return new __HttpRequest(contents); +}; + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + return JSON.parse(encoded); + } + return {}; + }); + +/** + * Load an error code for the aws.rest-json-1.1 protocol. + */ +const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { + const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + + const sanitizeErrorCode = (rawValue: string): string => { + let cleanValue = rawValue; + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== undefined) { + return sanitizeErrorCode(output.headers[headerKey]); + } + + if (data.code !== undefined) { + return sanitizeErrorCode(data.code); + } + + if (data["__type"] !== undefined) { + return sanitizeErrorCode(data["__type"]); + } + + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..df129702b088 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts @@ -0,0 +1,37 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..a05e1a499cea --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..5b41a4cc375c --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { defaultRegionInfoProvider } from "./endpoints"; +import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => ({ + apiVersion: "2020-07-14", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "JSON RPC 10", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts new file mode 100644 index 000000000000..15c436103384 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts @@ -0,0 +1,40 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts b/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts new file mode 100644 index 000000000000..e30cc0e3d46c --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts @@ -0,0 +1,2058 @@ +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"; + +import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; +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"; +import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; +import { JSONRPC10Client } from "../../src/JSONRPC10Client"; +import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Clients must always send an empty object if input is modeled. + */ +it("AwsJson10EmptyInputAndEmptyOutput:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyInputAndEmptyOutputCommand({} as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.EmptyInputAndEmptyOutput"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * A service will always return a JSON object for operations with modeled output. + */ +it("AwsJson10EmptyInputAndEmptyOutputSendJsonObject:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("AwsJson10EndpointTrait:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("AwsJson10EndpointTraitWithHostLabel:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"label\": \"bar\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Parses simple JSON errors + */ +it("AwsJson10InvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "aws.protocoltests.json10#InvalidGreeting", + "Message": "Hi" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. + */ +it("AwsJson10FooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' + * is to be interpreted as 'ValidationException'. + * + * For an example service see Amazon Polly. + */ +it("AwsJson10FooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. + */ +it("AwsJson10FooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": + "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. + * + * For example service see Amazon S3 Glacier. + */ +it("AwsJson10FooErrorUsingCode:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "code": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("AwsJson10FooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "code": "aws.protocoltests.json10#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("AwsJson10FooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "code": "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type. + */ +it("AwsJson10FooErrorWithDunderType:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("AwsJson10FooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "aws.protocoltests.json10#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("AwsJson10FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Parses a complex error with no message member + */ +it("AwsJson10ComplexError:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "aws.protocoltests.json10#ComplexError", + "TopLevel": "Top level", + "Nested": { + "Fooooo": "bar" + } + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Parses a complex error with an empty body + */ +it("AwsJson10EmptyComplexError:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "__type": "aws.protocoltests.json10#ComplexError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + return; + } + 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 + */ +it("AwsJson10SerializeStringUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + stringValue: "foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"stringValue\": \"foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a boolean union value + */ +it("AwsJson10SerializeBooleanUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + booleanValue: true, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"booleanValue\": true + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a number union value + */ +it("AwsJson10SerializeNumberUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + numberValue: 1, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"numberValue\": 1 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob union value + */ +it("AwsJson10SerializeBlobUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"blobValue\": \"Zm9v\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a timestamp union value + */ +it("AwsJson10SerializeTimestampUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + timestampValue: new Date(1398796238000), + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"timestampValue\": 1398796238 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an enum union value + */ +it("AwsJson10SerializeEnumUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + enumValue: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"enumValue\": \"Foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a list union value + */ +it("AwsJson10SerializeListUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + listValue: ["foo", "bar"], + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"listValue\": [\"foo\", \"bar\"] + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a map union value + */ +it("AwsJson10SerializeMapUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"mapValue\": { + \"foo\": \"bar\", + \"spam\": \"eggs\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure union value + */ +it("AwsJson10SerializeStructureUnionValue:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + structureValue: { + hi: "hello", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"structureValue\": { + \"hi\": \"hello\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes a string union value + */ +it("AwsJson10DeserializeStringUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "stringValue": "foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + stringValue: "foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a boolean union value + */ +it("AwsJson10DeserializeBooleanUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "booleanValue": true + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + booleanValue: true, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a number union value + */ +it("AwsJson10DeserializeNumberUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "numberValue": 1 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + numberValue: 1, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a blob union value + */ +it("AwsJson10DeserializeBlobUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "blobValue": "Zm9v" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a timestamp union value + */ +it("AwsJson10DeserializeTimestampUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "timestampValue": 1398796238 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + timestampValue: new Date(1398796238000), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes an enum union value + */ +it("AwsJson10DeserializeEnumUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "enumValue": "Foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + enumValue: "Foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a list union value + */ +it("AwsJson10DeserializeListUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "listValue": ["foo", "bar"] + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + listValue: ["foo", "bar"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a map union value + */ +it("AwsJson10DeserializeMapUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "mapValue": { + "foo": "bar", + "spam": "eggs" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a structure union value + */ +it("AwsJson10DeserializeStructureUnionValue:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "contents": { + "structureValue": { + "hi": "hello" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + structureValue: { + hi: "hello", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Clients must always send an empty JSON object payload for + * operations with no input (that is, `{}`). While AWS service + * implementations support requests with no payload or requests + * that send `{}`, always sending `{}` from the client is + * preferred for forward compatibility in case input is ever + * added to an operation. + */ +it("AwsJson10MustAlwaysSendEmptyJsonPayload:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndNoOutputCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.NoInputAndNoOutput"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * When no output is defined, the service is expected to return + * an empty payload, however, client must ignore a JSON payload + * if one is returned. This ensures that if output is added later, + * then it will not break the client. + */ +it("AwsJson10HandlesEmptyOutputShape:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * This client-only test builds on handles_empty_output_shape, + * by including unexpected fields in the JSON. A client + * needs to ignore JSON output that is empty or that contains + * JSON object data. + */ +it("AwsJson10HandlesUnexpectedJsonOutput:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "foo": true + }` + ), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * When no output is defined, the service is expected to return + * an empty payload. Despite the lack of a payload, the service + * is expected to always send a Content-Type header. Clients must + * handle cases where a service returns a JSON object and where + * a service returns no JSON at all. + */ +it("AwsJson10ServiceRespondsWithNoPayload:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `` + ), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * A client should always send and empty JSON object payload. + */ +it("AwsJson10NoInputAndOutput:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndOutputCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.NoInputAndOutput"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output always serializes an empty object payload. + */ +it("AwsJson10NoInputAndOutput:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Supports handling NaN float values. + */ +it("AwsJson10SupportsNaNFloatInputs:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: NaN, + + doubleValue: NaN, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"NaN\", + \"doubleValue\": \"NaN\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsJson10SupportsInfinityFloatInputs:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: Infinity, + + doubleValue: Infinity, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"Infinity\", + \"doubleValue\": \"Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsJson10SupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: -Infinity, + + doubleValue: -Infinity, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"-Infinity\", + \"doubleValue\": \"-Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("AwsJson10SupportsNaNFloatInputs:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "floatValue": "NaN", + "doubleValue": "NaN" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsJson10SupportsInfinityFloatInputs:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "floatValue": "Infinity", + "doubleValue": "Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsJson10SupportsNegativeInfinityFloatInputs:Response", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.0", + }, + `{ + "floatValue": "-Infinity", + "doubleValue": "-Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { + const expectedParts = JSON.parse(expectedBody); + const generatedParts = JSON.parse(generatedBody); + + 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-protocoltests-json-10/tsconfig.es.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-json-10/tsconfig.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-json/.gitignore b/protocol_tests/aws-protocoltests-json/.gitignore new file mode 100644 index 000000000000..bff6121c007d --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-json/CHANGELOG.md b/protocol_tests/aws-protocoltests-json/CHANGELOG.md new file mode 100644 index 000000000000..066813739d08 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/CHANGELOG.md @@ -0,0 +1,764 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +## [3.36.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.0...v3.36.1) (2021-10-12) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + + +### Features + +* **codegen:** assert sets have no duplicates ([#2764](https://github.com/aws/aws-sdk-js-v3/issues/2764)) ([aa62fc3](https://github.com/aws/aws-sdk-js-v3/commit/aa62fc3eda48e9a57753cea6fc5896b65f2dbe3b)) + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + +### Features + +* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) + + + + + +# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) + + +### Features + +* support Sigv4 for non AWS services ([#2385](https://github.com/aws/aws-sdk-js-v3/issues/2385)) ([0a251aa](https://github.com/aws/aws-sdk-js-v3/commit/0a251aa44d54fbf21e328ccf2b20db45e94aaa90)), closes [/github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/main.smithy#L11-L13](https://github.com//github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/main.smithy/issues/L11-L13) +* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) + + + + + +# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) + + +### Features + +* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) + + + + + +# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) + + +### Bug Fixes + +* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) + + + + + +# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) + + +### Bug Fixes + +* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) + + +### Features + +* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) + + + + + +## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) + + +### Features + +* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) + + + + + +# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) + + +### Bug Fixes + +* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) + + +### Features + +* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) + + + + + +# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) + + +### Features + +* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) + + + + + +# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) + + +### Bug Fixes + +* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) + + + + + +# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) + + +### Bug Fixes + +* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) + + + + + +# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) + + +### Bug Fixes + +* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) + + + + + +# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) + + +### Features + +* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) +* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) + + + + + +# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) + + +### Bug Fixes + +* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) +* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) +* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) + + +### Features + +* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) + + + + + +# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) + + +### Bug Fixes + +* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) + + + + + +# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) + + +### Bug Fixes + +* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) +* **clients:** use signing name from auth sigv4 trait ([#1835](https://github.com/aws/aws-sdk-js-v3/issues/1835)) ([e539302](https://github.com/aws/aws-sdk-js-v3/commit/e539302f69e55eb46ffd751125fe06d49c21d1c5)) +* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) +* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) +* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) + + +### Features + +* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) + + + + + +# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) + + +### Features + +* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) + + + + + +# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) + + +### Bug Fixes + +* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) + + +### Features + +* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) + + + + + +# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) + + +### Features + +* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) + + + + + +# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) + + +### Bug Fixes + +* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) + + + + + +# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) + + +### Features + +* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) + + + + + +# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) + + +### Bug Fixes + +* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) + + + + + +# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) + + +### Features + +* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) + + + + + +# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.9...@aws-sdk/aws-json@1.0.0-gamma.10) (2020-10-07) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.8...@aws-sdk/aws-json@1.0.0-gamma.9) (2020-09-29) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.7...@aws-sdk/aws-json@1.0.0-gamma.8) (2020-09-15) + + +### Bug Fixes + +* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) +* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) + + + + + +# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.6...@aws-sdk/aws-json@1.0.0-gamma.7) (2020-09-01) + + +### Features + +* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) + + + + + +# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.5...@aws-sdk/aws-json@1.0.0-gamma.6) (2020-08-25) + + +### Features + +* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) +* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) +* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) + + + + + +# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.4...@aws-sdk/aws-json@1.0.0-gamma.5) (2020-08-04) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.3...@aws-sdk/aws-json@1.0.0-gamma.4) (2020-07-21) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.2...@aws-sdk/aws-json@1.0.0-gamma.3) (2020-07-13) + +**Note:** Version bump only for package @aws-sdk/aws-json + + + + + +# 1.0.0-gamma.2 (2020-07-08) + + +### Features + +* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) + + + +# 1.0.0-gamma.2 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.1 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.0 (2020-05-21) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-beta.0 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-json/LICENSE b/protocol_tests/aws-protocoltests-json/LICENSE new file mode 100644 index 000000000000..dd65ae06be7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-json/README.md b/protocol_tests/aws-protocoltests-json/README.md new file mode 100644 index 000000000000..439b9b21e9d4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/README.md @@ -0,0 +1,201 @@ +# @aws-sdk/aws-protocoltests-json + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-json/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-json.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json) + +## Description + +AWS SDK for JavaScript JsonProtocol Client for Node.js, Browser and React Native. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-json +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-json` +- `yarn add @aws-sdk/aws-protocoltests-json` +- `pnpm add @aws-sdk/aws-protocoltests-json` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `JsonProtocolClient` and +the commands you need, for example `EmptyOperationCommand`: + +```js +// ES5 example +const { JsonProtocolClient, EmptyOperationCommand } = require("@aws-sdk/aws-protocoltests-json"); +``` + +```ts +// ES6+ example +import { JsonProtocolClient, EmptyOperationCommand } from "@aws-sdk/aws-protocoltests-json"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new JsonProtocolClient({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new EmptyOperationCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-json"; +const client = new AWS.JsonProtocol({ region: "REGION" }); + +// async/await. +try { + const data = await client.emptyOperation(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .emptyOperation(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.emptyOperation(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-json` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-json/package.json b/protocol_tests/aws-protocoltests-json/package.json new file mode 100644 index 000000000000..67d4484047e6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/package.json @@ -0,0 +1,97 @@ +{ + "name": "@aws-sdk/aws-protocoltests-json", + "description": "@aws-sdk/aws-protocoltests-json client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/client-sts": "3.38.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/credential-provider-node": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-signing": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-json", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-json" + } +} diff --git a/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts b/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts new file mode 100644 index 000000000000..3cdf050776b4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts @@ -0,0 +1,412 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + EmptyOperationCommand, + EmptyOperationCommandInput, + EmptyOperationCommandOutput, +} from "./commands/EmptyOperationCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + GreetingWithErrorsCommand, + 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 { + KitchenSinkOperationCommand, + KitchenSinkOperationCommandInput, + KitchenSinkOperationCommandOutput, +} from "./commands/KitchenSinkOperationCommand"; +import { + NullOperationCommand, + NullOperationCommandInput, + NullOperationCommandOutput, +} from "./commands/NullOperationCommand"; +import { + OperationWithOptionalInputOutputCommand, + OperationWithOptionalInputOutputCommandInput, + OperationWithOptionalInputOutputCommandOutput, +} from "./commands/OperationWithOptionalInputOutputCommand"; +import { + PutAndGetInlineDocumentsCommand, + PutAndGetInlineDocumentsCommandInput, + PutAndGetInlineDocumentsCommandOutput, +} from "./commands/PutAndGetInlineDocumentsCommand"; +import { + SimpleScalarPropertiesCommand, + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { JsonProtocolClient } from "./JsonProtocolClient"; + +export class JsonProtocol extends JsonProtocolClient { + public emptyOperation( + args: EmptyOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyOperation( + args: EmptyOperationCommandInput, + cb: (err: any, data?: EmptyOperationCommandOutput) => void + ): void; + public emptyOperation( + args: EmptyOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyOperationCommandOutput) => void + ): void; + public emptyOperation( + args: EmptyOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyOperationCommandOutput) => void), + cb?: (err: any, data?: EmptyOperationCommandOutput) => void + ): Promise | void { + const command = new EmptyOperationCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A ComplexError error. + * + * Implementations must be able to successfully take a response and + * properly deserialize successful and error responses. + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 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. + */ + public jsonEnums(args: JsonEnumsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonEnums(args: JsonEnumsCommandInput, cb: (err: any, data?: JsonEnumsCommandOutput) => void): void; + public jsonEnums( + args: JsonEnumsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonEnumsCommandOutput) => void + ): void; + public jsonEnums( + args: JsonEnumsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonEnumsCommandOutput) => void), + cb?: (err: any, data?: JsonEnumsCommandOutput) => void + ): Promise | void { + const command = new JsonEnumsCommand(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. + */ + public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; + public jsonUnions( + args: JsonUnionsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonUnionsCommandOutput) => void + ): void; + public jsonUnions( + args: JsonUnionsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), + cb?: (err: any, data?: JsonUnionsCommandOutput) => void + ): Promise | void { + const command = new JsonUnionsCommand(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 kitchenSinkOperation( + args: KitchenSinkOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public kitchenSinkOperation( + args: KitchenSinkOperationCommandInput, + cb: (err: any, data?: KitchenSinkOperationCommandOutput) => void + ): void; + public kitchenSinkOperation( + args: KitchenSinkOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: KitchenSinkOperationCommandOutput) => void + ): void; + public kitchenSinkOperation( + args: KitchenSinkOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: KitchenSinkOperationCommandOutput) => void), + cb?: (err: any, data?: KitchenSinkOperationCommandOutput) => void + ): Promise | void { + const command = new KitchenSinkOperationCommand(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 nullOperation( + args: NullOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nullOperation( + args: NullOperationCommandInput, + cb: (err: any, data?: NullOperationCommandOutput) => void + ): void; + public nullOperation( + args: NullOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NullOperationCommandOutput) => void + ): void; + public nullOperation( + args: NullOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullOperationCommandOutput) => void), + cb?: (err: any, data?: NullOperationCommandOutput) => void + ): Promise | void { + const command = new NullOperationCommand(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 operationWithOptionalInputOutput( + args: OperationWithOptionalInputOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public operationWithOptionalInputOutput( + args: OperationWithOptionalInputOutputCommandInput, + cb: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void + ): void; + public operationWithOptionalInputOutput( + args: OperationWithOptionalInputOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void + ): void; + public operationWithOptionalInputOutput( + args: OperationWithOptionalInputOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void), + cb?: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void + ): Promise | void { + const command = new OperationWithOptionalInputOutputCommand(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 an inline document as part of the payload. + */ + public putAndGetInlineDocuments( + args: PutAndGetInlineDocumentsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public putAndGetInlineDocuments( + args: PutAndGetInlineDocumentsCommandInput, + cb: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void + ): void; + public putAndGetInlineDocuments( + args: PutAndGetInlineDocumentsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void + ): void; + public putAndGetInlineDocuments( + args: PutAndGetInlineDocumentsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void), + cb?: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void + ): Promise | void { + const command = new PutAndGetInlineDocumentsCommand(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 simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarPropertiesCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts b/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts new file mode 100644 index 000000000000..373b4829272a --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts @@ -0,0 +1,287 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + AwsAuthInputConfig, + AwsAuthResolvedConfig, + getAwsAuthPlugin, + resolveAwsAuthConfig, +} from "@aws-sdk/middleware-signing"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Credentials as __Credentials, + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "./commands/EmptyOperationCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + 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 { + KitchenSinkOperationCommandInput, + KitchenSinkOperationCommandOutput, +} from "./commands/KitchenSinkOperationCommand"; +import { NullOperationCommandInput, NullOperationCommandOutput } from "./commands/NullOperationCommand"; +import { + OperationWithOptionalInputOutputCommandInput, + OperationWithOptionalInputOutputCommandOutput, +} from "./commands/OperationWithOptionalInputOutputCommand"; +import { + PutAndGetInlineDocumentsCommandInput, + PutAndGetInlineDocumentsCommandOutput, +} from "./commands/PutAndGetInlineDocumentsCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | EmptyOperationCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput + | JsonEnumsCommandInput + | JsonUnionsCommandInput + | KitchenSinkOperationCommandInput + | NullOperationCommandInput + | OperationWithOptionalInputOutputCommandInput + | PutAndGetInlineDocumentsCommandInput + | SimpleScalarPropertiesCommandInput; + +export type ServiceOutputTypes = + | EmptyOperationCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput + | JsonEnumsCommandOutput + | JsonUnionsCommandOutput + | KitchenSinkOperationCommandOutput + | NullOperationCommandOutput + | OperationWithOptionalInputOutputCommandOutput + | PutAndGetInlineDocumentsCommandOutput + | SimpleScalarPropertiesCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * The AWS region to which this client will send requests + */ + region?: string | __Provider; + + /** + * Default credentials provider; Not available in browser runtime. + * @internal + */ + credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type JsonProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + AwsAuthInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of JsonProtocolClient class constructor that set the region, credentials and other options. + */ +export interface JsonProtocolClientConfig extends JsonProtocolClientConfigType {} + +type JsonProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + AwsAuthResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of JsonProtocolClient class. This is resolved and normalized from the {@link JsonProtocolClientConfig | constructor configuration interface}. + */ +export interface JsonProtocolClientResolvedConfig extends JsonProtocolClientResolvedConfigType {} + +export class JsonProtocolClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + JsonProtocolClientResolvedConfig +> { + /** + * The resolved configuration of JsonProtocolClient class. This is resolved and normalized from the {@link JsonProtocolClientConfig | constructor configuration interface}. + */ + readonly config: JsonProtocolClientResolvedConfig; + + constructor(configuration: JsonProtocolClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveAwsAuthConfig(_config_4); + const _config_6 = resolveUserAgentConfig(_config_5); + super(_config_6); + this.config = _config_6; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getAwsAuthPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts new file mode 100644 index 000000000000..daeaed0d8ab2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.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_1EmptyOperationCommand, + serializeAws_json1_1EmptyOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface EmptyOperationCommandInput {} +export interface EmptyOperationCommandOutput extends __MetadataBearer {} + +export class EmptyOperationCommand extends $Command< + EmptyOperationCommandInput, + EmptyOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyOperationCommandInput) { + // 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 = "EmptyOperationCommand"; + 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: EmptyOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1EmptyOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1EmptyOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..f142667f20d7 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.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_1EndpointOperationCommand, + serializeAws_json1_1EndpointOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // 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 = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1EndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1EndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..9e9517480853 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.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 { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_json1_1EndpointWithHostLabelOperationCommand, + serializeAws_json1_1EndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // 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 = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_json1_1EndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_json1_1EndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..91b5a143b839 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,102 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_json1_1GreetingWithErrorsCommand, + serializeAws_json1_1GreetingWithErrorsCommand, +} from "../protocols/Aws_json1_1"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A ComplexError error. + * + * Implementations must be able to successfully take a response and + * properly deserialize successful and error responses. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JsonProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import + * // const { JsonProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import + * const client = new JsonProtocolClient(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // 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 = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1GreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1GreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..6851697eb662 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-json/src/commands/JsonEnumsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts new file mode 100644 index 000000000000..0401450a2707 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts @@ -0,0 +1,92 @@ +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 { JsonEnumsInputOutput } from "../models/models_0"; +import { deserializeAws_json1_1JsonEnumsCommand, serializeAws_json1_1JsonEnumsCommand } from "../protocols/Aws_json1_1"; + +export interface JsonEnumsCommandInput extends JsonEnumsInputOutput {} +export interface JsonEnumsCommandOutput extends JsonEnumsInputOutput, __MetadataBearer {} + +/** + * This example serializes enums as top level properties, in lists, sets, and maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JsonProtocolClient, JsonEnumsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import + * // const { JsonProtocolClient, JsonEnumsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import + * const client = new JsonProtocolClient(config); + * const command = new JsonEnumsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonEnumsCommandInput} for command's `input` shape. + * @see {@link JsonEnumsCommandOutput} for command's `response` shape. + * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonEnumsCommand extends $Command< + JsonEnumsCommandInput, + JsonEnumsCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonEnumsCommandInput) { + // 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 = "JsonEnumsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1JsonEnumsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1JsonEnumsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts new file mode 100644 index 000000000000..d2d66a33a896 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts @@ -0,0 +1,95 @@ +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 { UnionInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_1JsonUnionsCommand, + serializeAws_json1_1JsonUnionsCommand, +} from "../protocols/Aws_json1_1"; + +export interface JsonUnionsCommandInput extends UnionInputOutput {} +export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} + +/** + * This operation uses unions for inputs and outputs. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JsonProtocolClient, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import + * // const { JsonProtocolClient, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import + * const client = new JsonProtocolClient(config); + * const command = new JsonUnionsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonUnionsCommandInput} for command's `input` shape. + * @see {@link JsonUnionsCommandOutput} for command's `response` shape. + * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonUnionsCommand extends $Command< + JsonUnionsCommandInput, + JsonUnionsCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonUnionsCommandInput) { + // 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 = "JsonUnionsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1JsonUnionsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1JsonUnionsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts new file mode 100644 index 000000000000..622fd79ce66d --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.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 { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { KitchenSink } from "../models/models_0"; +import { + deserializeAws_json1_1KitchenSinkOperationCommand, + serializeAws_json1_1KitchenSinkOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface KitchenSinkOperationCommandInput extends KitchenSink {} +export interface KitchenSinkOperationCommandOutput extends KitchenSink, __MetadataBearer {} + +export class KitchenSinkOperationCommand extends $Command< + KitchenSinkOperationCommandInput, + KitchenSinkOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: KitchenSinkOperationCommandInput) { + // 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 = "KitchenSinkOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: KitchenSink.filterSensitiveLog, + outputFilterSensitiveLog: KitchenSink.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: KitchenSinkOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1KitchenSinkOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1KitchenSinkOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts new file mode 100644 index 000000000000..cc26c97ae886 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.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 { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { NullOperationInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_1NullOperationCommand, + serializeAws_json1_1NullOperationCommand, +} from "../protocols/Aws_json1_1"; + +export interface NullOperationCommandInput extends NullOperationInputOutput {} +export interface NullOperationCommandOutput extends NullOperationInputOutput, __MetadataBearer {} + +export class NullOperationCommand extends $Command< + NullOperationCommandInput, + NullOperationCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NullOperationCommandInput) { + // 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 = "NullOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NullOperationInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: NullOperationInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NullOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1NullOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1NullOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts new file mode 100644 index 000000000000..57caa84d3144 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.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 { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { SimpleStruct } from "../models/models_0"; +import { + deserializeAws_json1_1OperationWithOptionalInputOutputCommand, + serializeAws_json1_1OperationWithOptionalInputOutputCommand, +} from "../protocols/Aws_json1_1"; + +export interface OperationWithOptionalInputOutputCommandInput extends SimpleStruct {} +export interface OperationWithOptionalInputOutputCommandOutput extends SimpleStruct, __MetadataBearer {} + +export class OperationWithOptionalInputOutputCommand extends $Command< + OperationWithOptionalInputOutputCommandInput, + OperationWithOptionalInputOutputCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: OperationWithOptionalInputOutputCommandInput) { + // 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 = "OperationWithOptionalInputOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleStruct.filterSensitiveLog, + outputFilterSensitiveLog: SimpleStruct.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: OperationWithOptionalInputOutputCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_json1_1OperationWithOptionalInputOutputCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_json1_1OperationWithOptionalInputOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts new file mode 100644 index 000000000000..6de2a9f3de3e --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts @@ -0,0 +1,95 @@ +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 { PutAndGetInlineDocumentsInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_1PutAndGetInlineDocumentsCommand, + serializeAws_json1_1PutAndGetInlineDocumentsCommand, +} from "../protocols/Aws_json1_1"; + +export interface PutAndGetInlineDocumentsCommandInput extends PutAndGetInlineDocumentsInputOutput {} +export interface PutAndGetInlineDocumentsCommandOutput extends PutAndGetInlineDocumentsInputOutput, __MetadataBearer {} + +/** + * This example serializes an inline document as part of the payload. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JsonProtocolClient, PutAndGetInlineDocumentsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import + * // const { JsonProtocolClient, PutAndGetInlineDocumentsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import + * const client = new JsonProtocolClient(config); + * const command = new PutAndGetInlineDocumentsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link PutAndGetInlineDocumentsCommandInput} for command's `input` shape. + * @see {@link PutAndGetInlineDocumentsCommandOutput} for command's `response` shape. + * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class PutAndGetInlineDocumentsCommand extends $Command< + PutAndGetInlineDocumentsCommandInput, + PutAndGetInlineDocumentsCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: PutAndGetInlineDocumentsCommandInput) { + // 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 = "PutAndGetInlineDocumentsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: PutAndGetInlineDocumentsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: PutAndGetInlineDocumentsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: PutAndGetInlineDocumentsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1PutAndGetInlineDocumentsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1PutAndGetInlineDocumentsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts new file mode 100644 index 000000000000..2bec26bf9bde --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.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 { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { SimpleScalarPropertiesInputOutput } from "../models/models_0"; +import { + deserializeAws_json1_1SimpleScalarPropertiesCommand, + serializeAws_json1_1SimpleScalarPropertiesCommand, +} from "../protocols/Aws_json1_1"; + +export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} +export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} + +export class SimpleScalarPropertiesCommand extends $Command< + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, + JsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarPropertiesCommandInput) { + // 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 = "SimpleScalarPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1SimpleScalarPropertiesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_json1_1SimpleScalarPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/index.ts b/protocol_tests/aws-protocoltests-json/src/commands/index.ts new file mode 100644 index 000000000000..3dc6a63b593f --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/commands/index.ts @@ -0,0 +1,12 @@ +export * from "./EmptyOperationCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HostWithPathOperationCommand"; +export * from "./JsonEnumsCommand"; +export * from "./JsonUnionsCommand"; +export * from "./KitchenSinkOperationCommand"; +export * from "./NullOperationCommand"; +export * from "./OperationWithOptionalInputOutputCommand"; +export * from "./PutAndGetInlineDocumentsCommand"; +export * from "./SimpleScalarPropertiesCommand"; diff --git a/protocol_tests/aws-protocoltests-json/src/endpoints.ts b/protocol_tests/aws-protocoltests-json/src/endpoints.ts new file mode 100644 index 000000000000..5b52f205dd6a --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "jsonprotocol.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "jsonprotocol.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "jsonprotocol.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "jsonprotocol.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "jsonprotocol.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "foo", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-json/src/index.ts b/protocol_tests/aws-protocoltests-json/src/index.ts new file mode 100644 index 000000000000..e67863477563 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/index.ts @@ -0,0 +1,4 @@ +export * from "./JsonProtocol"; +export * from "./JsonProtocolClient"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-json/src/models/index.ts b/protocol_tests/aws-protocoltests-json/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-json/src/models/models_0.ts b/protocol_tests/aws-protocoltests-json/src/models/models_0.ts new file mode 100644 index 000000000000..8c45fb97b3e7 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/models/models_0.ts @@ -0,0 +1,504 @@ +import { LazyJsonString as __LazyJsonString } from "@aws-sdk/smithy-client"; +import { + DocumentType as __DocumentType, + MetadataBearer as $MetadataBearer, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface EmptyStruct {} + +export namespace EmptyStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyStruct): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +export interface SimpleStruct { + Value?: string; +} + +export namespace SimpleStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleStruct): any => ({ + ...obj, + }); +} + +export interface StructWithLocationName { + Value?: string; +} + +export namespace StructWithLocationName { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructWithLocationName): any => ({ + ...obj, + }); +} + +export interface ErrorWithoutMembers extends __SmithyException, $MetadataBearer { + name: "ErrorWithoutMembers"; + $fault: "server"; +} + +export namespace ErrorWithoutMembers { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ErrorWithoutMembers): any => ({ + ...obj, + }); +} + +/** + * This error has test cases that test some of the dark corners of Amazon service + * framework history. It should only be implemented by clients. + */ +export interface FooError extends __SmithyException, $MetadataBearer { + name: "FooError"; + $fault: "server"; +} + +export namespace FooError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FooError): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface JsonEnumsInputOutput { + fooEnum1?: FooEnum | string; + fooEnum2?: FooEnum | string; + fooEnum3?: FooEnum | string; + fooEnumList?: (FooEnum | string)[]; + fooEnumSet?: (FooEnum | string)[]; + fooEnumMap?: { [key: string]: FooEnum | string }; +} + +export namespace JsonEnumsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonEnumsInputOutput): any => ({ + ...obj, + }); +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +/** + * A union with a representative set of types for members. + */ +export type MyUnion = + | MyUnion.BlobValueMember + | MyUnion.BooleanValueMember + | MyUnion.EnumValueMember + | MyUnion.ListValueMember + | MyUnion.MapValueMember + | MyUnion.NumberValueMember + | MyUnion.StringValueMember + | MyUnion.StructureValueMember + | MyUnion.TimestampValueMember + | MyUnion.$UnknownMember; + +export namespace MyUnion { + export interface StringValueMember { + stringValue: string; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface BooleanValueMember { + stringValue?: never; + booleanValue: boolean; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface NumberValueMember { + stringValue?: never; + booleanValue?: never; + numberValue: number; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface BlobValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue: Uint8Array; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface TimestampValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue: Date; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface EnumValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue: FooEnum | string; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface ListValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue: string[]; + mapValue?: never; + structureValue?: never; + $unknown?: never; + } + + export interface MapValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue: { [key: string]: string }; + structureValue?: never; + $unknown?: never; + } + + export interface StructureValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue: GreetingStruct; + $unknown?: never; + } + + export interface $UnknownMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + $unknown: [string, any]; + } + + export interface Visitor { + stringValue: (value: string) => T; + booleanValue: (value: boolean) => T; + numberValue: (value: number) => T; + blobValue: (value: Uint8Array) => T; + timestampValue: (value: Date) => T; + enumValue: (value: FooEnum | string) => T; + listValue: (value: string[]) => T; + mapValue: (value: { [key: string]: string }) => T; + structureValue: (value: GreetingStruct) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: MyUnion, visitor: Visitor): T => { + if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); + if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); + if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); + if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); + if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); + if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); + if (value.listValue !== undefined) return visitor.listValue(value.listValue); + if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); + if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: MyUnion): any => { + if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; + if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; + if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; + if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; + if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; + if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; + if (obj.listValue !== undefined) return { listValue: obj.listValue }; + if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; + if (obj.structureValue !== undefined) + return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; +} + +/** + * A shared structure that contains a single union member. + */ +export interface UnionInputOutput { + /** + * A union with a representative set of types for members. + */ + contents?: MyUnion; +} + +export namespace UnionInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ + ...obj, + ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), + }); +} + +export interface NullOperationInputOutput { + string?: string; + sparseStringList?: string[]; + sparseStringMap?: { [key: string]: string }; +} + +export namespace NullOperationInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NullOperationInputOutput): any => ({ + ...obj, + }); +} + +export interface PutAndGetInlineDocumentsInputOutput { + inlineDocument?: __DocumentType; +} + +export namespace PutAndGetInlineDocumentsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PutAndGetInlineDocumentsInputOutput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarPropertiesInputOutput { + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarPropertiesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ + ...obj, + }); +} + +export interface KitchenSink { + Blob?: Uint8Array; + Boolean?: boolean; + Double?: number; + EmptyStruct?: EmptyStruct; + Float?: number; + HttpdateTimestamp?: Date; + Integer?: number; + Iso8601Timestamp?: Date; + JsonValue?: __LazyJsonString | string; + ListOfLists?: string[][]; + ListOfMapsOfStrings?: { [key: string]: string }[]; + ListOfStrings?: string[]; + ListOfStructs?: SimpleStruct[]; + Long?: number; + MapOfListsOfStrings?: { [key: string]: string[] }; + MapOfMaps?: { [key: string]: { [key: string]: string } }; + MapOfStrings?: { [key: string]: string }; + MapOfStructs?: { [key: string]: SimpleStruct }; + RecursiveList?: KitchenSink[]; + RecursiveMap?: { [key: string]: KitchenSink }; + RecursiveStruct?: KitchenSink; + SimpleStruct?: SimpleStruct; + String?: string; + StructWithLocationName?: StructWithLocationName; + Timestamp?: Date; + UnixTimestamp?: Date; +} + +export namespace KitchenSink { + /** + * @internal + */ + export const filterSensitiveLog = (obj: KitchenSink): any => ({ + ...obj, + }); +} + +export interface ErrorWithMembers extends __SmithyException, $MetadataBearer { + name: "ErrorWithMembers"; + $fault: "client"; + Code?: string; + ComplexData?: KitchenSink; + IntegerField?: number; + ListField?: string[]; + MapField?: { [key: string]: string }; + Message?: string; + /** + * abc + */ + StringField?: string; +} + +export namespace ErrorWithMembers { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ErrorWithMembers): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts b/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts new file mode 100644 index 000000000000..a8571c0ef28b --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts @@ -0,0 +1,1867 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + dateToUtcString as __dateToUtcString, + expectBoolean as __expectBoolean, + expectInt32 as __expectInt32, + expectLong as __expectLong, + expectNonNull as __expectNonNull, + expectNumber as __expectNumber, + expectString as __expectString, + expectUnion as __expectUnion, + LazyJsonString as __LazyJsonString, + limitedParseDouble as __limitedParseDouble, + limitedParseFloat32 as __limitedParseFloat32, + parseEpochTimestamp as __parseEpochTimestamp, + parseRfc3339DateTime as __parseRfc3339DateTime, + parseRfc7231DateTime as __parseRfc7231DateTime, + serializeFloat as __serializeFloat, +} from "@aws-sdk/smithy-client"; +import { + DocumentType as __DocumentType, + Endpoint as __Endpoint, + HeaderBag as __HeaderBag, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "../commands/EmptyOperationCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + 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 { + KitchenSinkOperationCommandInput, + KitchenSinkOperationCommandOutput, +} from "../commands/KitchenSinkOperationCommand"; +import { NullOperationCommandInput, NullOperationCommandOutput } from "../commands/NullOperationCommand"; +import { + OperationWithOptionalInputOutputCommandInput, + OperationWithOptionalInputOutputCommandOutput, +} from "../commands/OperationWithOptionalInputOutputCommand"; +import { + PutAndGetInlineDocumentsCommandInput, + PutAndGetInlineDocumentsCommandOutput, +} from "../commands/PutAndGetInlineDocumentsCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "../commands/SimpleScalarPropertiesCommand"; +import { + ComplexError, + ComplexNestedErrorData, + EmptyStruct, + ErrorWithMembers, + ErrorWithoutMembers, + FooEnum, + FooError, + GreetingStruct, + GreetingWithErrorsOutput, + HostLabelInput, + InvalidGreeting, + JsonEnumsInputOutput, + KitchenSink, + MyUnion, + NullOperationInputOutput, + PutAndGetInlineDocumentsInputOutput, + SimpleScalarPropertiesInputOutput, + SimpleStruct, + StructWithLocationName, + UnionInputOutput, +} from "../models/models_0"; + +export const serializeAws_json1_1EmptyOperationCommand = async ( + input: EmptyOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.EmptyOperation", + }; + const body = "{}"; + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1EndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.EndpointOperation", + }; + const body = "{}"; + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_json1_1EndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.EndpointWithHostLabelOperation", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1HostLabelInput(input, context)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_json1_1GreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.GreetingWithErrors", + }; + const body = "{}"; + 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 +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.JsonEnums", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1JsonEnumsInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1JsonUnionsCommand = async ( + input: JsonUnionsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.JsonUnions", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1UnionInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1KitchenSinkOperationCommand = async ( + input: KitchenSinkOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.KitchenSinkOperation", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1KitchenSink(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1NullOperationCommand = async ( + input: NullOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.NullOperation", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1NullOperationInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1OperationWithOptionalInputOutputCommand = async ( + input: OperationWithOptionalInputOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.OperationWithOptionalInputOutput", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1SimpleStruct(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1PutAndGetInlineDocumentsCommand = async ( + input: PutAndGetInlineDocumentsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.PutAndGetInlineDocuments", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1PutAndGetInlineDocumentsInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_json1_1SimpleScalarPropertiesCommand = async ( + input: SimpleScalarPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "JsonProtocol.SimpleScalarProperties", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1SimpleScalarPropertiesInputOutput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const deserializeAws_json1_1EmptyOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1EmptyOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EmptyOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1EmptyOperationCommandError = 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_1EndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1EndpointOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1EndpointOperationCommandError = 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_1EndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1EndpointWithHostLabelOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1EndpointWithHostLabelOperationCommandError = 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_1GreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1GreetingWithErrorsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1GreetingWithErrorsOutput(data, context); + const response: GreetingWithErrorsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1GreetingWithErrorsCommandError = 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.json#ComplexError": + response = { + ...(await deserializeAws_json1_1ComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "FooError": + case "aws.protocoltests.json#FooError": + response = { + ...(await deserializeAws_json1_1FooErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.json#InvalidGreeting": + response = { + ...(await deserializeAws_json1_1InvalidGreetingResponse(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_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 +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1JsonEnumsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1JsonEnumsInputOutput(data, context); + const response: JsonEnumsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1JsonEnumsCommandError = 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_1JsonUnionsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1JsonUnionsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1UnionInputOutput(data, context); + const response: JsonUnionsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1JsonUnionsCommandError = 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_1KitchenSinkOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1KitchenSinkOperationCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1KitchenSink(data, context); + const response: KitchenSinkOperationCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1KitchenSinkOperationCommandError = 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 "ErrorWithMembers": + case "aws.protocoltests.json#ErrorWithMembers": + response = { + ...(await deserializeAws_json1_1ErrorWithMembersResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "ErrorWithoutMembers": + case "aws.protocoltests.json#ErrorWithoutMembers": + response = { + ...(await deserializeAws_json1_1ErrorWithoutMembersResponse(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_json1_1NullOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1NullOperationCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1NullOperationInputOutput(data, context); + const response: NullOperationCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1NullOperationCommandError = 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_1OperationWithOptionalInputOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1OperationWithOptionalInputOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1SimpleStruct(data, context); + const response: OperationWithOptionalInputOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1OperationWithOptionalInputOutputCommandError = 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_1PutAndGetInlineDocumentsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1PutAndGetInlineDocumentsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1PutAndGetInlineDocumentsInputOutput(data, context); + const response: PutAndGetInlineDocumentsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1PutAndGetInlineDocumentsCommandError = 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_1SimpleScalarPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1SimpleScalarPropertiesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1SimpleScalarPropertiesInputOutput(data, context); + const response: SimpleScalarPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1SimpleScalarPropertiesCommandError = 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)); +}; + +const deserializeAws_json1_1ComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_1ComplexError(body, context); + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_1ErrorWithMembersResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_1ErrorWithMembers(body, context); + const contents: ErrorWithMembers = { + name: "ErrorWithMembers", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_1ErrorWithoutMembersResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_1ErrorWithoutMembers(body, context); + const contents: ErrorWithoutMembers = { + name: "ErrorWithoutMembers", + $fault: "server", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_1FooErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_1FooError(body, context); + const contents: FooError = { + name: "FooError", + $fault: "server", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_json1_1InvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_json1_1InvalidGreeting(body, context); + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const serializeAws_json1_1Document = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + +const serializeAws_json1_1EmptyStruct = (input: EmptyStruct, context: __SerdeContext): any => { + return {}; +}; + +const serializeAws_json1_1HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { + return { + ...(input.label !== undefined && input.label !== null && { label: input.label }), + }; +}; + +const serializeAws_json1_1JsonEnumsInputOutput = (input: JsonEnumsInputOutput, context: __SerdeContext): any => { + return { + ...(input.fooEnum1 !== undefined && input.fooEnum1 !== null && { fooEnum1: input.fooEnum1 }), + ...(input.fooEnum2 !== undefined && input.fooEnum2 !== null && { fooEnum2: input.fooEnum2 }), + ...(input.fooEnum3 !== undefined && input.fooEnum3 !== null && { fooEnum3: input.fooEnum3 }), + ...(input.fooEnumList !== undefined && + input.fooEnumList !== null && { fooEnumList: serializeAws_json1_1FooEnumList(input.fooEnumList, context) }), + ...(input.fooEnumMap !== undefined && + input.fooEnumMap !== null && { fooEnumMap: serializeAws_json1_1FooEnumMap(input.fooEnumMap, context) }), + ...(input.fooEnumSet !== undefined && + input.fooEnumSet !== null && { fooEnumSet: serializeAws_json1_1FooEnumSet(input.fooEnumSet, context) }), + }; +}; + +const serializeAws_json1_1KitchenSink = (input: KitchenSink, context: __SerdeContext): any => { + return { + ...(input.Blob !== undefined && input.Blob !== null && { Blob: context.base64Encoder(input.Blob) }), + ...(input.Boolean !== undefined && input.Boolean !== null && { Boolean: input.Boolean }), + ...(input.Double !== undefined && input.Double !== null && { Double: __serializeFloat(input.Double) }), + ...(input.EmptyStruct !== undefined && + input.EmptyStruct !== null && { EmptyStruct: serializeAws_json1_1EmptyStruct(input.EmptyStruct, context) }), + ...(input.Float !== undefined && input.Float !== null && { Float: __serializeFloat(input.Float) }), + ...(input.HttpdateTimestamp !== undefined && + input.HttpdateTimestamp !== null && { HttpdateTimestamp: __dateToUtcString(input.HttpdateTimestamp) }), + ...(input.Integer !== undefined && input.Integer !== null && { Integer: input.Integer }), + ...(input.Iso8601Timestamp !== undefined && + input.Iso8601Timestamp !== null && { + Iso8601Timestamp: input.Iso8601Timestamp.toISOString().split(".")[0] + "Z", + }), + ...(input.JsonValue !== undefined && + input.JsonValue !== null && { JsonValue: __LazyJsonString.fromObject(input.JsonValue) }), + ...(input.ListOfLists !== undefined && + input.ListOfLists !== null && { + ListOfLists: serializeAws_json1_1ListOfListOfStrings(input.ListOfLists, context), + }), + ...(input.ListOfMapsOfStrings !== undefined && + input.ListOfMapsOfStrings !== null && { + ListOfMapsOfStrings: serializeAws_json1_1ListOfMapsOfStrings(input.ListOfMapsOfStrings, context), + }), + ...(input.ListOfStrings !== undefined && + input.ListOfStrings !== null && { + ListOfStrings: serializeAws_json1_1ListOfStrings(input.ListOfStrings, context), + }), + ...(input.ListOfStructs !== undefined && + input.ListOfStructs !== null && { + ListOfStructs: serializeAws_json1_1ListOfStructs(input.ListOfStructs, context), + }), + ...(input.Long !== undefined && input.Long !== null && { Long: input.Long }), + ...(input.MapOfListsOfStrings !== undefined && + input.MapOfListsOfStrings !== null && { + MapOfListsOfStrings: serializeAws_json1_1MapOfListsOfStrings(input.MapOfListsOfStrings, context), + }), + ...(input.MapOfMaps !== undefined && + input.MapOfMaps !== null && { MapOfMaps: serializeAws_json1_1MapOfMapOfStrings(input.MapOfMaps, context) }), + ...(input.MapOfStrings !== undefined && + input.MapOfStrings !== null && { MapOfStrings: serializeAws_json1_1MapOfStrings(input.MapOfStrings, context) }), + ...(input.MapOfStructs !== undefined && + input.MapOfStructs !== null && { MapOfStructs: serializeAws_json1_1MapOfStructs(input.MapOfStructs, context) }), + ...(input.RecursiveList !== undefined && + input.RecursiveList !== null && { + RecursiveList: serializeAws_json1_1ListOfKitchenSinks(input.RecursiveList, context), + }), + ...(input.RecursiveMap !== undefined && + input.RecursiveMap !== null && { + RecursiveMap: serializeAws_json1_1MapOfKitchenSinks(input.RecursiveMap, context), + }), + ...(input.RecursiveStruct !== undefined && + input.RecursiveStruct !== null && { + RecursiveStruct: serializeAws_json1_1KitchenSink(input.RecursiveStruct, context), + }), + ...(input.SimpleStruct !== undefined && + input.SimpleStruct !== null && { SimpleStruct: serializeAws_json1_1SimpleStruct(input.SimpleStruct, context) }), + ...(input.String !== undefined && input.String !== null && { String: input.String }), + ...(input.StructWithLocationName !== undefined && + input.StructWithLocationName !== null && { + StructWithLocationName: serializeAws_json1_1StructWithLocationName(input.StructWithLocationName, context), + }), + ...(input.Timestamp !== undefined && + input.Timestamp !== null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }), + ...(input.UnixTimestamp !== undefined && + input.UnixTimestamp !== null && { UnixTimestamp: Math.round(input.UnixTimestamp.getTime() / 1000) }), + }; +}; + +const serializeAws_json1_1ListOfKitchenSinks = (input: KitchenSink[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_json1_1KitchenSink(entry, context); + }); +}; + +const serializeAws_json1_1ListOfListOfStrings = (input: string[][], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_json1_1ListOfStrings(entry, context); + }); +}; + +const serializeAws_json1_1ListOfMapsOfStrings = (input: { [key: string]: string }[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_json1_1MapOfStrings(entry, context); + }); +}; + +const serializeAws_json1_1ListOfStrings = (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_json1_1ListOfStructs = (input: SimpleStruct[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_json1_1SimpleStruct(entry, context); + }); +}; + +const serializeAws_json1_1MapOfKitchenSinks = (input: { [key: string]: KitchenSink }, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: serializeAws_json1_1KitchenSink(value, context), + }; + }, {}); +}; + +const serializeAws_json1_1MapOfListsOfStrings = (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]: serializeAws_json1_1ListOfStrings(value, context), + }; + }, {}); +}; + +const serializeAws_json1_1MapOfMapOfStrings = ( + input: { [key: string]: { [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]: serializeAws_json1_1MapOfStrings(value, context), + }; + }, {}); +}; + +const serializeAws_json1_1MapOfStrings = (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_json1_1MapOfStructs = (input: { [key: string]: SimpleStruct }, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: serializeAws_json1_1SimpleStruct(value, context), + }; + }, {}); +}; + +const serializeAws_json1_1MyUnion = (input: MyUnion, context: __SerdeContext): any => { + return MyUnion.visit(input, { + blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), + booleanValue: (value) => ({ booleanValue: value }), + enumValue: (value) => ({ enumValue: value }), + listValue: (value) => ({ listValue: serializeAws_json1_1StringList(value, context) }), + mapValue: (value) => ({ mapValue: serializeAws_json1_1StringMap(value, context) }), + numberValue: (value) => ({ numberValue: value }), + stringValue: (value) => ({ stringValue: value }), + structureValue: (value) => ({ structureValue: serializeAws_json1_1GreetingStruct(value, context) }), + timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), + _: (name, value) => ({ name: value } as any), + }); +}; + +const serializeAws_json1_1NullOperationInputOutput = ( + input: NullOperationInputOutput, + context: __SerdeContext +): any => { + return { + ...(input.sparseStringList !== undefined && + input.sparseStringList !== null && { + sparseStringList: serializeAws_json1_1SparseStringList(input.sparseStringList, context), + }), + ...(input.sparseStringMap !== undefined && + input.sparseStringMap !== null && { + sparseStringMap: serializeAws_json1_1SparseStringMap(input.sparseStringMap, context), + }), + ...(input.string !== undefined && input.string !== null && { string: input.string }), + }; +}; + +const serializeAws_json1_1PutAndGetInlineDocumentsInputOutput = ( + input: PutAndGetInlineDocumentsInputOutput, + context: __SerdeContext +): any => { + return { + ...(input.inlineDocument !== undefined && + input.inlineDocument !== null && { inlineDocument: serializeAws_json1_1Document(input.inlineDocument, context) }), + }; +}; + +const serializeAws_json1_1SimpleScalarPropertiesInputOutput = ( + input: SimpleScalarPropertiesInputOutput, + context: __SerdeContext +): any => { + return { + ...(input.doubleValue !== undefined && + input.doubleValue !== null && { doubleValue: __serializeFloat(input.doubleValue) }), + ...(input.floatValue !== undefined && + input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), + }; +}; + +const serializeAws_json1_1SimpleStruct = (input: SimpleStruct, context: __SerdeContext): any => { + return { + ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }), + }; +}; + +const serializeAws_json1_1StructWithLocationName = (input: StructWithLocationName, context: __SerdeContext): any => { + return { + ...(input.Value !== undefined && input.Value !== null && { RenamedMember: input.Value }), + }; +}; + +const serializeAws_json1_1UnionInputOutput = (input: UnionInputOutput, context: __SerdeContext): any => { + return { + ...(input.contents !== undefined && + input.contents !== null && { contents: serializeAws_json1_1MyUnion(input.contents, context) }), + }; +}; + +const serializeAws_json1_1FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_json1_1FooEnumMap = (input: { [key: string]: FooEnum | 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_json1_1FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_json1_1GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + return { + ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), + }; +}; + +const serializeAws_json1_1SparseStringList = (input: string[], context: __SerdeContext): any => { + return input.map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_json1_1SparseStringMap = (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, [key]: null as any }; + } + return { + ...acc, + [key]: value, + }; + }, {}); +}; + +const serializeAws_json1_1StringList = (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_json1_1StringMap = (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 deserializeAws_json1_1ComplexError = (output: any, context: __SerdeContext): ComplexError => { + return { + Nested: + output.Nested !== undefined && output.Nested !== null + ? deserializeAws_json1_1ComplexNestedErrorData(output.Nested, context) + : undefined, + TopLevel: __expectString(output.TopLevel), + } as any; +}; + +const deserializeAws_json1_1ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { + return { + Foo: __expectString(output.Fooooo), + } as any; +}; + +const deserializeAws_json1_1Document = (output: any, context: __SerdeContext): __DocumentType => { + return output; +}; + +const deserializeAws_json1_1EmptyStruct = (output: any, context: __SerdeContext): EmptyStruct => { + return {} as any; +}; + +const deserializeAws_json1_1ErrorWithMembers = (output: any, context: __SerdeContext): ErrorWithMembers => { + return { + Code: __expectString(output.Code), + ComplexData: + output.ComplexData !== undefined && output.ComplexData !== null + ? deserializeAws_json1_1KitchenSink(output.ComplexData, context) + : undefined, + IntegerField: __expectInt32(output.IntegerField), + ListField: + output.ListField !== undefined && output.ListField !== null + ? deserializeAws_json1_1ListOfStrings(output.ListField, context) + : undefined, + MapField: + output.MapField !== undefined && output.MapField !== null + ? deserializeAws_json1_1MapOfStrings(output.MapField, context) + : undefined, + Message: __expectString(output.Message), + StringField: __expectString(output.StringField), + } as any; +}; + +const deserializeAws_json1_1ErrorWithoutMembers = (output: any, context: __SerdeContext): ErrorWithoutMembers => { + return {} as any; +}; + +const deserializeAws_json1_1FooError = (output: any, context: __SerdeContext): FooError => { + return {} as any; +}; + +const deserializeAws_json1_1GreetingWithErrorsOutput = ( + output: any, + context: __SerdeContext +): GreetingWithErrorsOutput => { + return { + greeting: __expectString(output.greeting), + } as any; +}; + +const deserializeAws_json1_1InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { + return { + Message: __expectString(output.Message), + } as any; +}; + +const deserializeAws_json1_1JsonEnumsInputOutput = (output: any, context: __SerdeContext): JsonEnumsInputOutput => { + return { + fooEnum1: __expectString(output.fooEnum1), + fooEnum2: __expectString(output.fooEnum2), + fooEnum3: __expectString(output.fooEnum3), + fooEnumList: + output.fooEnumList !== undefined && output.fooEnumList !== null + ? deserializeAws_json1_1FooEnumList(output.fooEnumList, context) + : undefined, + fooEnumMap: + output.fooEnumMap !== undefined && output.fooEnumMap !== null + ? deserializeAws_json1_1FooEnumMap(output.fooEnumMap, context) + : undefined, + fooEnumSet: + output.fooEnumSet !== undefined && output.fooEnumSet !== null + ? deserializeAws_json1_1FooEnumSet(output.fooEnumSet, context) + : undefined, + } as any; +}; + +const deserializeAws_json1_1KitchenSink = (output: any, context: __SerdeContext): KitchenSink => { + return { + Blob: output.Blob !== undefined && output.Blob !== null ? context.base64Decoder(output.Blob) : undefined, + Boolean: __expectBoolean(output.Boolean), + Double: __limitedParseDouble(output.Double), + EmptyStruct: + output.EmptyStruct !== undefined && output.EmptyStruct !== null + ? deserializeAws_json1_1EmptyStruct(output.EmptyStruct, context) + : undefined, + Float: __limitedParseFloat32(output.Float), + HttpdateTimestamp: + output.HttpdateTimestamp !== undefined && output.HttpdateTimestamp !== null + ? __expectNonNull(__parseRfc7231DateTime(output.HttpdateTimestamp)) + : undefined, + Integer: __expectInt32(output.Integer), + Iso8601Timestamp: + output.Iso8601Timestamp !== undefined && output.Iso8601Timestamp !== null + ? __expectNonNull(__parseRfc3339DateTime(output.Iso8601Timestamp)) + : undefined, + JsonValue: + output.JsonValue !== undefined && output.JsonValue !== null ? new __LazyJsonString(output.JsonValue) : undefined, + ListOfLists: + output.ListOfLists !== undefined && output.ListOfLists !== null + ? deserializeAws_json1_1ListOfListOfStrings(output.ListOfLists, context) + : undefined, + ListOfMapsOfStrings: + output.ListOfMapsOfStrings !== undefined && output.ListOfMapsOfStrings !== null + ? deserializeAws_json1_1ListOfMapsOfStrings(output.ListOfMapsOfStrings, context) + : undefined, + ListOfStrings: + output.ListOfStrings !== undefined && output.ListOfStrings !== null + ? deserializeAws_json1_1ListOfStrings(output.ListOfStrings, context) + : undefined, + ListOfStructs: + output.ListOfStructs !== undefined && output.ListOfStructs !== null + ? deserializeAws_json1_1ListOfStructs(output.ListOfStructs, context) + : undefined, + Long: __expectLong(output.Long), + MapOfListsOfStrings: + output.MapOfListsOfStrings !== undefined && output.MapOfListsOfStrings !== null + ? deserializeAws_json1_1MapOfListsOfStrings(output.MapOfListsOfStrings, context) + : undefined, + MapOfMaps: + output.MapOfMaps !== undefined && output.MapOfMaps !== null + ? deserializeAws_json1_1MapOfMapOfStrings(output.MapOfMaps, context) + : undefined, + MapOfStrings: + output.MapOfStrings !== undefined && output.MapOfStrings !== null + ? deserializeAws_json1_1MapOfStrings(output.MapOfStrings, context) + : undefined, + MapOfStructs: + output.MapOfStructs !== undefined && output.MapOfStructs !== null + ? deserializeAws_json1_1MapOfStructs(output.MapOfStructs, context) + : undefined, + RecursiveList: + output.RecursiveList !== undefined && output.RecursiveList !== null + ? deserializeAws_json1_1ListOfKitchenSinks(output.RecursiveList, context) + : undefined, + RecursiveMap: + output.RecursiveMap !== undefined && output.RecursiveMap !== null + ? deserializeAws_json1_1MapOfKitchenSinks(output.RecursiveMap, context) + : undefined, + RecursiveStruct: + output.RecursiveStruct !== undefined && output.RecursiveStruct !== null + ? deserializeAws_json1_1KitchenSink(output.RecursiveStruct, context) + : undefined, + SimpleStruct: + output.SimpleStruct !== undefined && output.SimpleStruct !== null + ? deserializeAws_json1_1SimpleStruct(output.SimpleStruct, context) + : undefined, + String: __expectString(output.String), + StructWithLocationName: + output.StructWithLocationName !== undefined && output.StructWithLocationName !== null + ? deserializeAws_json1_1StructWithLocationName(output.StructWithLocationName, context) + : undefined, + Timestamp: + output.Timestamp !== undefined && output.Timestamp !== null + ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.Timestamp))) + : undefined, + UnixTimestamp: + output.UnixTimestamp !== undefined && output.UnixTimestamp !== null + ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.UnixTimestamp))) + : undefined, + } as any; +}; + +const deserializeAws_json1_1ListOfKitchenSinks = (output: any, context: __SerdeContext): KitchenSink[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1KitchenSink(entry, context); + }); +}; + +const deserializeAws_json1_1ListOfListOfStrings = (output: any, context: __SerdeContext): string[][] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1ListOfStrings(entry, context); + }); +}; + +const deserializeAws_json1_1ListOfMapsOfStrings = ( + output: any, + context: __SerdeContext +): { [key: string]: string }[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1MapOfStrings(entry, context); + }); +}; + +const deserializeAws_json1_1ListOfStrings = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_json1_1ListOfStructs = (output: any, context: __SerdeContext): SimpleStruct[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1SimpleStruct(entry, context); + }); +}; + +const deserializeAws_json1_1MapOfKitchenSinks = ( + output: any, + context: __SerdeContext +): { [key: string]: KitchenSink } => { + return Object.entries(output).reduce((acc: { [key: string]: KitchenSink }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_json1_1KitchenSink(value, context), + }; + }, {}); +}; + +const deserializeAws_json1_1MapOfListsOfStrings = ( + output: any, + context: __SerdeContext +): { [key: string]: string[] } => { + return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_json1_1ListOfStrings(value, context), + }; + }, {}); +}; + +const deserializeAws_json1_1MapOfMapOfStrings = ( + output: any, + context: __SerdeContext +): { [key: string]: { [key: string]: string } } => { + return Object.entries(output).reduce( + (acc: { [key: string]: { [key: string]: string } }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_json1_1MapOfStrings(value, context), + }; + }, + {} + ); +}; + +const deserializeAws_json1_1MapOfStrings = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_json1_1MapOfStructs = (output: any, context: __SerdeContext): { [key: string]: SimpleStruct } => { + return Object.entries(output).reduce((acc: { [key: string]: SimpleStruct }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_json1_1SimpleStruct(value, context), + }; + }, {}); +}; + +const deserializeAws_json1_1MyUnion = (output: any, context: __SerdeContext): MyUnion => { + if (output.blobValue !== undefined && output.blobValue !== null) { + return { + blobValue: context.base64Decoder(output.blobValue), + }; + } + if (__expectBoolean(output.booleanValue) !== undefined) { + return { booleanValue: __expectBoolean(output.booleanValue) as any }; + } + if (__expectString(output.enumValue) !== undefined) { + return { enumValue: __expectString(output.enumValue) as any }; + } + if (output.listValue !== undefined && output.listValue !== null) { + return { + listValue: deserializeAws_json1_1StringList(output.listValue, context), + }; + } + if (output.mapValue !== undefined && output.mapValue !== null) { + return { + mapValue: deserializeAws_json1_1StringMap(output.mapValue, context), + }; + } + if (__expectInt32(output.numberValue) !== undefined) { + return { numberValue: __expectInt32(output.numberValue) as any }; + } + if (__expectString(output.stringValue) !== undefined) { + return { stringValue: __expectString(output.stringValue) as any }; + } + if (output.structureValue !== undefined && output.structureValue !== null) { + return { + structureValue: deserializeAws_json1_1GreetingStruct(output.structureValue, context), + }; + } + if (output.timestampValue !== undefined && output.timestampValue !== null) { + return { + timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), + }; + } + return { $unknown: Object.entries(output)[0] }; +}; + +const deserializeAws_json1_1NullOperationInputOutput = ( + output: any, + context: __SerdeContext +): NullOperationInputOutput => { + return { + sparseStringList: + output.sparseStringList !== undefined && output.sparseStringList !== null + ? deserializeAws_json1_1SparseStringList(output.sparseStringList, context) + : undefined, + sparseStringMap: + output.sparseStringMap !== undefined && output.sparseStringMap !== null + ? deserializeAws_json1_1SparseStringMap(output.sparseStringMap, context) + : undefined, + string: __expectString(output.string), + } as any; +}; + +const deserializeAws_json1_1PutAndGetInlineDocumentsInputOutput = ( + output: any, + context: __SerdeContext +): PutAndGetInlineDocumentsInputOutput => { + return { + inlineDocument: + output.inlineDocument !== undefined && output.inlineDocument !== null + ? deserializeAws_json1_1Document(output.inlineDocument, context) + : undefined, + } as any; +}; + +const deserializeAws_json1_1SimpleScalarPropertiesInputOutput = ( + output: any, + context: __SerdeContext +): SimpleScalarPropertiesInputOutput => { + return { + doubleValue: __limitedParseDouble(output.doubleValue), + floatValue: __limitedParseFloat32(output.floatValue), + } as any; +}; + +const deserializeAws_json1_1SimpleStruct = (output: any, context: __SerdeContext): SimpleStruct => { + return { + Value: __expectString(output.Value), + } as any; +}; + +const deserializeAws_json1_1StructWithLocationName = (output: any, context: __SerdeContext): StructWithLocationName => { + return { + Value: __expectString(output.RenamedMember), + } as any; +}; + +const deserializeAws_json1_1UnionInputOutput = (output: any, context: __SerdeContext): UnionInputOutput => { + return { + contents: + output.contents !== undefined && output.contents !== null + ? deserializeAws_json1_1MyUnion(__expectUnion(output.contents), context) + : undefined, + } as any; +}; + +const deserializeAws_json1_1FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_json1_1FooEnumMap = ( + output: any, + context: __SerdeContext +): { [key: string]: FooEnum | string } => { + return Object.entries(output).reduce((acc: { [key: string]: FooEnum | string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_json1_1FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + const uniqueValues = new Set(); + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + const parsedEntry = __expectString(entry) as any; + if (uniqueValues.has(parsedEntry)) { + throw new TypeError('All elements of the set "aws.protocoltests.shared#FooEnumSet" must be unique.'); + } else { + uniqueValues.add(parsedEntry); + return parsedEntry; + } + }); +}; + +const deserializeAws_json1_1GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { + return { + hi: __expectString(output.hi), + } as any; +}; + +const deserializeAws_json1_1SparseStringList = (output: any, context: __SerdeContext): string[] => { + return (output || []).map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_json1_1SparseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_json1_1StringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_json1_1StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const buildHttpRpcRequest = async ( + context: __SerdeContext, + headers: __HeaderBag, + path: string, + resolvedHostname: string | undefined, + body: any +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents: any = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers, + }; + if (resolvedHostname !== undefined) { + contents.hostname = resolvedHostname; + } + if (body !== undefined) { + contents.body = body; + } + return new __HttpRequest(contents); +}; + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + return JSON.parse(encoded); + } + return {}; + }); + +/** + * Load an error code for the aws.rest-json-1.1 protocol. + */ +const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { + const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + + const sanitizeErrorCode = (rawValue: string): string => { + let cleanValue = rawValue; + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== undefined) { + return sanitizeErrorCode(output.headers[headerKey]); + } + + if (data.code !== undefined) { + return sanitizeErrorCode(data.code); + } + + if (data["__type"] !== undefined) { + return sanitizeErrorCode(data["__type"]); + } + + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..dfe2f7ddc1ab --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts @@ -0,0 +1,41 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { invalidProvider } from "@aws-sdk/invalid-dependency"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config?.region ?? invalidProvider("Region is missing"), + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..d7d9b706b6e7 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..eb8ab174b23b --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { defaultRegionInfoProvider } from "./endpoints"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => ({ + apiVersion: "2018-01-01", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "Json Protocol", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts new file mode 100644 index 000000000000..579a5ba379b9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts @@ -0,0 +1,46 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts"; +import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver"; +import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts b/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts new file mode 100644 index 000000000000..c51dbdbd35c3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts @@ -0,0 +1,4565 @@ +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"; + +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"; +import { NullOperationCommand } from "../../src/commands/NullOperationCommand"; +import { OperationWithOptionalInputOutputCommand } from "../../src/commands/OperationWithOptionalInputOutputCommand"; +import { PutAndGetInlineDocumentsCommand } from "../../src/commands/PutAndGetInlineDocumentsCommand"; +import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; +import { JsonProtocolClient } from "../../src/JsonProtocolClient"; +import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Sends requests to / + */ +it("sends_requests_to_slash:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyOperationCommand({}); + 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("/"); + } +}); + +/** + * Includes X-Amz-Target header and Content-Type + */ +it("includes_x_amz_target_and_content_type:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyOperationCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.EmptyOperation"); + } +}); + +/** + * Clients must always send an empty JSON object payload for + * operations with no input (that is, `{}`). While AWS service + * implementations support requests with no payload or requests + * that send `{}`, always sending `{}` from the client is + * preferred for forward compatibility in case input is ever + * added to an operation. + */ +it("json_1_1_client_sends_empty_payload_for_no_input_shape:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyOperationCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * When no output is defined, the service is expected to return + * an empty payload, however, client must ignore a JSON payload + * if one is returned. This ensures that if output is added later, + * then it will not break the client. + */ +it("handles_empty_output_shape:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new EmptyOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * This client-only test builds on handles_empty_output_shape, + * by including unexpected fields in the JSON. A client + * needs to ignore JSON output that is empty or that contains + * JSON object data. + */ +it("handles_unexpected_json_output:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "foo": true + }` + ), + }); + + const params: any = {}; + const command = new EmptyOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * When no output is defined, the service is expected to return + * an empty payload. Despite the lack of a payload, the service + * is expected to always send a Content-Type header. Clients must + * handle cases where a service returns a JSON object and where + * a service returns no JSON at all. + */ +it("json_1_1_service_responds_with_no_payload:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `` + ), + }); + + const params: any = {}; + const command = new EmptyOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("AwsJson11EndpointTrait:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("AwsJson11EndpointTraitWithHostLabel:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"label\": \"bar\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Parses simple JSON errors + */ +it("AwsJson11InvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "InvalidGreeting", + "Message": "Hi" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Parses a complex error with no message member + */ +it("AwsJson11ComplexError:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "ComplexError", + "TopLevel": "Top level", + "Nested": { + "Fooooo": "bar" + } + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +it("AwsJson11EmptyComplexError:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "ComplexError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. + */ +it("AwsJson11FooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' + * is to be interpreted as 'ValidationException'. + * + * For an example service see Amazon Polly. + */ +it("AwsJson11FooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. + */ +it("AwsJson11FooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": + "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. + * + * For example service see Amazon S3 Glacier. + */ +it("AwsJson11FooErrorUsingCode:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "code": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("AwsJson11FooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "code": "aws.protocoltests.restjson#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("AwsJson11FooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "code": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type. + */ +it("AwsJson11FooErrorWithDunderType:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("AwsJson11FooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "aws.protocoltests.restjson#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("AwsJson11FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "__type": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + 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 + */ +it("AwsJson11Enums:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonEnumsCommand({ + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"fooEnum1\": \"Foo\", + \"fooEnum2\": \"0\", + \"fooEnum3\": \"1\", + \"fooEnumList\": [ + \"Foo\", + \"0\" + ], + \"fooEnumSet\": [ + \"Foo\", + \"0\" + ], + \"fooEnumMap\": { + \"hi\": \"Foo\", + \"zero\": \"0\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("AwsJson11Enums:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "fooEnum1": "Foo", + "fooEnum2": "0", + "fooEnum3": "1", + "fooEnumList": [ + "Foo", + "0" + ], + "fooEnumSet": [ + "Foo", + "0" + ], + "fooEnumMap": { + "hi": "Foo", + "zero": "0" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonEnumsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a string union value + */ +it("AwsJson11SerializeStringUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + stringValue: "foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"stringValue\": \"foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a boolean union value + */ +it("AwsJson11SerializeBooleanUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + booleanValue: true, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"booleanValue\": true + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a number union value + */ +it("AwsJson11SerializeNumberUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + numberValue: 1, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"numberValue\": 1 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob union value + */ +it("AwsJson11SerializeBlobUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"blobValue\": \"Zm9v\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a timestamp union value + */ +it("AwsJson11SerializeTimestampUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + timestampValue: new Date(1398796238000), + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"timestampValue\": 1398796238 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an enum union value + */ +it("AwsJson11SerializeEnumUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + enumValue: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"enumValue\": \"Foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a list union value + */ +it("AwsJson11SerializeListUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + listValue: ["foo", "bar"], + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"listValue\": [\"foo\", \"bar\"] + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a map union value + */ +it("AwsJson11SerializeMapUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"mapValue\": { + \"foo\": \"bar\", + \"spam\": \"eggs\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure union value + */ +it("AwsJson11SerializeStructureUnionValue:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + structureValue: { + hi: "hello", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"structureValue\": { + \"hi\": \"hello\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes a string union value + */ +it("AwsJson11DeserializeStringUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "stringValue": "foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + stringValue: "foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a boolean union value + */ +it("AwsJson11DeserializeBooleanUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "booleanValue": true + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + booleanValue: true, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a number union value + */ +it("AwsJson11DeserializeNumberUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "numberValue": 1 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + numberValue: 1, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a blob union value + */ +it("AwsJson11DeserializeBlobUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "blobValue": "Zm9v" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a timestamp union value + */ +it("AwsJson11DeserializeTimestampUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "timestampValue": 1398796238 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + timestampValue: new Date(1398796238000), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes an enum union value + */ +it("AwsJson11DeserializeEnumUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "enumValue": "Foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + enumValue: "Foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a list union value + */ +it("AwsJson11DeserializeListUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "listValue": ["foo", "bar"] + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + listValue: ["foo", "bar"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a map union value + */ +it("AwsJson11DeserializeMapUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "mapValue": { + "foo": "bar", + "spam": "eggs" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a structure union value + */ +it("AwsJson11DeserializeStructureUnionValue:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "contents": { + "structureValue": { + "hi": "hello" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + structureValue: { + hi: "hello", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes string shapes + */ +it("serializes_string_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + String: "abc xyz", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"String\":\"abc xyz\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes string shapes with jsonvalue trait + */ +it("serializes_string_shapes_with_jsonvalue_trait:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + JsonValue: + '{"string":"value","number":1234.5,"boolTrue":true,"boolFalse":false,"array":[1,2,3,4],"object":{"key":"value"},"null":null}', + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"JsonValue\":\"{\\"string\\":\\"value\\",\\"number\\":1234.5,\\"boolTrue\\":true,\\"boolFalse\\":false,\\"array\\":[1,2,3,4],\\"object\\":{\\"key\\":\\"value\\"},\\"null\\":null}\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes integer shapes + */ +it("serializes_integer_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Integer: 1234, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Integer\":1234}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes long shapes + */ +it("serializes_long_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Long: 999999999999, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Long\":999999999999}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes float shapes + */ +it("serializes_float_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Float: 1234.5, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Float\":1234.5}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes double shapes + */ +it("serializes_double_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Double: 1234.5, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Double\":1234.5}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes blob shapes + */ +it("serializes_blob_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Blob: Uint8Array.from("binary-value", (c) => c.charCodeAt(0)), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Blob\":\"YmluYXJ5LXZhbHVl\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes boolean shapes (true) + */ +it("serializes_boolean_shapes_true:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Boolean: true, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Boolean\":true}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes boolean shapes (false) + */ +it("serializes_boolean_shapes_false:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Boolean: false, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Boolean\":false}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamp shapes + */ +it("serializes_timestamp_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Timestamp: new Date(946845296000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Timestamp\":946845296}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamp shapes with iso8601 timestampFormat + */ +it("serializes_timestamp_shapes_with_iso8601_timestampformat:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + Iso8601Timestamp: new Date(946845296000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamp shapes with httpdate timestampFormat + */ +it("serializes_timestamp_shapes_with_httpdate_timestampformat:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + HttpdateTimestamp: new Date(946845296000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamp shapes with unixTimestamp timestampFormat + */ +it("serializes_timestamp_shapes_with_unixtimestamp_timestampformat:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + UnixTimestamp: new Date(946845296000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"UnixTimestamp\":946845296}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes list shapes + */ +it("serializes_list_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + ListOfStrings: ["abc", "mno", "xyz"], + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes empty list shapes + */ +it("serializes_empty_list_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + ListOfStrings: [], + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"ListOfStrings\":[]}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes list of map shapes + */ +it("serializes_list_of_map_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + ListOfMapsOfStrings: [ + { + foo: "bar", + } as any, + + { + abc: "xyz", + } as any, + + { + red: "blue", + } as any, + ], + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes list of structure shapes + */ +it("serializes_list_of_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + ListOfStructs: [ + { + Value: "abc", + } as any, + + { + Value: "mno", + } as any, + + { + Value: "xyz", + } as any, + ], + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes list of recursive structure shapes + */ +it("serializes_list_of_recursive_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + RecursiveList: [ + { + RecursiveList: [ + { + RecursiveList: [ + { + Integer: 123, + } as any, + ], + } as any, + ], + } as any, + ], + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes map shapes + */ +it("serializes_map_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + MapOfStrings: { + abc: "xyz", + + mno: "hjk", + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes empty map shapes + */ +it("serializes_empty_map_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + MapOfStrings: {} as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"MapOfStrings\":{}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes map of list shapes + */ +it("serializes_map_of_list_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + MapOfListsOfStrings: { + abc: ["abc", "xyz"], + + mno: ["xyz", "abc"], + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes map of structure shapes + */ +it("serializes_map_of_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + MapOfStructs: { + key1: { + Value: "value-1", + } as any, + + key2: { + Value: "value-2", + } as any, + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes map of recursive structure shapes + */ +it("serializes_map_of_recursive_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + RecursiveMap: { + key1: { + RecursiveMap: { + key2: { + RecursiveMap: { + key3: { + Boolean: false, + } as any, + } as any, + } as any, + } as any, + } as any, + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes structure shapes + */ +it("serializes_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + SimpleStruct: { + Value: "abc", + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"SimpleStruct\":{\"Value\":\"abc\"}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes structure members with locationName traits + */ +it("serializes_structure_members_with_locationname_traits:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + StructWithLocationName: { + Value: "some-value", + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"StructWithLocationName\":{\"RenamedMember\":\"some-value\"}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes empty structure shapes + */ +it("serializes_empty_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + SimpleStruct: {} as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"SimpleStruct\":{}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes structure which have no members + */ +it("serializes_structure_which_have_no_members:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + EmptyStruct: {} as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"EmptyStruct\":{}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes recursive structure shapes + */ +it("serializes_recursive_structure_shapes:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new KitchenSinkOperationCommand({ + String: "top-value", + + Boolean: false, + + RecursiveStruct: { + String: "nested-value", + + Boolean: true, + + RecursiveList: [ + { + String: "string-only", + } as any, + + { + RecursiveStruct: { + MapOfStrings: { + color: "red", + + size: "large", + } as any, + } as any, + } as any, + ], + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Parses operations with empty JSON bodies + */ +it("parses_operations_with_empty_json_bodies:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Parses string shapes + */ +it("parses_string_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"String":"string-value"}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + String: "string-value", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses integer shapes + */ +it("parses_integer_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Integer":1234}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Integer: 1234, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses long shapes + */ +it("parses_long_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Long":1234567890123456789}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Long: 1234567890123456789, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses float shapes + */ +it("parses_float_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Float":1234.5}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Float: 1234.5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses double shapes + */ +it("parses_double_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Double":123456789.12345679}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Double: 1.2345678912345679e8, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses boolean shapes (true) + */ +it("parses_boolean_shapes_true:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Boolean":true}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Boolean: true, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses boolean (false) + */ +it("parses_boolean_false:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Boolean":false}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Boolean: false, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses blob shapes + */ +it("parses_blob_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Blob":"YmluYXJ5LXZhbHVl"}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Blob: Uint8Array.from("binary-value", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses timestamp shapes + */ +it("parses_timestamp_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Timestamp":946845296}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Timestamp: new Date(946845296000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses iso8601 timestamps + */ +it("parses_iso8601_timestamps:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"Iso8601Timestamp":"2000-01-02T20:34:56.000Z"}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + Iso8601Timestamp: new Date(946845296000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses httpdate timestamps + */ +it("parses_httpdate_timestamps:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"HttpdateTimestamp":"Sun, 02 Jan 2000 20:34:56.000 GMT"}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + HttpdateTimestamp: new Date(946845296000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses list shapes + */ +it("parses_list_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"ListOfStrings":["abc","mno","xyz"]}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + ListOfStrings: ["abc", "mno", "xyz"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses list of map shapes + */ +it("parses_list_of_map_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"ListOfMapsOfStrings":[{"size":"large"},{"color":"red"}]}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + ListOfMapsOfStrings: [ + { + size: "large", + }, + + { + color: "red", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses list of list shapes + */ +it("parses_list_of_list_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"ListOfLists":[["abc","mno","xyz"],["hjk","qrs","tuv"]]}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + ListOfLists: [ + ["abc", "mno", "xyz"], + + ["hjk", "qrs", "tuv"], + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses list of structure shapes + */ +it("parses_list_of_structure_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"ListOfStructs":[{"Value":"value-1"},{"Value":"value-2"}]}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + ListOfStructs: [ + { + Value: "value-1", + }, + + { + Value: "value-2", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses list of recursive structure shapes + */ +it("parses_list_of_recursive_structure_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"RecursiveList":[{"RecursiveList":[{"RecursiveList":[{"String":"value"}]}]}]}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + RecursiveList: [ + { + RecursiveList: [ + { + RecursiveList: [ + { + String: "value", + }, + ], + }, + ], + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses map shapes + */ +it("parses_map_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"MapOfStrings":{"size":"large","color":"red"}}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + MapOfStrings: { + size: "large", + + color: "red", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses map of list shapes + */ +it("parses_map_of_list_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"MapOfListsOfStrings":{"sizes":["large","small"],"colors":["red","green"]}}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + MapOfListsOfStrings: { + sizes: ["large", "small"], + + colors: ["red", "green"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses map of map shapes + */ +it("parses_map_of_map_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"MapOfMaps":{"sizes":{"large":"L","medium":"M"},"colors":{"red":"R","blue":"B"}}}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + MapOfMaps: { + sizes: { + large: "L", + + medium: "M", + }, + + colors: { + red: "R", + + blue: "B", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses map of structure shapes + */ +it("parses_map_of_structure_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"MapOfStructs":{"size":{"Value":"small"},"color":{"Value":"red"}}}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + MapOfStructs: { + size: { + Value: "small", + }, + + color: { + Value: "red", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses map of recursive structure shapes + */ +it("parses_map_of_recursive_structure_shapes:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{"RecursiveMap":{"key-1":{"RecursiveMap":{"key-2":{"RecursiveMap":{"key-3":{"String":"value"}}}}}}}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + RecursiveMap: { + "key-1": { + RecursiveMap: { + "key-2": { + RecursiveMap: { + "key-3": { + String: "value", + }, + }, + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses the request id from the response + */ +it("parses_the_request_id_from_the_response:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-amzn-requestid": "amazon-uniq-request-id", + "content-type": "application/x-amz-json-1.1", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new KitchenSinkOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Null structure values are dropped + */ +it("AwsJson11StructuresDontSerializeNullValues:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NullOperationCommand({ + string: null, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes null values in maps + */ +it("AwsJson11MapsSerializeNullValues:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NullOperationCommand({ + sparseStringMap: { + foo: null, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseStringMap\": { + \"foo\": null + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes null values in lists + */ +it("AwsJson11ListsSerializeNull:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NullOperationCommand({ + sparseStringList: [null], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseStringList\": [ + null + ] + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Null structure values are dropped + */ +it("AwsJson11StructuresDontDeserializeNullValues:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "string": null + }` + ), + }); + + const params: any = {}; + const command = new NullOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Deserializes null values in maps + */ +it("AwsJson11MapsDeserializeNullValues:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "sparseStringMap": { + "foo": null + } + }` + ), + }); + + const params: any = {}; + const command = new NullOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseStringMap: { + foo: null, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes null values in lists + */ +it("AwsJson11ListsDeserializeNull:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "sparseStringList": [ + null + ] + }` + ), + }); + + const params: any = {}; + const command = new NullOperationCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseStringList: [null], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Can call operations with no input or output + */ +it("can_call_operation_with_no_input_or_output:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OperationWithOptionalInputOutputCommand({} as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.OperationWithOptionalInputOutput"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Can invoke operations with optional input + */ +it("can_call_operation_with_optional_input:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OperationWithOptionalInputOutputCommand({ + Value: "Hi", + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.OperationWithOptionalInputOutput"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"Value\":\"Hi\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes inline documents in a JSON request. + */ +it("PutAndGetInlineDocumentsInput:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PutAndGetInlineDocumentsCommand({ + inlineDocument: { + foo: "bar", + }, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"inlineDocument\": {\"foo\": \"bar\"} + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes inline documents in a JSON response. + */ +it("PutAndGetInlineDocumentsInput:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "inlineDocument": {"foo": "bar"} + }` + ), + }); + + const params: any = {}; + const command = new PutAndGetInlineDocumentsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + inlineDocument: { + foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float values. + */ +it("AwsJson11SupportsNaNFloatInputs:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: NaN, + + doubleValue: NaN, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"NaN\", + \"doubleValue\": \"NaN\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsJson11SupportsInfinityFloatInputs:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: Infinity, + + doubleValue: Infinity, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"Infinity\", + \"doubleValue\": \"Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsJson11SupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: -Infinity, + + doubleValue: -Infinity, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); + expect(r.headers["x-amz-target"]).toBeDefined(); + expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"-Infinity\", + \"doubleValue\": \"-Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("AwsJson11SupportsNaNFloatInputs:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "floatValue": "NaN", + "doubleValue": "NaN" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsJson11SupportsInfinityFloatInputs:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "floatValue": "Infinity", + "doubleValue": "Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsJson11SupportsNegativeInfinityFloatInputs:Response", async () => { + const client = new JsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/x-amz-json-1.1", + }, + `{ + "floatValue": "-Infinity", + "doubleValue": "-Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { + const expectedParts = JSON.parse(expectedBody); + const generatedParts = JSON.parse(generatedBody); + + 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-protocoltests-json/tsconfig.es.json b/protocol_tests/aws-protocoltests-json/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-json/tsconfig.json b/protocol_tests/aws-protocoltests-json/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-json/tsconfig.types.json b/protocol_tests/aws-protocoltests-json/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-query/.gitignore b/protocol_tests/aws-protocoltests-query/.gitignore new file mode 100644 index 000000000000..bff6121c007d --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-query/CHANGELOG.md b/protocol_tests/aws-protocoltests-query/CHANGELOG.md new file mode 100644 index 000000000000..f62cdf43b36b --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/CHANGELOG.md @@ -0,0 +1,775 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + + +### Bug Fixes + +* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + +### Features + +* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) + + + + + +# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) + + +### Bug Fixes + +* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) + + + + + +# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) + + +### Features + +* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) +* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) + + + + + +# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) + + +### Features + +* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) + + + + + +# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) + + +### Bug Fixes + +* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) + + + + + +# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) + + +### Bug Fixes + +* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) + + + + + +# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) + + +### Bug Fixes + +* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) + + +### Features + +* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) + + + + + +## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) + + +### Features + +* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) + + + + + +# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) + + +### Bug Fixes + +* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) + + +### Features + +* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) + + + + + +# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) + + +### Bug Fixes + +* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) + + + + + +# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) + + +### Features + +* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) + + + + + +# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) + + +### Bug Fixes + +* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) + + + + + +# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) + + +### Bug Fixes + +* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) + + + + + +# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) + + +### Bug Fixes + +* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) + + + + + +# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) + + +### Bug Fixes + +* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) + + + + + +# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) + + +### Features + +* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) +* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) + + + + + +# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) + + +### Bug Fixes + +* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) +* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) + + +### Features + +* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) + + + + + +# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) + + +### Bug Fixes + +* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) + + + + + +# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) + + +### Bug Fixes + +* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) +* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) +* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) +* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) + + +### Features + +* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) + + + + + +# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) + + +### Features + +* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) + + + + + +# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) + + +### Bug Fixes + +* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) + + +### Features + +* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) + + + + + +# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) + + +### Features + +* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) + + + + + +# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) + + +### Bug Fixes + +* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) + + + + + +# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) + + +### Features + +* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) + + + + + +# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) + + +### Bug Fixes + +* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) + + + + + +# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) + + +### Features + +* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) + + + + + +# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.9...@aws-sdk/aws-query@1.0.0-gamma.10) (2020-10-07) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.8...@aws-sdk/aws-query@1.0.0-gamma.9) (2020-09-29) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.7...@aws-sdk/aws-query@1.0.0-gamma.8) (2020-09-15) + + +### Bug Fixes + +* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) +* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) + + + + + +# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.6...@aws-sdk/aws-query@1.0.0-gamma.7) (2020-09-01) + + +### Features + +* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) + + + + + +# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.5...@aws-sdk/aws-query@1.0.0-gamma.6) (2020-08-25) + + +### Features + +* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) +* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) +* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) + + + + + +# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.4...@aws-sdk/aws-query@1.0.0-gamma.5) (2020-08-04) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.3...@aws-sdk/aws-query@1.0.0-gamma.4) (2020-07-21) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.2...@aws-sdk/aws-query@1.0.0-gamma.3) (2020-07-13) + +**Note:** Version bump only for package @aws-sdk/aws-query + + + + + +# 1.0.0-gamma.2 (2020-07-08) + + +### Features + +* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) + + + +# 1.0.0-gamma.2 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.1 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.0 (2020-05-21) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-beta.0 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-query/LICENSE b/protocol_tests/aws-protocoltests-query/LICENSE new file mode 100644 index 000000000000..dd65ae06be7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-query/README.md b/protocol_tests/aws-protocoltests-query/README.md new file mode 100644 index 000000000000..37361db40487 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/README.md @@ -0,0 +1,203 @@ +# @aws-sdk/aws-protocoltests-query + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-query/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-query) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-query.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-query) + +## Description + +AWS SDK for JavaScript QueryProtocol Client for Node.js, Browser and React Native. + +A query service that sends query requests and XML responses. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-query +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-query` +- `yarn add @aws-sdk/aws-protocoltests-query` +- `pnpm add @aws-sdk/aws-protocoltests-query` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `QueryProtocolClient` and +the commands you need, for example `EmptyInputAndEmptyOutputCommand`: + +```js +// ES5 example +const { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); +``` + +```ts +// ES6+ example +import { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-query"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new QueryProtocolClient({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new EmptyInputAndEmptyOutputCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-query"; +const client = new AWS.QueryProtocol({ region: "REGION" }); + +// async/await. +try { + const data = await client.emptyInputAndEmptyOutput(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .emptyInputAndEmptyOutput(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.emptyInputAndEmptyOutput(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-query` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-query/package.json b/protocol_tests/aws-protocoltests-query/package.json new file mode 100644 index 000000000000..fe8342be5885 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/package.json @@ -0,0 +1,96 @@ +{ + "name": "@aws-sdk/aws-protocoltests-ec2", + "description": "@aws-sdk/aws-protocoltests-ec2 client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "entities": "2.2.0", + "fast-xml-parser": "3.19.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-ec2", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-ec2" + } +} diff --git a/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts b/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts new file mode 100644 index 000000000000..e5b416d9e6aa --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts @@ -0,0 +1,1022 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommand, + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + FlattenedXmlMapCommand, + FlattenedXmlMapCommandInput, + FlattenedXmlMapCommandOutput, +} from "./commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommand, + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommand, + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { + GreetingWithErrorsCommand, + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, +} from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommand, + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "./commands/IgnoresWrappingXmlNameCommand"; +import { + NestedStructuresCommand, + NestedStructuresCommandInput, + NestedStructuresCommandOutput, +} from "./commands/NestedStructuresCommand"; +import { + NoInputAndNoOutputCommand, + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, +} from "./commands/NoInputAndNoOutputCommand"; +import { + NoInputAndOutputCommand, + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, +} from "./commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommand, + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommand, QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; +import { QueryMapsCommand, QueryMapsCommandInput, QueryMapsCommandOutput } from "./commands/QueryMapsCommand"; +import { + QueryTimestampsCommand, + QueryTimestampsCommandInput, + QueryTimestampsCommandOutput, +} from "./commands/QueryTimestampsCommand"; +import { + RecursiveXmlShapesCommand, + RecursiveXmlShapesCommandInput, + RecursiveXmlShapesCommandOutput, +} from "./commands/RecursiveXmlShapesCommand"; +import { + SimpleInputParamsCommand, + SimpleInputParamsCommandInput, + SimpleInputParamsCommandOutput, +} from "./commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommand, + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "./commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { + XmlEmptyBlobsCommand, + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, +} from "./commands/XmlEmptyBlobsCommand"; +import { + XmlEmptyListsCommand, + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, +} from "./commands/XmlEmptyListsCommand"; +import { + XmlEmptyMapsCommand, + XmlEmptyMapsCommandInput, + XmlEmptyMapsCommandOutput, +} from "./commands/XmlEmptyMapsCommand"; +import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { XmlMapsCommand, XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; +import { + XmlMapsXmlNameCommand, + XmlMapsXmlNameCommandInput, + XmlMapsXmlNameCommandOutput, +} from "./commands/XmlMapsXmlNameCommand"; +import { + XmlNamespacesCommand, + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, +} from "./commands/XmlNamespacesCommand"; +import { + XmlTimestampsCommand, + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, +} from "./commands/XmlTimestampsCommand"; +import { QueryProtocolClient } from "./QueryProtocolClient"; + +/** + * A query service that sends query requests and XML responses. + */ +export class QueryProtocol extends QueryProtocolClient { + /** + * The example tests how requests and responses are serialized when there's + * no request or response members. + * + * While this should be rare, code generators must support this. + */ + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), + cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): Promise | void { + const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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); + } + } + + /** + * Flattened maps + */ + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): void; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): void; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapCommand(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); + } + } + + /** + * Flattened maps with @xmlName + */ + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapWithXmlNameCommand(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); + } + } + + /** + * Flattened maps with @xmlNamespace and @xmlName + */ + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapWithXmlNamespaceCommand(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 has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 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. + * + * The wrapping element is always operation name + "Response", and + * inside of that wrapper is another wrapper named operation name + "Result". + */ + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): void; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): void; + public ignoresWrappingXmlName( + args: IgnoresWrappingXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void), + cb?: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void + ): Promise | void { + const command = new IgnoresWrappingXmlNameCommand(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 test serializes nested and recursive structure members. + */ + public nestedStructures( + args: NestedStructuresCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nestedStructures( + args: NestedStructuresCommandInput, + cb: (err: any, data?: NestedStructuresCommandOutput) => void + ): void; + public nestedStructures( + args: NestedStructuresCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NestedStructuresCommandOutput) => void + ): void; + public nestedStructures( + args: NestedStructuresCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedStructuresCommandOutput) => void), + cb?: (err: any, data?: NestedStructuresCommandOutput) => void + ): Promise | void { + const command = new NestedStructuresCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * + * While this should be rare, code generators must support this. + */ + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's + * no request payload or response members. + * + * While this should be rare, code generators must support this. + */ + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndOutputCommand(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); + } + } + + /** + * Automatically adds idempotency tokens. + */ + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), + cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): Promise | void { + const command = new QueryIdempotencyTokenAutoFillCommand(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 test serializes simple and complex lists. + */ + public queryLists(args: QueryListsCommandInput, options?: __HttpHandlerOptions): Promise; + public queryLists(args: QueryListsCommandInput, cb: (err: any, data?: QueryListsCommandOutput) => void): void; + public queryLists( + args: QueryListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryListsCommandOutput) => void + ): void; + public queryLists( + args: QueryListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryListsCommandOutput) => void), + cb?: (err: any, data?: QueryListsCommandOutput) => void + ): Promise | void { + const command = new QueryListsCommand(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 test serializes simple and complex maps. + */ + public queryMaps(args: QueryMapsCommandInput, options?: __HttpHandlerOptions): Promise; + public queryMaps(args: QueryMapsCommandInput, cb: (err: any, data?: QueryMapsCommandOutput) => void): void; + public queryMaps( + args: QueryMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryMapsCommandOutput) => void + ): void; + public queryMaps( + args: QueryMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryMapsCommandOutput) => void), + cb?: (err: any, data?: QueryMapsCommandOutput) => void + ): Promise | void { + const command = new QueryMapsCommand(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 test serializes timestamps. + * + * 1. Timestamps are serialized as RFC 3339 date-time values by default. + * 2. A timestampFormat trait on a member changes the format. + * 3. A timestampFormat trait on the shape targeted by the member changes the format. + */ + public queryTimestamps( + args: QueryTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryTimestamps( + args: QueryTimestampsCommandInput, + cb: (err: any, data?: QueryTimestampsCommandOutput) => void + ): void; + public queryTimestamps( + args: QueryTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryTimestampsCommandOutput) => void + ): void; + public queryTimestamps( + args: QueryTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryTimestampsCommandOutput) => void), + cb?: (err: any, data?: QueryTimestampsCommandOutput) => void + ): Promise | void { + const command = new QueryTimestampsCommand(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); + } + } + + /** + * Recursive shapes + */ + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): void; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): void; + public recursiveXmlShapes( + args: RecursiveXmlShapesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveXmlShapesCommandOutput) => void), + cb?: (err: any, data?: RecursiveXmlShapesCommandOutput) => void + ): Promise | void { + const command = new RecursiveXmlShapesCommand(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 test serializes strings, numbers, and boolean values. + */ + public simpleInputParams( + args: SimpleInputParamsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + cb: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): void; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): void; + public simpleInputParams( + args: SimpleInputParamsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleInputParamsCommandOutput) => void), + cb?: (err: any, data?: SimpleInputParamsCommandOutput) => void + ): Promise | void { + const command = new SimpleInputParamsCommand(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 simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): void; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): void; + public simpleScalarXmlProperties( + args: SimpleScalarXmlPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarXmlPropertiesCommand(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); + } + } + + /** + * Blobs are base64 encoded + */ + public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlBlobsCommandOutput) => void + ): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlBlobsCommand(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 xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyBlobsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyListsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyMaps(args: XmlEmptyMapsCommandInput, cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void): void; + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void + ): void; + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyMapsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyMapsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyMapsCommand(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. + */ + public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; + public xmlEnums( + args: XmlEnumsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEnumsCommandOutput) => void + ): void; + public xmlEnums( + args: XmlEnumsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), + cb?: (err: any, data?: XmlEnumsCommandOutput) => void + ): Promise | void { + const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Lists of structures. + */ + public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; + public xmlLists( + args: XmlListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlListsCommandOutput) => void + ): void; + public xmlLists( + args: XmlListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), + cb?: (err: any, data?: XmlListsCommandOutput) => void + ): Promise | void { + const command = new XmlListsCommand(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 example tests basic map serialization. + */ + public xmlMaps(args: XmlMapsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlMaps(args: XmlMapsCommandInput, cb: (err: any, data?: XmlMapsCommandOutput) => void): void; + public xmlMaps( + args: XmlMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlMapsCommandOutput) => void + ): void; + public xmlMaps( + args: XmlMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsCommandOutput) => void), + cb?: (err: any, data?: XmlMapsCommandOutput) => void + ): Promise | void { + const command = new XmlMapsCommand(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 xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): void; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): void; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsXmlNameCommandOutput) => void), + cb?: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): Promise | void { + const command = new XmlMapsXmlNameCommand(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 xmlNamespaces( + args: XmlNamespacesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), + cb?: (err: any, data?: XmlNamespacesCommandOutput) => void + ): Promise | void { + const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + */ + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), + cb?: (err: any, data?: XmlTimestampsCommandOutput) => void + ): Promise | void { + const command = new XmlTimestampsCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts b/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts new file mode 100644 index 000000000000..11b2e19a4359 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts @@ -0,0 +1,325 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "./commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "./commands/IgnoresWrappingXmlNameCommand"; +import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "./commands/NestedStructuresCommand"; +import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; +import { QueryMapsCommandInput, QueryMapsCommandOutput } from "./commands/QueryMapsCommand"; +import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "./commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "./commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "./commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "./commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "./commands/XmlEmptyMapsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | EmptyInputAndEmptyOutputCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | FlattenedXmlMapCommandInput + | FlattenedXmlMapWithXmlNameCommandInput + | FlattenedXmlMapWithXmlNamespaceCommandInput + | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput + | IgnoresWrappingXmlNameCommandInput + | NestedStructuresCommandInput + | NoInputAndNoOutputCommandInput + | NoInputAndOutputCommandInput + | QueryIdempotencyTokenAutoFillCommandInput + | QueryListsCommandInput + | QueryMapsCommandInput + | QueryTimestampsCommandInput + | RecursiveXmlShapesCommandInput + | SimpleInputParamsCommandInput + | SimpleScalarXmlPropertiesCommandInput + | XmlBlobsCommandInput + | XmlEmptyBlobsCommandInput + | XmlEmptyListsCommandInput + | XmlEmptyMapsCommandInput + | XmlEnumsCommandInput + | XmlListsCommandInput + | XmlMapsCommandInput + | XmlMapsXmlNameCommandInput + | XmlNamespacesCommandInput + | XmlTimestampsCommandInput; + +export type ServiceOutputTypes = + | EmptyInputAndEmptyOutputCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | FlattenedXmlMapCommandOutput + | FlattenedXmlMapWithXmlNameCommandOutput + | FlattenedXmlMapWithXmlNamespaceCommandOutput + | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput + | IgnoresWrappingXmlNameCommandOutput + | NestedStructuresCommandOutput + | NoInputAndNoOutputCommandOutput + | NoInputAndOutputCommandOutput + | QueryIdempotencyTokenAutoFillCommandOutput + | QueryListsCommandOutput + | QueryMapsCommandOutput + | QueryTimestampsCommandOutput + | RecursiveXmlShapesCommandOutput + | SimpleInputParamsCommandOutput + | SimpleScalarXmlPropertiesCommandOutput + | XmlBlobsCommandOutput + | XmlEmptyBlobsCommandOutput + | XmlEmptyListsCommandOutput + | XmlEmptyMapsCommandOutput + | XmlEnumsCommandOutput + | XmlListsCommandOutput + | XmlMapsCommandOutput + | XmlMapsXmlNameCommandOutput + | XmlNamespacesCommandOutput + | XmlTimestampsCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type QueryProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of QueryProtocolClient class constructor that set the region, credentials and other options. + */ +export interface QueryProtocolClientConfig extends QueryProtocolClientConfigType {} + +type QueryProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of QueryProtocolClient class. This is resolved and normalized from the {@link QueryProtocolClientConfig | constructor configuration interface}. + */ +export interface QueryProtocolClientResolvedConfig extends QueryProtocolClientResolvedConfigType {} + +/** + * A query service that sends query requests and XML responses. + */ +export class QueryProtocolClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + QueryProtocolClientResolvedConfig +> { + /** + * The resolved configuration of QueryProtocolClient class. This is resolved and normalized from the {@link QueryProtocolClientConfig | constructor configuration interface}. + */ + readonly config: QueryProtocolClientResolvedConfig; + + constructor(configuration: QueryProtocolClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveUserAgentConfig(_config_4); + super(_config_5); + this.config = _config_5; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts new file mode 100644 index 000000000000..318ef58f52b1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts @@ -0,0 +1,98 @@ +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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; +import { + deserializeAws_queryEmptyInputAndEmptyOutputCommand, + serializeAws_queryEmptyInputAndEmptyOutputCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} +export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response members. + * + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new EmptyInputAndEmptyOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. + * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class EmptyInputAndEmptyOutputCommand extends $Command< + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { + // 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 = "EmptyInputAndEmptyOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryEmptyInputAndEmptyOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryEmptyInputAndEmptyOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..4d9f54896c6c --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.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_queryEndpointOperationCommand, + serializeAws_queryEndpointOperationCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // 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 = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryEndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryEndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..030394c78fdc --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.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 { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_queryEndpointWithHostLabelOperationCommand, + serializeAws_queryEndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // 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 = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_queryEndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_queryEndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts new file mode 100644 index 000000000000..8c92b8f8d673 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts @@ -0,0 +1,95 @@ +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 { FlattenedXmlMapOutput } from "../models/models_0"; +import { + deserializeAws_queryFlattenedXmlMapCommand, + serializeAws_queryFlattenedXmlMapCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface FlattenedXmlMapCommandInput {} +export interface FlattenedXmlMapCommandOutput extends FlattenedXmlMapOutput, __MetadataBearer {} + +/** + * Flattened maps + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, FlattenedXmlMapCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, FlattenedXmlMapCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new FlattenedXmlMapCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapCommand extends $Command< + FlattenedXmlMapCommandInput, + FlattenedXmlMapCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapCommandInput) { + // 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 = "FlattenedXmlMapCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: FlattenedXmlMapOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: FlattenedXmlMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryFlattenedXmlMapCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryFlattenedXmlMapCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts new file mode 100644 index 000000000000..7abf3e130d74 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts @@ -0,0 +1,98 @@ +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 { FlattenedXmlMapWithXmlNameOutput } from "../models/models_0"; +import { + deserializeAws_queryFlattenedXmlMapWithXmlNameCommand, + serializeAws_queryFlattenedXmlMapWithXmlNameCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface FlattenedXmlMapWithXmlNameCommandInput {} +export interface FlattenedXmlMapWithXmlNameCommandOutput extends FlattenedXmlMapWithXmlNameOutput, __MetadataBearer {} + +/** + * Flattened maps with @xmlName + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, FlattenedXmlMapWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, FlattenedXmlMapWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new FlattenedXmlMapWithXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapWithXmlNameCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapWithXmlNameCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapWithXmlNameCommand extends $Command< + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapWithXmlNameCommandInput) { + // 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 = "FlattenedXmlMapWithXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: FlattenedXmlMapWithXmlNameOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: FlattenedXmlMapWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryFlattenedXmlMapWithXmlNameCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_queryFlattenedXmlMapWithXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts new file mode 100644 index 000000000000..2d84a8bfd6e9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts @@ -0,0 +1,103 @@ +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 { FlattenedXmlMapWithXmlNamespaceOutput } from "../models/models_0"; +import { + deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand, + serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface FlattenedXmlMapWithXmlNamespaceCommandInput {} +export interface FlattenedXmlMapWithXmlNamespaceCommandOutput + extends FlattenedXmlMapWithXmlNamespaceOutput, + __MetadataBearer {} + +/** + * Flattened maps with @xmlNamespace and @xmlName + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new FlattenedXmlMapWithXmlNamespaceCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapWithXmlNamespaceCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapWithXmlNamespaceCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapWithXmlNamespaceCommand extends $Command< + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapWithXmlNamespaceCommandInput) { + // 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 = "FlattenedXmlMapWithXmlNamespaceCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: FlattenedXmlMapWithXmlNamespaceOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: FlattenedXmlMapWithXmlNamespaceCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..de2403c59feb --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,99 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_queryGreetingWithErrorsCommand, + serializeAws_queryGreetingWithErrorsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // 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 = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryGreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryGreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..b6ba334dc844 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts new file mode 100644 index 000000000000..a40c05d358f4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts @@ -0,0 +1,98 @@ +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 { IgnoresWrappingXmlNameOutput } from "../models/models_0"; +import { + deserializeAws_queryIgnoresWrappingXmlNameCommand, + serializeAws_queryIgnoresWrappingXmlNameCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface IgnoresWrappingXmlNameCommandInput {} +export interface IgnoresWrappingXmlNameCommandOutput extends IgnoresWrappingXmlNameOutput, __MetadataBearer {} + +/** + * The xmlName trait on the output structure is ignored in AWS Query. + * + * The wrapping element is always operation name + "Response", and + * inside of that wrapper is another wrapper named operation name + "Result". + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, IgnoresWrappingXmlNameCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, IgnoresWrappingXmlNameCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new IgnoresWrappingXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link IgnoresWrappingXmlNameCommandInput} for command's `input` shape. + * @see {@link IgnoresWrappingXmlNameCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class IgnoresWrappingXmlNameCommand extends $Command< + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: IgnoresWrappingXmlNameCommandInput) { + // 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 = "IgnoresWrappingXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: IgnoresWrappingXmlNameOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryIgnoresWrappingXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryIgnoresWrappingXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts new file mode 100644 index 000000000000..ed48c8d719c5 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts @@ -0,0 +1,95 @@ +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 { NestedStructuresInput } from "../models/models_0"; +import { + deserializeAws_queryNestedStructuresCommand, + serializeAws_queryNestedStructuresCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface NestedStructuresCommandInput extends NestedStructuresInput {} +export interface NestedStructuresCommandOutput extends __MetadataBearer {} + +/** + * This test serializes nested and recursive structure members. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, NestedStructuresCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, NestedStructuresCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new NestedStructuresCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NestedStructuresCommandInput} for command's `input` shape. + * @see {@link NestedStructuresCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NestedStructuresCommand extends $Command< + NestedStructuresCommandInput, + NestedStructuresCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NestedStructuresCommandInput) { + // 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 = "NestedStructuresCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NestedStructuresInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NestedStructuresCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryNestedStructuresCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryNestedStructuresCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts new file mode 100644 index 000000000000..884284d841d0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts @@ -0,0 +1,97 @@ +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_queryNoInputAndNoOutputCommand, + serializeAws_queryNoInputAndNoOutputCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface NoInputAndNoOutputCommandInput {} +export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new NoInputAndNoOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndNoOutputCommand extends $Command< + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndNoOutputCommandInput) { + // 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 = "NoInputAndNoOutputCommand"; + 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryNoInputAndNoOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryNoInputAndNoOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts new file mode 100644 index 000000000000..3b00c2f101ac --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts @@ -0,0 +1,98 @@ +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 { NoInputAndOutputOutput } from "../models/models_0"; +import { + deserializeAws_queryNoInputAndOutputCommand, + serializeAws_queryNoInputAndOutputCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface NoInputAndOutputCommandInput extends NoInputAndOutputOutput {} +export interface NoInputAndOutputCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request payload or response members. + * + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new NoInputAndOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndOutputCommand extends $Command< + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndOutputCommandInput) { + // 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 = "NoInputAndOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryNoInputAndOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryNoInputAndOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts new file mode 100644 index 000000000000..514ab9a87df4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts @@ -0,0 +1,98 @@ +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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; +import { + deserializeAws_queryQueryIdempotencyTokenAutoFillCommand, + serializeAws_queryQueryIdempotencyTokenAutoFillCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} +export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} + +/** + * Automatically adds idempotency tokens. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new QueryIdempotencyTokenAutoFillCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. + * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryIdempotencyTokenAutoFillCommand extends $Command< + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { + // 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 = "QueryIdempotencyTokenAutoFillCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryQueryIdempotencyTokenAutoFillCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_queryQueryIdempotencyTokenAutoFillCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts new file mode 100644 index 000000000000..241e04c0fc53 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts @@ -0,0 +1,92 @@ +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 { QueryListsInput } from "../models/models_0"; +import { deserializeAws_queryQueryListsCommand, serializeAws_queryQueryListsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface QueryListsCommandInput extends QueryListsInput {} +export interface QueryListsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes simple and complex lists. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, QueryListsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, QueryListsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new QueryListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryListsCommandInput} for command's `input` shape. + * @see {@link QueryListsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryListsCommand extends $Command< + QueryListsCommandInput, + QueryListsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryListsCommandInput) { + // 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 = "QueryListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryListsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryQueryListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryQueryListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts new file mode 100644 index 000000000000..c4a9a70bc505 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts @@ -0,0 +1,92 @@ +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 { QueryMapsInput } from "../models/models_0"; +import { deserializeAws_queryQueryMapsCommand, serializeAws_queryQueryMapsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface QueryMapsCommandInput extends QueryMapsInput {} +export interface QueryMapsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes simple and complex maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, QueryMapsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, QueryMapsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new QueryMapsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryMapsCommandInput} for command's `input` shape. + * @see {@link QueryMapsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryMapsCommand extends $Command< + QueryMapsCommandInput, + QueryMapsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryMapsCommandInput) { + // 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 = "QueryMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryMapsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryQueryMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryQueryMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts new file mode 100644 index 000000000000..21e5be71a42f --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts @@ -0,0 +1,99 @@ +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 { QueryTimestampsInput } from "../models/models_0"; +import { + deserializeAws_queryQueryTimestampsCommand, + serializeAws_queryQueryTimestampsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface QueryTimestampsCommandInput extends QueryTimestampsInput {} +export interface QueryTimestampsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes timestamps. + * + * 1. Timestamps are serialized as RFC 3339 date-time values by default. + * 2. A timestampFormat trait on a member changes the format. + * 3. A timestampFormat trait on the shape targeted by the member changes the format. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, QueryTimestampsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, QueryTimestampsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new QueryTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryTimestampsCommandInput} for command's `input` shape. + * @see {@link QueryTimestampsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryTimestampsCommand extends $Command< + QueryTimestampsCommandInput, + QueryTimestampsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryTimestampsCommandInput) { + // 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 = "QueryTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryTimestampsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryQueryTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryQueryTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts new file mode 100644 index 000000000000..f51e9a6f695a --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts @@ -0,0 +1,95 @@ +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 { RecursiveXmlShapesOutput } from "../models/models_0"; +import { + deserializeAws_queryRecursiveXmlShapesCommand, + serializeAws_queryRecursiveXmlShapesCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface RecursiveXmlShapesCommandInput {} +export interface RecursiveXmlShapesCommandOutput extends RecursiveXmlShapesOutput, __MetadataBearer {} + +/** + * Recursive shapes + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, RecursiveXmlShapesCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, RecursiveXmlShapesCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new RecursiveXmlShapesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link RecursiveXmlShapesCommandInput} for command's `input` shape. + * @see {@link RecursiveXmlShapesCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class RecursiveXmlShapesCommand extends $Command< + RecursiveXmlShapesCommandInput, + RecursiveXmlShapesCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: RecursiveXmlShapesCommandInput) { + // 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 = "RecursiveXmlShapesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: RecursiveXmlShapesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: RecursiveXmlShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryRecursiveXmlShapesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryRecursiveXmlShapesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts new file mode 100644 index 000000000000..4d2c4627b52b --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts @@ -0,0 +1,95 @@ +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 { SimpleInputParamsInput } from "../models/models_0"; +import { + deserializeAws_querySimpleInputParamsCommand, + serializeAws_querySimpleInputParamsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface SimpleInputParamsCommandInput extends SimpleInputParamsInput {} +export interface SimpleInputParamsCommandOutput extends __MetadataBearer {} + +/** + * This test serializes strings, numbers, and boolean values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, SimpleInputParamsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, SimpleInputParamsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new SimpleInputParamsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link SimpleInputParamsCommandInput} for command's `input` shape. + * @see {@link SimpleInputParamsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class SimpleInputParamsCommand extends $Command< + SimpleInputParamsCommandInput, + SimpleInputParamsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleInputParamsCommandInput) { + // 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 = "SimpleInputParamsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleInputParamsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleInputParamsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_querySimpleInputParamsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_querySimpleInputParamsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts new file mode 100644 index 000000000000..8d1966a21a97 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.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 { SimpleScalarXmlPropertiesOutput } from "../models/models_0"; +import { + deserializeAws_querySimpleScalarXmlPropertiesCommand, + serializeAws_querySimpleScalarXmlPropertiesCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface SimpleScalarXmlPropertiesCommandInput {} +export interface SimpleScalarXmlPropertiesCommandOutput extends SimpleScalarXmlPropertiesOutput, __MetadataBearer {} + +export class SimpleScalarXmlPropertiesCommand extends $Command< + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarXmlPropertiesCommandInput) { + // 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 = "SimpleScalarXmlPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: SimpleScalarXmlPropertiesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarXmlPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_querySimpleScalarXmlPropertiesCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_querySimpleScalarXmlPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts new file mode 100644 index 000000000000..14b27bf2f7c3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlBlobsOutput } from "../models/models_0"; +import { deserializeAws_queryXmlBlobsCommand, serializeAws_queryXmlBlobsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlBlobsCommandInput {} +export interface XmlBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} + +/** + * Blobs are base64 encoded + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new XmlBlobsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlBlobsCommandInput} for command's `input` shape. + * @see {@link XmlBlobsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlBlobsCommand extends $Command< + XmlBlobsCommandInput, + XmlBlobsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlBlobsCommandInput) { + // 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 = "XmlBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts new file mode 100644 index 000000000000..eee1a33137e2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.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 { XmlBlobsOutput } from "../models/models_0"; +import { + deserializeAws_queryXmlEmptyBlobsCommand, + serializeAws_queryXmlEmptyBlobsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlEmptyBlobsCommandInput {} +export interface XmlEmptyBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} + +export class XmlEmptyBlobsCommand extends $Command< + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyBlobsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + 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 = "XmlEmptyBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlEmptyBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlEmptyBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts new file mode 100644 index 000000000000..2890e1985ffa --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.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 { XmlListsOutput } from "../models/models_0"; +import { + deserializeAws_queryXmlEmptyListsCommand, + serializeAws_queryXmlEmptyListsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlEmptyListsCommandInput {} +export interface XmlEmptyListsCommandOutput extends XmlListsOutput, __MetadataBearer {} + +export class XmlEmptyListsCommand extends $Command< + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyListsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + 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 = "XmlEmptyListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlEmptyListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlEmptyListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts new file mode 100644 index 000000000000..3cd053ab9a7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts @@ -0,0 +1,75 @@ +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 { XmlMapsOutput } from "../models/models_0"; +import { deserializeAws_queryXmlEmptyMapsCommand, serializeAws_queryXmlEmptyMapsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlEmptyMapsCommandInput {} +export interface XmlEmptyMapsCommandOutput extends XmlMapsOutput, __MetadataBearer {} + +export class XmlEmptyMapsCommand extends $Command< + XmlEmptyMapsCommandInput, + XmlEmptyMapsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyMapsCommandInput) { + // 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 = "XmlEmptyMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlMapsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlEmptyMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlEmptyMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts new file mode 100644 index 000000000000..ede4f701b44f --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlEnumsOutput } from "../models/models_0"; +import { deserializeAws_queryXmlEnumsCommand, serializeAws_queryXmlEnumsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlEnumsCommandInput {} +export interface XmlEnumsCommandOutput extends XmlEnumsOutput, __MetadataBearer {} + +/** + * This example serializes enums as top level properties, in lists, sets, and maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new XmlEnumsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlEnumsCommandInput} for command's `input` shape. + * @see {@link XmlEnumsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlEnumsCommand extends $Command< + XmlEnumsCommandInput, + XmlEnumsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEnumsCommandInput) { + // 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 = "XmlEnumsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlEnumsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlEnumsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlEnumsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts new file mode 100644 index 000000000000..6f9dbebbb9fc --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts @@ -0,0 +1,101 @@ +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 { XmlListsOutput } from "../models/models_0"; +import { deserializeAws_queryXmlListsCommand, serializeAws_queryXmlListsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlListsCommandInput {} +export interface XmlListsCommandOutput extends XmlListsOutput, __MetadataBearer {} + +/** + * This test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Lists of structures. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new XmlListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlListsCommandInput} for command's `input` shape. + * @see {@link XmlListsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlListsCommand extends $Command< + XmlListsCommandInput, + XmlListsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlListsCommandInput) { + // 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 = "XmlListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts new file mode 100644 index 000000000000..85b53d29fdb6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlMapsOutput } from "../models/models_0"; +import { deserializeAws_queryXmlMapsCommand, serializeAws_queryXmlMapsCommand } from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlMapsCommandInput {} +export interface XmlMapsCommandOutput extends XmlMapsOutput, __MetadataBearer {} + +/** + * The example tests basic map serialization. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, XmlMapsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, XmlMapsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new XmlMapsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlMapsCommandInput} for command's `input` shape. + * @see {@link XmlMapsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlMapsCommand extends $Command< + XmlMapsCommandInput, + XmlMapsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlMapsCommandInput) { + // 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 = "XmlMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlMapsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts new file mode 100644 index 000000000000..d3e38231e644 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.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 { XmlMapsXmlNameOutput } from "../models/models_0"; +import { + deserializeAws_queryXmlMapsXmlNameCommand, + serializeAws_queryXmlMapsXmlNameCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlMapsXmlNameCommandInput {} +export interface XmlMapsXmlNameCommandOutput extends XmlMapsXmlNameOutput, __MetadataBearer {} + +export class XmlMapsXmlNameCommand extends $Command< + XmlMapsXmlNameCommandInput, + XmlMapsXmlNameCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlMapsXmlNameCommandInput) { + // 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 = "XmlMapsXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlMapsXmlNameOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlMapsXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlMapsXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlMapsXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts new file mode 100644 index 000000000000..06f63165061d --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.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 { XmlNamespacesOutput } from "../models/models_0"; +import { + deserializeAws_queryXmlNamespacesCommand, + serializeAws_queryXmlNamespacesCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlNamespacesCommandInput {} +export interface XmlNamespacesCommandOutput extends XmlNamespacesOutput, __MetadataBearer {} + +export class XmlNamespacesCommand extends $Command< + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlNamespacesCommandInput) { + // 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 = "XmlNamespacesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlNamespacesOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlNamespacesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlNamespacesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts new file mode 100644 index 000000000000..f293cfddf10e --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts @@ -0,0 +1,97 @@ +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 { XmlTimestampsOutput } from "../models/models_0"; +import { + deserializeAws_queryXmlTimestampsCommand, + serializeAws_queryXmlTimestampsCommand, +} from "../protocols/Aws_query"; +import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; + +export interface XmlTimestampsCommandInput {} +export interface XmlTimestampsCommandOutput extends XmlTimestampsOutput, __MetadataBearer {} + +/** + * This tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { QueryProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import + * // const { QueryProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import + * const client = new QueryProtocolClient(config); + * const command = new XmlTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlTimestampsCommandInput} for command's `input` shape. + * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. + * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlTimestampsCommand extends $Command< + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, + QueryProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlTimestampsCommandInput) { + // 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 = "XmlTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: XmlTimestampsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_queryXmlTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_queryXmlTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/index.ts b/protocol_tests/aws-protocoltests-query/src/commands/index.ts new file mode 100644 index 000000000000..921e253cbe25 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/commands/index.ts @@ -0,0 +1,29 @@ +export * from "./EmptyInputAndEmptyOutputCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./FlattenedXmlMapCommand"; +export * from "./FlattenedXmlMapWithXmlNameCommand"; +export * from "./FlattenedXmlMapWithXmlNamespaceCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HostWithPathOperationCommand"; +export * from "./IgnoresWrappingXmlNameCommand"; +export * from "./NestedStructuresCommand"; +export * from "./NoInputAndNoOutputCommand"; +export * from "./NoInputAndOutputCommand"; +export * from "./QueryIdempotencyTokenAutoFillCommand"; +export * from "./QueryListsCommand"; +export * from "./QueryMapsCommand"; +export * from "./QueryTimestampsCommand"; +export * from "./RecursiveXmlShapesCommand"; +export * from "./SimpleInputParamsCommand"; +export * from "./SimpleScalarXmlPropertiesCommand"; +export * from "./XmlBlobsCommand"; +export * from "./XmlEmptyBlobsCommand"; +export * from "./XmlEmptyListsCommand"; +export * from "./XmlEmptyMapsCommand"; +export * from "./XmlEnumsCommand"; +export * from "./XmlListsCommand"; +export * from "./XmlMapsCommand"; +export * from "./XmlMapsXmlNameCommand"; +export * from "./XmlNamespacesCommand"; +export * from "./XmlTimestampsCommand"; diff --git a/protocol_tests/aws-protocoltests-query/src/endpoints.ts b/protocol_tests/aws-protocoltests-query/src/endpoints.ts new file mode 100644 index 000000000000..fff1593194be --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "awsquery.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "awsquery.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "awsquery.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "awsquery.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "awsquery.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "awsquery", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-query/src/index.ts b/protocol_tests/aws-protocoltests-query/src/index.ts new file mode 100644 index 000000000000..ec389347c03b --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/index.ts @@ -0,0 +1,4 @@ +export * from "./QueryProtocol"; +export * from "./QueryProtocolClient"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-query/src/models/index.ts b/protocol_tests/aws-protocoltests-query/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-query/src/models/models_0.ts b/protocol_tests/aws-protocoltests-query/src/models/models_0.ts new file mode 100644 index 000000000000..516dade9b080 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/models/models_0.ts @@ -0,0 +1,544 @@ +import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputOutput {} + +export namespace EmptyInputAndEmptyOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface FlattenedXmlMapOutput { + myMap?: { [key: string]: FooEnum | string }; +} + +export namespace FlattenedXmlMapOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapOutput): any => ({ + ...obj, + }); +} + +export interface FlattenedXmlMapWithXmlNameOutput { + myMap?: { [key: string]: string }; +} + +export namespace FlattenedXmlMapWithXmlNameOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNameOutput): any => ({ + ...obj, + }); +} + +export interface FlattenedXmlMapWithXmlNamespaceOutput { + myMap?: { [key: string]: string }; +} + +export namespace FlattenedXmlMapWithXmlNamespaceOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNamespaceOutput): any => ({ + ...obj, + }); +} + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface CustomCodeError extends __SmithyException, $MetadataBearer { + name: "CustomCodeError"; + $fault: "client"; + Message?: string; +} + +export namespace CustomCodeError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: CustomCodeError): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export interface IgnoresWrappingXmlNameOutput { + foo?: string; +} + +export namespace IgnoresWrappingXmlNameOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: IgnoresWrappingXmlNameOutput): any => ({ + ...obj, + }); +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); +} + +export interface QueryIdempotencyTokenAutoFillInput { + token?: string; +} + +export namespace QueryIdempotencyTokenAutoFillInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ + ...obj, + }); +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +export interface NestedStructWithList { + ListArg?: string[]; +} + +export namespace NestedStructWithList { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedStructWithList): any => ({ + ...obj, + }); +} + +export interface QueryListsInput { + ListArg?: string[]; + ComplexListArg?: GreetingStruct[]; + FlattenedListArg?: string[]; + ListArgWithXmlNameMember?: string[]; + FlattenedListArgWithXmlName?: string[]; + NestedWithList?: NestedStructWithList; +} + +export namespace QueryListsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryListsInput): any => ({ + ...obj, + }); +} + +export interface NestedStructWithMap { + MapArg?: { [key: string]: string }; +} + +export namespace NestedStructWithMap { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedStructWithMap): any => ({ + ...obj, + }); +} + +export interface QueryMapsInput { + MapArg?: { [key: string]: string }; + RenamedMapArg?: { [key: string]: string }; + ComplexMapArg?: { [key: string]: GreetingStruct }; + MapWithXmlMemberName?: { [key: string]: string }; + FlattenedMap?: { [key: string]: string }; + FlattenedMapWithXmlName?: { [key: string]: string }; + MapOfLists?: { [key: string]: string[] }; + NestedStructWithMap?: NestedStructWithMap; +} + +export namespace QueryMapsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryMapsInput): any => ({ + ...obj, + }); +} + +export interface QueryTimestampsInput { + normalFormat?: Date; + epochMember?: Date; + epochTarget?: Date; +} + +export namespace QueryTimestampsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryTimestampsInput): any => ({ + ...obj, + }); +} + +export interface SimpleInputParamsInput { + Foo?: string; + Bar?: string; + Baz?: boolean; + Bam?: number; + FloatValue?: number; + Boo?: number; + Qux?: Uint8Array; + FooEnum?: FooEnum | string; +} + +export namespace SimpleInputParamsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleInputParamsInput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarXmlPropertiesOutput { + stringValue?: string; + emptyStringValue?: string; + trueBooleanValue?: boolean; + falseBooleanValue?: boolean; + byteValue?: number; + shortValue?: number; + integerValue?: number; + longValue?: number; + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarXmlPropertiesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarXmlPropertiesOutput): any => ({ + ...obj, + }); +} + +export interface XmlBlobsOutput { + data?: Uint8Array; +} + +export namespace XmlBlobsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlBlobsOutput): any => ({ + ...obj, + }); +} + +export interface StructureListMember { + a?: string; + b?: string; +} + +export namespace StructureListMember { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructureListMember): any => ({ + ...obj, + }); +} + +export interface XmlListsOutput { + stringList?: string[]; + stringSet?: string[]; + integerList?: number[]; + booleanList?: boolean[]; + timestampList?: Date[]; + enumList?: (FooEnum | string)[]; + /** + * A list of lists of strings. + */ + nestedStringList?: string[][]; + + renamedListMembers?: string[]; + flattenedList?: string[]; + flattenedList2?: string[]; + flattenedListWithMemberNamespace?: string[]; + flattenedListWithNamespace?: string[]; + structureList?: StructureListMember[]; +} + +export namespace XmlListsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlListsOutput): any => ({ + ...obj, + }); +} + +export interface XmlMapsOutput { + myMap?: { [key: string]: GreetingStruct }; +} + +export namespace XmlMapsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlMapsOutput): any => ({ + ...obj, + }); +} + +export interface XmlEnumsOutput { + fooEnum1?: FooEnum | string; + fooEnum2?: FooEnum | string; + fooEnum3?: FooEnum | string; + fooEnumList?: (FooEnum | string)[]; + fooEnumSet?: (FooEnum | string)[]; + fooEnumMap?: { [key: string]: FooEnum | string }; +} + +export namespace XmlEnumsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({ + ...obj, + }); +} + +export interface XmlMapsXmlNameOutput { + myMap?: { [key: string]: GreetingStruct }; +} + +export namespace XmlMapsXmlNameOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlMapsXmlNameOutput): any => ({ + ...obj, + }); +} + +export interface XmlNamespaceNested { + foo?: string; + values?: string[]; +} + +export namespace XmlNamespaceNested { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ + ...obj, + }); +} + +export interface XmlNamespacesOutput { + nested?: XmlNamespaceNested; +} + +export namespace XmlNamespacesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespacesOutput): any => ({ + ...obj, + }); +} + +export interface XmlTimestampsOutput { + normal?: Date; + dateTime?: Date; + epochSeconds?: Date; + httpDate?: Date; +} + +export namespace XmlTimestampsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlTimestampsOutput): any => ({ + ...obj, + }); +} + +export interface StructArg { + StringArg?: string; + OtherArg?: boolean; + RecursiveArg?: StructArg; +} + +export namespace StructArg { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructArg): any => ({ + ...obj, + }); +} + +export interface NestedStructuresInput { + Nested?: StructArg; +} + +export namespace NestedStructuresInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedStructuresInput): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutputNested1 { + foo?: string; + nested?: RecursiveXmlShapesOutputNested2; +} + +export namespace RecursiveXmlShapesOutputNested1 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested1): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutputNested2 { + bar?: string; + recursiveMember?: RecursiveXmlShapesOutputNested1; +} + +export namespace RecursiveXmlShapesOutputNested2 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested2): any => ({ + ...obj, + }); +} + +export interface RecursiveXmlShapesOutput { + nested?: RecursiveXmlShapesOutputNested1; +} + +export namespace RecursiveXmlShapesOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveXmlShapesOutput): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts b/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts new file mode 100644 index 000000000000..55162a910471 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts @@ -0,0 +1,3103 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + expectNonNull as __expectNonNull, + expectString as __expectString, + extendedEncodeURIComponent as __extendedEncodeURIComponent, + getArrayIfSingleItem as __getArrayIfSingleItem, + getValueFromTextNode as __getValueFromTextNode, + parseBoolean as __parseBoolean, + parseEpochTimestamp as __parseEpochTimestamp, + parseRfc3339DateTime as __parseRfc3339DateTime, + parseRfc7231DateTime as __parseRfc7231DateTime, + serializeFloat as __serializeFloat, + strictParseByte as __strictParseByte, + strictParseFloat as __strictParseFloat, + strictParseInt32 as __strictParseInt32, + strictParseLong as __strictParseLong, + strictParseShort as __strictParseShort, +} from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + HeaderBag as __HeaderBag, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { decodeHTML } from "entities"; +import { parse as xmlParse } from "fast-xml-parser"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "../commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "../commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "../commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "../commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "../commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; +import { + IgnoresWrappingXmlNameCommandInput, + IgnoresWrappingXmlNameCommandOutput, +} from "../commands/IgnoresWrappingXmlNameCommand"; +import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "../commands/NestedStructuresCommand"; +import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "../commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommandInput, QueryListsCommandOutput } from "../commands/QueryListsCommand"; +import { QueryMapsCommandInput, QueryMapsCommandOutput } from "../commands/QueryMapsCommand"; +import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "../commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "../commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "../commands/SimpleInputParamsCommand"; +import { + SimpleScalarXmlPropertiesCommandInput, + SimpleScalarXmlPropertiesCommandOutput, +} from "../commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "../commands/XmlEmptyMapsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; +import { XmlMapsCommandInput, XmlMapsCommandOutput } from "../commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "../commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; +import { + ComplexError, + ComplexNestedErrorData, + CustomCodeError, + EmptyInputAndEmptyOutputInput, + EmptyInputAndEmptyOutputOutput, + FlattenedXmlMapOutput, + FlattenedXmlMapWithXmlNameOutput, + FlattenedXmlMapWithXmlNamespaceOutput, + FooEnum, + GreetingStruct, + GreetingWithErrorsOutput, + HostLabelInput, + IgnoresWrappingXmlNameOutput, + InvalidGreeting, + NestedStructuresInput, + NestedStructWithList, + NestedStructWithMap, + NoInputAndOutputOutput, + QueryIdempotencyTokenAutoFillInput, + QueryListsInput, + QueryMapsInput, + QueryTimestampsInput, + RecursiveXmlShapesOutput, + RecursiveXmlShapesOutputNested1, + RecursiveXmlShapesOutputNested2, + SimpleInputParamsInput, + SimpleScalarXmlPropertiesOutput, + StructArg, + StructureListMember, + XmlBlobsOutput, + XmlEnumsOutput, + XmlListsOutput, + XmlMapsOutput, + XmlMapsXmlNameOutput, + XmlNamespaceNested, + XmlNamespacesOutput, + XmlTimestampsOutput, +} from "../models/models_0"; + +export const serializeAws_queryEmptyInputAndEmptyOutputCommand = async ( + input: EmptyInputAndEmptyOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryEmptyInputAndEmptyOutputInput(input, context), + Action: "EmptyInputAndEmptyOutput", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryEndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "EndpointOperation", + Version: "2020-01-08", + }); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_queryEndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryHostLabelInput(input, context), + Action: "EndpointWithHostLabelOperation", + Version: "2020-01-08", + }); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); +}; + +export const serializeAws_queryFlattenedXmlMapCommand = async ( + input: FlattenedXmlMapCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "FlattenedXmlMap", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryFlattenedXmlMapWithXmlNameCommand = async ( + input: FlattenedXmlMapWithXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "FlattenedXmlMapWithXmlName", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand = async ( + input: FlattenedXmlMapWithXmlNamespaceCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "FlattenedXmlMapWithXmlNamespace", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryGreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "GreetingWithErrors", + Version: "2020-01-08", + }); + 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 +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "IgnoresWrappingXmlName", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryNestedStructuresCommand = async ( + input: NestedStructuresCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryNestedStructuresInput(input, context), + Action: "NestedStructures", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryNoInputAndNoOutputCommand = async ( + input: NoInputAndNoOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "NoInputAndNoOutput", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryNoInputAndOutputCommand = async ( + input: NoInputAndOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryNoInputAndOutputOutput(input, context), + Action: "NoInputAndOutput", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryQueryIdempotencyTokenAutoFillCommand = async ( + input: QueryIdempotencyTokenAutoFillCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryQueryIdempotencyTokenAutoFillInput(input, context), + Action: "QueryIdempotencyTokenAutoFill", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryQueryListsCommand = async ( + input: QueryListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryQueryListsInput(input, context), + Action: "QueryLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryQueryMapsCommand = async ( + input: QueryMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryQueryMapsInput(input, context), + Action: "QueryMaps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryQueryTimestampsCommand = async ( + input: QueryTimestampsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_queryQueryTimestampsInput(input, context), + Action: "QueryTimestamps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryRecursiveXmlShapesCommand = async ( + input: RecursiveXmlShapesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "RecursiveXmlShapes", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_querySimpleInputParamsCommand = async ( + input: SimpleInputParamsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + let body: any; + body = buildFormUrlencodedString({ + ...serializeAws_querySimpleInputParamsInput(input, context), + Action: "SimpleInputParams", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_querySimpleScalarXmlPropertiesCommand = async ( + input: SimpleScalarXmlPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "SimpleScalarXmlProperties", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlBlobsCommand = async ( + input: XmlBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlBlobs", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlEmptyBlobsCommand = async ( + input: XmlEmptyBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEmptyBlobs", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlEmptyListsCommand = async ( + input: XmlEmptyListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEmptyLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlEmptyMapsCommand = async ( + input: XmlEmptyMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEmptyMaps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlEnumsCommand = async ( + input: XmlEnumsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlEnums", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlListsCommand = async ( + input: XmlListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlLists", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlMapsCommand = async ( + input: XmlMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlMaps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlMapsXmlNameCommand = async ( + input: XmlMapsXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlMapsXmlName", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlNamespacesCommand = async ( + input: XmlNamespacesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlNamespaces", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const serializeAws_queryXmlTimestampsCommand = async ( + input: XmlTimestampsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-www-form-urlencoded", + }; + const body = buildFormUrlencodedString({ + Action: "XmlTimestamps", + Version: "2020-01-08", + }); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + +export const deserializeAws_queryEmptyInputAndEmptyOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryEmptyInputAndEmptyOutputCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryEmptyInputAndEmptyOutputOutput(data.EmptyInputAndEmptyOutputResult, context); + const response: EmptyInputAndEmptyOutputCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryEmptyInputAndEmptyOutputCommandError = 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_queryEndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryEndpointOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryEndpointOperationCommandError = 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_queryEndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryEndpointWithHostLabelOperationCommandError(output, context); + } + await collectBody(output.body, context); + const response: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryEndpointWithHostLabelOperationCommandError = 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_queryFlattenedXmlMapCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryFlattenedXmlMapCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryFlattenedXmlMapOutput(data.FlattenedXmlMapResult, context); + const response: FlattenedXmlMapCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryFlattenedXmlMapCommandError = 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_queryFlattenedXmlMapWithXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryFlattenedXmlMapWithXmlNameCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryFlattenedXmlMapWithXmlNameOutput(data.FlattenedXmlMapWithXmlNameResult, context); + const response: FlattenedXmlMapWithXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNameCommandError = 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_queryFlattenedXmlMapWithXmlNamespaceCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutput( + data.FlattenedXmlMapWithXmlNamespaceResult, + context + ); + const response: FlattenedXmlMapWithXmlNamespaceCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommandError = 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_queryGreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryGreetingWithErrorsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryGreetingWithErrorsOutput(data.GreetingWithErrorsResult, context); + const response: GreetingWithErrorsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryGreetingWithErrorsCommandError = 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) { + case "ComplexError": + case "aws.protocoltests.query#ComplexError": + response = { + ...(await deserializeAws_queryComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "CustomCodeError": + case "aws.protocoltests.query#CustomCodeError": + response = { + ...(await deserializeAws_queryCustomCodeErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.query#InvalidGreeting": + response = { + ...(await deserializeAws_queryInvalidGreetingResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + 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_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 +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryIgnoresWrappingXmlNameCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryIgnoresWrappingXmlNameOutput(data.IgnoresWrappingXmlNameResult, context); + const response: IgnoresWrappingXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryIgnoresWrappingXmlNameCommandError = 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_queryNestedStructuresCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryNestedStructuresCommandError(output, context); + } + await collectBody(output.body, context); + const response: NestedStructuresCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryNestedStructuresCommandError = 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_queryNoInputAndNoOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryNoInputAndNoOutputCommandError(output, context); + } + await collectBody(output.body, context); + const response: NoInputAndNoOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryNoInputAndNoOutputCommandError = 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_queryNoInputAndOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryNoInputAndOutputCommandError(output, context); + } + await collectBody(output.body, context); + const response: NoInputAndOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryNoInputAndOutputCommandError = 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_queryQueryIdempotencyTokenAutoFillCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryQueryIdempotencyTokenAutoFillCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryIdempotencyTokenAutoFillCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryQueryIdempotencyTokenAutoFillCommandError = 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_queryQueryListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryQueryListsCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryListsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryQueryListsCommandError = 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_queryQueryMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryQueryMapsCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryMapsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryQueryMapsCommandError = 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_queryQueryTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryQueryTimestampsCommandError(output, context); + } + await collectBody(output.body, context); + const response: QueryTimestampsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryQueryTimestampsCommandError = 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_queryRecursiveXmlShapesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryRecursiveXmlShapesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryRecursiveXmlShapesOutput(data.RecursiveXmlShapesResult, context); + const response: RecursiveXmlShapesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryRecursiveXmlShapesCommandError = 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_querySimpleInputParamsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_querySimpleInputParamsCommandError(output, context); + } + await collectBody(output.body, context); + const response: SimpleInputParamsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + return Promise.resolve(response); +}; + +const deserializeAws_querySimpleInputParamsCommandError = 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_querySimpleScalarXmlPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_querySimpleScalarXmlPropertiesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_querySimpleScalarXmlPropertiesOutput(data.SimpleScalarXmlPropertiesResult, context); + const response: SimpleScalarXmlPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_querySimpleScalarXmlPropertiesCommandError = 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_queryXmlBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlBlobsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlBlobsOutput(data.XmlBlobsResult, context); + const response: XmlBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlBlobsCommandError = 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_queryXmlEmptyBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlEmptyBlobsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlBlobsOutput(data.XmlEmptyBlobsResult, context); + const response: XmlEmptyBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlEmptyBlobsCommandError = 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_queryXmlEmptyListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlEmptyListsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlListsOutput(data.XmlEmptyListsResult, context); + const response: XmlEmptyListsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlEmptyListsCommandError = 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_queryXmlEmptyMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlEmptyMapsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlMapsOutput(data.XmlEmptyMapsResult, context); + const response: XmlEmptyMapsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlEmptyMapsCommandError = 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_queryXmlEnumsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlEnumsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlEnumsOutput(data.XmlEnumsResult, context); + const response: XmlEnumsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlEnumsCommandError = 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_queryXmlListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlListsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlListsOutput(data.XmlListsResult, context); + const response: XmlListsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlListsCommandError = 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_queryXmlMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlMapsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlMapsOutput(data.XmlMapsResult, context); + const response: XmlMapsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlMapsCommandError = 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_queryXmlMapsXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlMapsXmlNameCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlMapsXmlNameOutput(data.XmlMapsXmlNameResult, context); + const response: XmlMapsXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlMapsXmlNameCommandError = 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_queryXmlNamespacesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlNamespacesCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlNamespacesOutput(data.XmlNamespacesResult, context); + const response: XmlNamespacesCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlNamespacesCommandError = 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_queryXmlTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_queryXmlTimestampsCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_queryXmlTimestampsOutput(data.XmlTimestampsResult, context); + const response: XmlTimestampsCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_queryXmlTimestampsCommandError = 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)); +}; + +const deserializeAws_queryComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_queryComplexError(body.Error, context); + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_queryCustomCodeErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_queryCustomCodeError(body.Error, context); + const contents: CustomCodeError = { + name: "CustomCodeError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const deserializeAws_queryInvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = deserializeAws_queryInvalidGreeting(body.Error, context); + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }; + return contents; +}; + +const serializeAws_queryComplexMap = (input: { [key: string]: GreetingStruct }, context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + Object.keys(input) + .filter((key) => input[key] != null) + .forEach((key) => { + entries[`entry.${counter}.key`] = key; + const memberEntries = serializeAws_queryGreetingStruct(input[key], context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`entry.${counter}.value.${key}`] = value; + }); + counter++; + }); + return entries; +}; + +const serializeAws_queryEmptyInputAndEmptyOutputInput = ( + input: EmptyInputAndEmptyOutputInput, + context: __SerdeContext +): any => { + const entries: any = {}; + return entries; +}; + +const serializeAws_queryHostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.label !== undefined && input.label !== null) { + entries["label"] = input.label; + } + return entries; +}; + +const serializeAws_queryListWithXmlName = (input: string[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`item.${counter}`] = entry; + counter++; + } + return entries; +}; + +const serializeAws_queryMapOfLists = (input: { [key: string]: string[] }, context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + Object.keys(input) + .filter((key) => input[key] != null) + .forEach((key) => { + entries[`entry.${counter}.key`] = key; + const memberEntries = serializeAws_queryStringList(input[key], context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`entry.${counter}.value.${key}`] = value; + }); + counter++; + }); + return entries; +}; + +const serializeAws_queryMapWithXmlName = (input: { [key: string]: string }, context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + Object.keys(input) + .filter((key) => input[key] != null) + .forEach((key) => { + entries[`entry.${counter}.K`] = key; + entries[`entry.${counter}.V`] = input[key]; + counter++; + }); + return entries; +}; + +const serializeAws_queryNestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.Nested !== undefined && input.Nested !== null) { + const memberEntries = serializeAws_queryStructArg(input.Nested, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Nested.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryNestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { + const entries: any = {}; + if (input.ListArg !== undefined && input.ListArg !== null) { + const memberEntries = serializeAws_queryStringList(input.ListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArg.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryNestedStructWithMap = (input: NestedStructWithMap, context: __SerdeContext): any => { + const entries: any = {}; + if (input.MapArg !== undefined && input.MapArg !== null) { + const memberEntries = serializeAws_queryStringMap(input.MapArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `MapArg.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryNoInputAndOutputOutput = (input: NoInputAndOutputOutput, context: __SerdeContext): any => { + const entries: any = {}; + return entries; +}; + +const serializeAws_queryQueryIdempotencyTokenAutoFillInput = ( + input: QueryIdempotencyTokenAutoFillInput, + context: __SerdeContext +): any => { + const entries: any = {}; + if (input.token === undefined) { + input.token = generateIdempotencyToken(); + } + if (input.token !== undefined && input.token !== null) { + entries["token"] = input.token; + } + return entries; +}; + +const serializeAws_queryQueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.ListArg !== undefined && input.ListArg !== null) { + const memberEntries = serializeAws_queryStringList(input.ListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArg.${key}`; + entries[loc] = value; + }); + } + if (input.ComplexListArg !== undefined && input.ComplexListArg !== null) { + const memberEntries = serializeAws_queryGreetingList(input.ComplexListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ComplexListArg.${key}`; + entries[loc] = value; + }); + } + if (input.FlattenedListArg !== undefined && input.FlattenedListArg !== null) { + const memberEntries = serializeAws_queryStringList(input.FlattenedListArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `FlattenedListArg.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.ListArgWithXmlNameMember !== undefined && input.ListArgWithXmlNameMember !== null) { + const memberEntries = serializeAws_queryListWithXmlName(input.ListArgWithXmlNameMember, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ListArgWithXmlNameMember.${key}`; + entries[loc] = value; + }); + } + if (input.FlattenedListArgWithXmlName !== undefined && input.FlattenedListArgWithXmlName !== null) { + const memberEntries = serializeAws_queryListWithXmlName(input.FlattenedListArgWithXmlName, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.NestedWithList !== undefined && input.NestedWithList !== null) { + const memberEntries = serializeAws_queryNestedStructWithList(input.NestedWithList, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `NestedWithList.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryQueryMapsInput = (input: QueryMapsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.MapArg !== undefined && input.MapArg !== null) { + const memberEntries = serializeAws_queryStringMap(input.MapArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `MapArg.${key}`; + entries[loc] = value; + }); + } + if (input.RenamedMapArg !== undefined && input.RenamedMapArg !== null) { + const memberEntries = serializeAws_queryStringMap(input.RenamedMapArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Foo.${key}`; + entries[loc] = value; + }); + } + if (input.ComplexMapArg !== undefined && input.ComplexMapArg !== null) { + const memberEntries = serializeAws_queryComplexMap(input.ComplexMapArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ComplexMapArg.${key}`; + entries[loc] = value; + }); + } + if (input.MapWithXmlMemberName !== undefined && input.MapWithXmlMemberName !== null) { + const memberEntries = serializeAws_queryMapWithXmlName(input.MapWithXmlMemberName, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `MapWithXmlMemberName.${key}`; + entries[loc] = value; + }); + } + if (input.FlattenedMap !== undefined && input.FlattenedMap !== null) { + const memberEntries = serializeAws_queryStringMap(input.FlattenedMap, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `FlattenedMap.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.FlattenedMapWithXmlName !== undefined && input.FlattenedMapWithXmlName !== null) { + const memberEntries = serializeAws_queryMapWithXmlName(input.FlattenedMapWithXmlName, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; + entries[loc] = value; + }); + } + if (input.MapOfLists !== undefined && input.MapOfLists !== null) { + const memberEntries = serializeAws_queryMapOfLists(input.MapOfLists, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `MapOfLists.${key}`; + entries[loc] = value; + }); + } + if (input.NestedStructWithMap !== undefined && input.NestedStructWithMap !== null) { + const memberEntries = serializeAws_queryNestedStructWithMap(input.NestedStructWithMap, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `NestedStructWithMap.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryQueryTimestampsInput = (input: QueryTimestampsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.normalFormat !== undefined && input.normalFormat !== null) { + entries["normalFormat"] = input.normalFormat.toISOString().split(".")[0] + "Z"; + } + if (input.epochMember !== undefined && input.epochMember !== null) { + entries["epochMember"] = Math.round(input.epochMember.getTime() / 1000); + } + if (input.epochTarget !== undefined && input.epochTarget !== null) { + entries["epochTarget"] = Math.round(input.epochTarget.getTime() / 1000); + } + return entries; +}; + +const serializeAws_querySimpleInputParamsInput = (input: SimpleInputParamsInput, context: __SerdeContext): any => { + const entries: any = {}; + if (input.Foo !== undefined && input.Foo !== null) { + entries["Foo"] = input.Foo; + } + if (input.Bar !== undefined && input.Bar !== null) { + entries["Bar"] = input.Bar; + } + if (input.Baz !== undefined && input.Baz !== null) { + entries["Baz"] = input.Baz; + } + if (input.Bam !== undefined && input.Bam !== null) { + entries["Bam"] = input.Bam; + } + if (input.FloatValue !== undefined && input.FloatValue !== null) { + entries["FloatValue"] = __serializeFloat(input.FloatValue); + } + if (input.Boo !== undefined && input.Boo !== null) { + entries["Boo"] = __serializeFloat(input.Boo); + } + if (input.Qux !== undefined && input.Qux !== null) { + entries["Qux"] = context.base64Encoder(input.Qux); + } + if (input.FooEnum !== undefined && input.FooEnum !== null) { + entries["FooEnum"] = input.FooEnum; + } + return entries; +}; + +const serializeAws_queryStructArg = (input: StructArg, context: __SerdeContext): any => { + const entries: any = {}; + if (input.StringArg !== undefined && input.StringArg !== null) { + entries["StringArg"] = input.StringArg; + } + if (input.OtherArg !== undefined && input.OtherArg !== null) { + entries["OtherArg"] = input.OtherArg; + } + if (input.RecursiveArg !== undefined && input.RecursiveArg !== null) { + const memberEntries = serializeAws_queryStructArg(input.RecursiveArg, context); + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `RecursiveArg.${key}`; + entries[loc] = value; + }); + } + return entries; +}; + +const serializeAws_queryGreetingList = (input: GreetingStruct[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = serializeAws_queryGreetingStruct(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; +}; + +const serializeAws_queryGreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + const entries: any = {}; + if (input.hi !== undefined && input.hi !== null) { + entries["hi"] = input.hi; + } + return entries; +}; + +const serializeAws_queryStringList = (input: string[], context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`member.${counter}`] = entry; + counter++; + } + return entries; +}; + +const serializeAws_queryStringMap = (input: { [key: string]: string }, context: __SerdeContext): any => { + const entries: any = {}; + let counter = 1; + Object.keys(input) + .filter((key) => input[key] != null) + .forEach((key) => { + entries[`entry.${counter}.key`] = key; + entries[`entry.${counter}.value`] = input[key]; + counter++; + }); + return entries; +}; + +const deserializeAws_queryComplexError = (output: any, context: __SerdeContext): ComplexError => { + const contents: any = { + TopLevel: undefined, + Nested: undefined, + }; + if (output["TopLevel"] !== undefined) { + contents.TopLevel = __expectString(output["TopLevel"]); + } + if (output["Nested"] !== undefined) { + contents.Nested = deserializeAws_queryComplexNestedErrorData(output["Nested"], context); + } + return contents; +}; + +const deserializeAws_queryComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { + const contents: any = { + Foo: undefined, + }; + if (output["Foo"] !== undefined) { + contents.Foo = __expectString(output["Foo"]); + } + return contents; +}; + +const deserializeAws_queryCustomCodeError = (output: any, context: __SerdeContext): CustomCodeError => { + const contents: any = { + Message: undefined, + }; + if (output["Message"] !== undefined) { + contents.Message = __expectString(output["Message"]); + } + return contents; +}; + +const deserializeAws_queryEmptyInputAndEmptyOutputOutput = ( + output: any, + context: __SerdeContext +): EmptyInputAndEmptyOutputOutput => { + const contents: any = {}; + return contents; +}; + +const deserializeAws_queryFlattenedXmlMapOutput = (output: any, context: __SerdeContext): FlattenedXmlMapOutput => { + const contents: any = { + myMap: undefined, + }; + if (output.myMap === "") { + contents.myMap = {}; + } + if (output["myMap"] !== undefined) { + contents.myMap = deserializeAws_queryFooEnumMap(__getArrayIfSingleItem(output["myMap"]), context); + } + return contents; +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNameOutput = ( + output: any, + context: __SerdeContext +): FlattenedXmlMapWithXmlNameOutput => { + const contents: any = { + myMap: undefined, + }; + if (output.KVP === "") { + contents.myMap = {}; + } + if (output["KVP"] !== undefined) { + contents.myMap = deserializeAws_queryFlattenedXmlMapWithXmlNameOutputMap( + __getArrayIfSingleItem(output["KVP"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNameOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["V"] === null) { + return acc; + } + return { + ...acc, + [pair["K"]]: __expectString(pair["V"]) as any, + }; + }, {}); +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutput = ( + output: any, + context: __SerdeContext +): FlattenedXmlMapWithXmlNamespaceOutput => { + const contents: any = { + myMap: undefined, + }; + if (output.KVP === "") { + contents.myMap = {}; + } + if (output["KVP"] !== undefined) { + contents.myMap = deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutputMap( + __getArrayIfSingleItem(output["KVP"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["V"] === null) { + return acc; + } + return { + ...acc, + [pair["K"]]: __expectString(pair["V"]) as any, + }; + }, {}); +}; + +const deserializeAws_queryGreetingWithErrorsOutput = ( + output: any, + context: __SerdeContext +): GreetingWithErrorsOutput => { + const contents: any = { + greeting: undefined, + }; + if (output["greeting"] !== undefined) { + contents.greeting = __expectString(output["greeting"]); + } + return contents; +}; + +const deserializeAws_queryIgnoresWrappingXmlNameOutput = ( + output: any, + context: __SerdeContext +): IgnoresWrappingXmlNameOutput => { + const contents: any = { + foo: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + return contents; +}; + +const deserializeAws_queryInvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { + const contents: any = { + Message: undefined, + }; + if (output["Message"] !== undefined) { + contents.Message = __expectString(output["Message"]); + } + return contents; +}; + +const deserializeAws_queryListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryListWithNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryRecursiveXmlShapesOutput = ( + output: any, + context: __SerdeContext +): RecursiveXmlShapesOutput => { + const contents: any = { + nested: undefined, + }; + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_queryRecursiveXmlShapesOutputNested1(output["nested"], context); + } + return contents; +}; + +const deserializeAws_queryRecursiveXmlShapesOutputNested1 = ( + output: any, + context: __SerdeContext +): RecursiveXmlShapesOutputNested1 => { + const contents: any = { + foo: undefined, + nested: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_queryRecursiveXmlShapesOutputNested2(output["nested"], context); + } + return contents; +}; + +const deserializeAws_queryRecursiveXmlShapesOutputNested2 = ( + output: any, + context: __SerdeContext +): RecursiveXmlShapesOutputNested2 => { + const contents: any = { + bar: undefined, + recursiveMember: undefined, + }; + if (output["bar"] !== undefined) { + contents.bar = __expectString(output["bar"]); + } + if (output["recursiveMember"] !== undefined) { + contents.recursiveMember = deserializeAws_queryRecursiveXmlShapesOutputNested1(output["recursiveMember"], context); + } + return contents; +}; + +const deserializeAws_queryRenamedListMembers = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_querySimpleScalarXmlPropertiesOutput = ( + output: any, + context: __SerdeContext +): SimpleScalarXmlPropertiesOutput => { + const contents: any = { + stringValue: undefined, + emptyStringValue: undefined, + trueBooleanValue: undefined, + falseBooleanValue: undefined, + byteValue: undefined, + shortValue: undefined, + integerValue: undefined, + longValue: undefined, + floatValue: undefined, + doubleValue: undefined, + }; + if (output["stringValue"] !== undefined) { + contents.stringValue = __expectString(output["stringValue"]); + } + if (output["emptyStringValue"] !== undefined) { + contents.emptyStringValue = __expectString(output["emptyStringValue"]); + } + if (output["trueBooleanValue"] !== undefined) { + contents.trueBooleanValue = __parseBoolean(output["trueBooleanValue"]); + } + if (output["falseBooleanValue"] !== undefined) { + contents.falseBooleanValue = __parseBoolean(output["falseBooleanValue"]); + } + if (output["byteValue"] !== undefined) { + contents.byteValue = __strictParseByte(output["byteValue"]) as number; + } + if (output["shortValue"] !== undefined) { + contents.shortValue = __strictParseShort(output["shortValue"]) as number; + } + if (output["integerValue"] !== undefined) { + contents.integerValue = __strictParseInt32(output["integerValue"]) as number; + } + if (output["longValue"] !== undefined) { + contents.longValue = __strictParseLong(output["longValue"]) as number; + } + if (output["floatValue"] !== undefined) { + contents.floatValue = __strictParseFloat(output["floatValue"]) as number; + } + if (output["DoubleDribble"] !== undefined) { + contents.doubleValue = __strictParseFloat(output["DoubleDribble"]) as number; + } + return contents; +}; + +const deserializeAws_queryStructureList = (output: any, context: __SerdeContext): StructureListMember[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_queryStructureListMember(entry, context); + }); +}; + +const deserializeAws_queryStructureListMember = (output: any, context: __SerdeContext): StructureListMember => { + const contents: any = { + a: undefined, + b: undefined, + }; + if (output["value"] !== undefined) { + contents.a = __expectString(output["value"]); + } + if (output["other"] !== undefined) { + contents.b = __expectString(output["other"]); + } + return contents; +}; + +const deserializeAws_queryXmlBlobsOutput = (output: any, context: __SerdeContext): XmlBlobsOutput => { + const contents: any = { + data: undefined, + }; + if (output["data"] !== undefined) { + contents.data = context.base64Decoder(output["data"]); + } + return contents; +}; + +const deserializeAws_queryXmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput => { + const contents: any = { + fooEnum1: undefined, + fooEnum2: undefined, + fooEnum3: undefined, + fooEnumList: undefined, + fooEnumSet: undefined, + fooEnumMap: undefined, + }; + if (output["fooEnum1"] !== undefined) { + contents.fooEnum1 = __expectString(output["fooEnum1"]); + } + if (output["fooEnum2"] !== undefined) { + contents.fooEnum2 = __expectString(output["fooEnum2"]); + } + if (output["fooEnum3"] !== undefined) { + contents.fooEnum3 = __expectString(output["fooEnum3"]); + } + if (output.fooEnumList === "") { + contents.fooEnumList = []; + } + if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { + contents.fooEnumList = deserializeAws_queryFooEnumList( + __getArrayIfSingleItem(output["fooEnumList"]["member"]), + context + ); + } + if (output.fooEnumSet === "") { + contents.fooEnumSet = []; + } + if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { + contents.fooEnumSet = deserializeAws_queryFooEnumSet( + __getArrayIfSingleItem(output["fooEnumSet"]["member"]), + context + ); + } + if (output.fooEnumMap === "") { + contents.fooEnumMap = {}; + } + if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { + contents.fooEnumMap = deserializeAws_queryFooEnumMap( + __getArrayIfSingleItem(output["fooEnumMap"]["entry"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryXmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput => { + const contents: any = { + stringList: undefined, + stringSet: undefined, + integerList: undefined, + booleanList: undefined, + timestampList: undefined, + enumList: undefined, + nestedStringList: undefined, + renamedListMembers: undefined, + flattenedList: undefined, + flattenedList2: undefined, + flattenedListWithMemberNamespace: undefined, + flattenedListWithNamespace: undefined, + structureList: undefined, + }; + if (output.stringList === "") { + contents.stringList = []; + } + if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { + contents.stringList = deserializeAws_queryStringList( + __getArrayIfSingleItem(output["stringList"]["member"]), + context + ); + } + if (output.stringSet === "") { + contents.stringSet = []; + } + if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { + contents.stringSet = deserializeAws_queryStringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); + } + if (output.integerList === "") { + contents.integerList = []; + } + if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { + contents.integerList = deserializeAws_queryIntegerList( + __getArrayIfSingleItem(output["integerList"]["member"]), + context + ); + } + if (output.booleanList === "") { + contents.booleanList = []; + } + if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { + contents.booleanList = deserializeAws_queryBooleanList( + __getArrayIfSingleItem(output["booleanList"]["member"]), + context + ); + } + if (output.timestampList === "") { + contents.timestampList = []; + } + if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { + contents.timestampList = deserializeAws_queryTimestampList( + __getArrayIfSingleItem(output["timestampList"]["member"]), + context + ); + } + if (output.enumList === "") { + contents.enumList = []; + } + if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { + contents.enumList = deserializeAws_queryFooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); + } + if (output.nestedStringList === "") { + contents.nestedStringList = []; + } + if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { + contents.nestedStringList = deserializeAws_queryNestedStringList( + __getArrayIfSingleItem(output["nestedStringList"]["member"]), + context + ); + } + if (output.renamed === "") { + contents.renamedListMembers = []; + } + if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { + contents.renamedListMembers = deserializeAws_queryRenamedListMembers( + __getArrayIfSingleItem(output["renamed"]["item"]), + context + ); + } + if (output.flattenedList === "") { + contents.flattenedList = []; + } + if (output["flattenedList"] !== undefined) { + contents.flattenedList = deserializeAws_queryRenamedListMembers( + __getArrayIfSingleItem(output["flattenedList"]), + context + ); + } + if (output.customName === "") { + contents.flattenedList2 = []; + } + if (output["customName"] !== undefined) { + contents.flattenedList2 = deserializeAws_queryRenamedListMembers( + __getArrayIfSingleItem(output["customName"]), + context + ); + } + if (output.flattenedListWithMemberNamespace === "") { + contents.flattenedListWithMemberNamespace = []; + } + if (output["flattenedListWithMemberNamespace"] !== undefined) { + contents.flattenedListWithMemberNamespace = deserializeAws_queryListWithMemberNamespace( + __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), + context + ); + } + if (output.flattenedListWithNamespace === "") { + contents.flattenedListWithNamespace = []; + } + if (output["flattenedListWithNamespace"] !== undefined) { + contents.flattenedListWithNamespace = deserializeAws_queryListWithNamespace( + __getArrayIfSingleItem(output["flattenedListWithNamespace"]), + context + ); + } + if (output.myStructureList === "") { + contents.structureList = []; + } + if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { + contents.structureList = deserializeAws_queryStructureList( + __getArrayIfSingleItem(output["myStructureList"]["item"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryXmlMapsOutput = (output: any, context: __SerdeContext): XmlMapsOutput => { + const contents: any = { + myMap: undefined, + }; + if (output.myMap === "") { + contents.myMap = {}; + } + if (output["myMap"] !== undefined && output["myMap"]["entry"] !== undefined) { + contents.myMap = deserializeAws_queryXmlMapsOutputMap(__getArrayIfSingleItem(output["myMap"]["entry"]), context); + } + return contents; +}; + +const deserializeAws_queryXmlMapsOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return output.reduce((acc: any, pair: any) => { + if (pair["value"] === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: deserializeAws_queryGreetingStruct(pair["value"], context), + }; + }, {}); +}; + +const deserializeAws_queryXmlMapsXmlNameOutput = (output: any, context: __SerdeContext): XmlMapsXmlNameOutput => { + const contents: any = { + myMap: undefined, + }; + if (output.myMap === "") { + contents.myMap = {}; + } + if (output["myMap"] !== undefined && output["myMap"]["entry"] !== undefined) { + contents.myMap = deserializeAws_queryXmlMapsXmlNameOutputMap( + __getArrayIfSingleItem(output["myMap"]["entry"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryXmlMapsXmlNameOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return output.reduce((acc: any, pair: any) => { + if (pair["Setting"] === null) { + return acc; + } + return { + ...acc, + [pair["Attribute"]]: deserializeAws_queryGreetingStruct(pair["Setting"], context), + }; + }, {}); +}; + +const deserializeAws_queryXmlNamespacedList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryXmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { + const contents: any = { + foo: undefined, + values: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output.values === "") { + contents.values = []; + } + if (output["values"] !== undefined && output["values"]["member"] !== undefined) { + contents.values = deserializeAws_queryXmlNamespacedList( + __getArrayIfSingleItem(output["values"]["member"]), + context + ); + } + return contents; +}; + +const deserializeAws_queryXmlNamespacesOutput = (output: any, context: __SerdeContext): XmlNamespacesOutput => { + const contents: any = { + nested: undefined, + }; + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_queryXmlNamespaceNested(output["nested"], context); + } + return contents; +}; + +const deserializeAws_queryXmlTimestampsOutput = (output: any, context: __SerdeContext): XmlTimestampsOutput => { + const contents: any = { + normal: undefined, + dateTime: undefined, + epochSeconds: undefined, + httpDate: undefined, + }; + if (output["normal"] !== undefined) { + contents.normal = __expectNonNull(__parseRfc3339DateTime(output["normal"])); + } + if (output["dateTime"] !== undefined) { + contents.dateTime = __expectNonNull(__parseRfc3339DateTime(output["dateTime"])); + } + if (output["epochSeconds"] !== undefined) { + contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(output["epochSeconds"])); + } + if (output["httpDate"] !== undefined) { + contents.httpDate = __expectNonNull(__parseRfc7231DateTime(output["httpDate"])); + } + return contents; +}; + +const deserializeAws_queryBooleanList = (output: any, context: __SerdeContext): boolean[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __parseBoolean(entry); + }); +}; + +const deserializeAws_queryFooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryFooEnumMap = (output: any, context: __SerdeContext): { [key: string]: FooEnum | string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["value"] === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: __expectString(pair["value"]) as any, + }; + }, {}); +}; + +const deserializeAws_queryFooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryGreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { + const contents: any = { + hi: undefined, + }; + if (output["hi"] !== undefined) { + contents.hi = __expectString(output["hi"]); + } + return contents; +}; + +const deserializeAws_queryIntegerList = (output: any, context: __SerdeContext): number[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __strictParseInt32(entry) as number; + }); +}; + +const deserializeAws_queryNestedStringList = (output: any, context: __SerdeContext): string[][] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_queryStringList(__getArrayIfSingleItem(entry["member"]), context); + }); +}; + +const deserializeAws_queryStringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryStringSet = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_queryTimestampList = (output: any, context: __SerdeContext): Date[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectNonNull(__parseRfc3339DateTime(entry)); + }); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const buildHttpRpcRequest = async ( + context: __SerdeContext, + headers: __HeaderBag, + path: string, + resolvedHostname: string | undefined, + body: any +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents: any = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers, + }; + if (resolvedHostname !== undefined) { + contents.hostname = resolvedHostname; + } + if (body !== undefined) { + contents.body = body; + } + return new __HttpRequest(contents); +}; + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + const parsedObj = xmlParse(encoded, { + attributeNamePrefix: "", + ignoreAttributes: false, + parseNodeValue: false, + trimValues: false, + tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + }); + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return __getValueFromTextNode(parsedObjToReturn); + } + return {}; + }); + +const buildFormUrlencodedString = (formEntries: { [key: string]: string }): string => + Object.entries(formEntries) + .map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value)) + .join("&"); + +const loadQueryErrorCode = (output: __HttpResponse, data: any): string => { + if (data.Error.Code !== undefined) { + return data.Error.Code; + } + if (output.statusCode == 404) { + return "NotFound"; + } + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..2caa43a22cee --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts @@ -0,0 +1,37 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..e68b530389ac --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..3a4d67ebddde --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { defaultRegionInfoProvider } from "./endpoints"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => ({ + apiVersion: "2020-01-08", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "Query Protocol", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts new file mode 100644 index 000000000000..95c1994a9e2b --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts @@ -0,0 +1,40 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts b/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts new file mode 100644 index 000000000000..661bd311f114 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts @@ -0,0 +1,3117 @@ +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"; + +import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; +import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommand } from "../../src/commands/FlattenedXmlMapCommand"; +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"; +import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; +import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryListsCommand } from "../../src/commands/QueryListsCommand"; +import { QueryMapsCommand } from "../../src/commands/QueryMapsCommand"; +import { QueryTimestampsCommand } from "../../src/commands/QueryTimestampsCommand"; +import { RecursiveXmlShapesCommand } from "../../src/commands/RecursiveXmlShapesCommand"; +import { SimpleInputParamsCommand } from "../../src/commands/SimpleInputParamsCommand"; +import { SimpleScalarXmlPropertiesCommand } from "../../src/commands/SimpleScalarXmlPropertiesCommand"; +import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommand } from "../../src/commands/XmlEmptyMapsCommand"; +import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; +import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; +import { XmlMapsCommand } from "../../src/commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommand } from "../../src/commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; +import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; +import { ComplexError, CustomCodeError, InvalidGreeting } from "../../src/models/models_0"; +import { QueryProtocolClient } from "../../src/QueryProtocolClient"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Empty input serializes no extra query params + */ +it("QueryEmptyInputAndEmptyOutput:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyInputAndEmptyOutputCommand({} as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EmptyInputAndEmptyOutput&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output + */ +it("QueryEmptyInputAndEmptyOutput:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("AwsQueryEndpointTrait:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EndpointOperation&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("AwsQueryEndpointTraitWithHostLabel:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=EndpointWithHostLabelOperation&Version=2020-01-08&label=bar`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened XML maps in responses + */ +it("QueryQueryFlattenedXmlMap:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + foo + Foo + + + baz + Baz + + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: "Foo", + + baz: "Baz", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes flattened XML maps in responses that have xmlName on members + */ +it("QueryQueryFlattenedXmlMapWithXmlName:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + a + A + + + b + B + + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapWithXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + a: "A", + + b: "B", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes flattened XML maps in responses that have xmlNamespace and xmlName on members + */ +it("QueryQueryFlattenedXmlMapWithXmlNamespace:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + a + A + + + b + B + + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapWithXmlNamespaceCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + a: "A", + + b: "B", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that operations with errors successfully know how to deserialize the successful response + */ +it("QueryGreetingWithErrors:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + Hello + + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + greeting: "Hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses simple XML errors + */ +it("QueryInvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "text/xml", + }, + ` + + Sender + InvalidGreeting + Hi + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Parses customized XML errors + */ +it.skip("QueryCustomizedError:Error:GreetingWithErrors", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 402, + { + "content-type": "text/xml", + }, + ` + + Sender + Customized + Hi + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "CustomCodeError") { + console.log(err); + fail(`Expected a CustomCodeError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(402); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +it("QueryComplexError:Error:GreetingWithErrors", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "text/xml", + }, + ` + + Sender + ComplexError + Top level + + bar + + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + 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 + */ +it("QueryIgnoresWrappingXmlName:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + bar + + + ` + ), + }); + + const params: any = {}; + const command = new IgnoresWrappingXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "bar", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes nested structures using dots + */ +it("NestedStructures:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NestedStructuresCommand({ + Nested: { + StringArg: "foo", + + OtherArg: true, + + RecursiveArg: { + StringArg: "baz", + } as any, + } as any, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=NestedStructures&Version=2020-01-08&Nested.StringArg=foo&Nested.OtherArg=true&Nested.RecursiveArg.StringArg=baz`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * No input serializes no additional query params + */ +it("QueryNoInputAndNoOutput:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndNoOutputCommand({}); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=NoInputAndNoOutput&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output. Note that no assertion is made on the output body itself. + */ +it("QueryNoInputAndNoOutput:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * No input serializes no payload + */ +it("QueryNoInputAndOutput:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndOutputCommand({} as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=NoInputAndOutput&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Empty output + */ +it("QueryNoInputAndOutput:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Automatically adds idempotency token when not set + */ +it("QueryProtocolIdempotencyTokenAutoFill:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&token=00000000-0000-4000-8000-000000000000`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Uses the given idempotency token as-is + */ +it("QueryProtocolIdempotencyTokenAutoFillIsSet:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000123", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&token=00000000-0000-4000-8000-000000000123`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query lists + */ +it("QueryLists:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArg: ["foo", "bar", "baz"], + + ComplexListArg: [ + { + hi: "hello", + } as any, + + { + hi: "hola", + } as any, + ], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&ComplexListArg.member.1.hi=hello&ComplexListArg.member.2.hi=hola`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Does not serialize empty query lists + */ +it("EmptyQueryLists:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArg: [], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Flattens query lists by repeating the member name and removing the member element + */ +it("FlattenedQueryLists:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + FlattenedListArg: ["A", "B"], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&FlattenedListArg.1=A&FlattenedListArg.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Changes the member of lists using xmlName trait + */ +it("QueryListArgWithXmlNameMember:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + ListArgWithXmlNameMember: ["A", "B"], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&ListArgWithXmlNameMember.item.1=A&ListArgWithXmlNameMember.item.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Changes the name of flattened lists using xmlName trait on the structure member + */ +it("QueryFlattenedListArgWithXmlName:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + FlattenedListArgWithXmlName: ["A", "B"], + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&Hi.1=A&Hi.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Nested structure with a list member + */ +it("QueryNestedStructWithList:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryListsCommand({ + NestedWithList: { + ListArg: ["A", "B"], + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.member.1=A&NestedWithList.ListArg.member.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query maps + */ +it("QuerySimpleQueryMaps:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + MapArg: { + bar: "Bar", + + foo: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&MapArg.entry.1.key=bar&MapArg.entry.1.value=Bar&MapArg.entry.2.key=foo&MapArg.entry.2.value=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query maps and uses xmlName + */ +it("QuerySimpleQueryMapsWithXmlName:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + RenamedMapArg: { + foo: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&Foo.entry.1.key=foo&Foo.entry.1.value=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes complex query maps + */ +it("QueryComplexQueryMaps:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + ComplexMapArg: { + bar: { + hi: "Bar", + } as any, + + foo: { + hi: "Foo", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&ComplexMapArg.entry.1.key=bar&ComplexMapArg.entry.1.value.hi=Bar&ComplexMapArg.entry.2.key=foo&ComplexMapArg.entry.2.value.hi=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Does not serialize empty query maps + */ +it("QueryEmptyQueryMaps:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + MapArg: {} as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query maps where the member has an xmlName trait + */ +it("QueryQueryMapWithMemberXmlName:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + MapWithXmlMemberName: { + bar: "Bar", + + foo: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&MapWithXmlMemberName.entry.1.K=bar&MapWithXmlMemberName.entry.1.V=Bar&MapWithXmlMemberName.entry.2.K=foo&MapWithXmlMemberName.entry.2.V=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened query maps + */ +it("QueryFlattenedQueryMaps:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + FlattenedMap: { + bar: "Bar", + + foo: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&FlattenedMap.1.key=bar&FlattenedMap.1.value=Bar&FlattenedMap.2.key=foo&FlattenedMap.2.value=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened query maps that use an xmlName + */ +it("QueryFlattenedQueryMapsWithXmlName:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + FlattenedMapWithXmlName: { + bar: "Bar", + + foo: "Foo", + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&Hi.1.K=bar&Hi.1.V=Bar&Hi.2.K=foo&Hi.2.V=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes query map of lists + */ +it("QueryQueryMapOfLists:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + MapOfLists: { + bar: ["C", "D"], + + foo: ["A", "B"], + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&MapOfLists.entry.1.key=bar&MapOfLists.entry.1.value.member.1=C&MapOfLists.entry.1.value.member.2=D&MapOfLists.entry.2.key=foo&MapOfLists.entry.2.value.member.1=A&MapOfLists.entry.2.value.member.2=B`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes nested struct with map member + */ +it("QueryNestedStructWithMap:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryMapsCommand({ + NestedStructWithMap: { + MapArg: { + bar: "Bar", + + foo: "Foo", + } as any, + } as any, + } as any); + 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("/"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryMaps&Version=2020-01-08&NestedStructWithMap.MapArg.entry.1.key=bar&NestedStructWithMap.MapArg.entry.1.value=Bar&NestedStructWithMap.MapArg.entry.2.key=foo&NestedStructWithMap.MapArg.entry.2.value=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes timestamps + */ +it("QueryTimestampsInput:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryTimestampsCommand({ + normalFormat: new Date(1422172800000), + + epochMember: new Date(1422172800000), + + epochTarget: new Date(1422172800000), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=QueryTimestamps&Version=2020-01-08&normalFormat=2015-01-25T08%3A00%3A00Z&epochMember=1422172800&epochTarget=1422172800`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes recursive structures + */ +it("QueryRecursiveShapes:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + Foo1 + + Bar1 + + Foo2 + + Bar2 + + + + + + + ` + ), + }); + + const params: any = {}; + const command = new RecursiveXmlShapesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes strings + */ +it("QuerySimpleInputParamsStrings:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Foo: "val1", + + Bar: "val2", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Bar=val2`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes booleans that are true + */ +it("QuerySimpleInputParamsStringAndBooleanTrue:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Foo: "val1", + + Baz: true, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Baz=true`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes booleans that are false + */ +it("QuerySimpleInputParamsStringsAndBooleanFalse:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Baz: false, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Baz=false`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes integers + */ +it("QuerySimpleInputParamsInteger:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Bam: 10, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Bam=10`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes floats + */ +it("QuerySimpleInputParamsFloat:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Boo: 10.8, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Boo=10.8`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Blobs are base64 encoded in the query string + */ +it("QuerySimpleInputParamsBlob:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + Qux: Uint8Array.from("value", (c) => c.charCodeAt(0)), + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Qux=dmFsdWU%3D`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes enums in the query string + */ +it("QueryEnums:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FooEnum: "Foo", + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FooEnum=Foo`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("AwsQuerySupportsNaNFloatInputs:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: NaN, + + Boo: NaN, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=NaN&Boo=NaN`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsQuerySupportsInfinityFloatInputs:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: Infinity, + + Boo: Infinity, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=Infinity&Boo=Infinity`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsQuerySupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleInputParamsCommand({ + FloatValue: -Infinity, + + Boo: -Infinity, + } as any); + 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("/"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=-Infinity&Boo=-Infinity`; + const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("QuerySimpleScalarProperties:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + string + + true + false + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + emptyStringValue: "", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float values. + */ +it("AwsQuerySupportsNaNFloatOutputs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + NaN + NaN + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("AwsQuerySupportsInfinityFloatOutputs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + Infinity + Infinity + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("AwsQuerySupportsNegativeInfinityFloatOutputs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + -Infinity + -Infinity + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarXmlPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Blobs are base64 encoded + */ +it("QueryXmlBlobs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + dmFsdWU= + + + ` + ), + }); + + const params: any = {}; + const command = new XmlBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty blobs are deserialized as empty string + */ +it("QueryXmlEmptyBlobs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty self closed blobs are deserialized as empty string + */ +it("QueryXmlEmptySelfClosedBlobs:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes empty XML lists + */ +it("QueryXmlEmptyLists:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: [], + + stringSet: [], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes Empty XML maps + */ +it("QueryXmlEmptyMaps:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: {}, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes Self-Closed XML maps + */ +it("QueryXmlEmptySelfClosedMaps:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: {}, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("QueryXmlEnums:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + Foo + 0 + 1 + + Foo + 0 + + + Foo + 0 + + + + hi + Foo + + + zero + 0 + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEnumsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests for XML list serialization + */ +it("QueryXmlLists:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + foo + bar + + + foo + bar + + + 1 + 2 + + + true + false + + + 2014-04-29T18:30:38Z + 2014-04-29T18:30:38Z + + + Foo + 0 + + + + foo + bar + + + baz + qux + + + + foo + bar + + hi + bye + yep + nope + a + b + a + b + + + 1 + 2 + + + 3 + 4 + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + renamedListMembers: ["foo", "bar"], + + flattenedList: ["hi", "bye"], + + flattenedList2: ["yep", "nope"], + + flattenedListWithMemberNamespace: ["a", "b"], + + flattenedListWithNamespace: ["a", "b"], + + structureList: [ + { + a: "1", + + b: "2", + }, + + { + a: "3", + + b: "4", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests for XML map serialization + */ +it("QueryXmlMaps:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + foo + + there + + + + baz + + bye + + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML lists + */ +it("QueryQueryXmlMapsXmlName:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + + foo + + there + + + + baz + + bye + + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlMapsXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML namespaces + */ +it("QueryXmlNamespaces:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + + Foo + + Bar + Baz + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlNamespacesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo", + + values: ["Bar", "Baz"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests how normal timestamps are serialized + */ +it("QueryXmlTimestamps:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + 2014-04-29T18:30:38Z + + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + normal: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("QueryXmlTimestampsWithDateTimeFormat:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + 2014-04-29T18:30:38Z + + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + dateTime: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("QueryXmlTimestampsWithEpochSecondsFormat:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + 1398796238 + + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + epochSeconds: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("QueryXmlTimestampsWithHttpDateFormat:Response", async () => { + const client = new QueryProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/xml", + }, + ` + + Tue, 29 Apr 2014 18:30:38 GMT + + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + httpDate: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBody: string): Object => { + const fromEntries = (components: string[][]): { [key: string]: string } => { + const parts: { [key: string]: string } = {}; + + components.forEach((component) => { + parts[component[0]] = component[1]; + }); + + return parts; + }; + + // Generate to k:v maps from query components + const expectedParts = fromEntries(expectedBody.split("&").map((part) => part.trim().split("="))); + const generatedParts = fromEntries(generatedBody.split("&").map((part) => part.trim().split("="))); + + 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-protocoltests-query/tsconfig.es.json b/protocol_tests/aws-protocoltests-query/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-query/tsconfig.json b/protocol_tests/aws-protocoltests-query/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-query/tsconfig.types.json b/protocol_tests/aws-protocoltests-query/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-restjson/.gitignore b/protocol_tests/aws-protocoltests-restjson/.gitignore new file mode 100644 index 000000000000..bff6121c007d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md b/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md new file mode 100644 index 000000000000..8a1f0c0a9dee --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md @@ -0,0 +1,784 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + + +### Features + +* **codegen:** assert sets have no duplicates ([#2764](https://github.com/aws/aws-sdk-js-v3/issues/2764)) ([aa62fc3](https://github.com/aws/aws-sdk-js-v3/commit/aa62fc3eda48e9a57753cea6fc5896b65f2dbe3b)) + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + + +### Features + +* **clients:** update clients as of 08/13/2021 ([#2674](https://github.com/aws/aws-sdk-js-v3/issues/2674)) ([de45580](https://github.com/aws/aws-sdk-js-v3/commit/de45580769f70d5db409204f5196da5221c23d99)) + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + +### Features + +* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + + +### Features + +* **clients:** update clients as of 07/08/2021 ([#2565](https://github.com/aws/aws-sdk-js-v3/issues/2565)) ([c9bd983](https://github.com/aws/aws-sdk-js-v3/commit/c9bd98328765c540b778f9085d0ec8870e5af6c9)) + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) + + + + + +# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) + + +### Bug Fixes + +* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) + + + + + +# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) + + +### Features + +* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) +* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) + + + + + +# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) + + +### Features + +* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) + + + + + +# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) + + +### Bug Fixes + +* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) + + + + + +# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) + + +### Bug Fixes + +* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) + + +### Features + +* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) + + + + + +## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) + + +### Features + +* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) + + + + + +# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) + + +### Bug Fixes + +* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) + + +### Features + +* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) + + + + + +# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) + + +### Features + +* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) + + + + + +# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) + + +### Bug Fixes + +* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) + + + + + +# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) + + +### Bug Fixes + +* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) + + + + + +# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) + + +### Bug Fixes + +* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) + + + + + +# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) + + +### Features + +* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) +* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) + + + + + +# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) + + +### Bug Fixes + +* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) +* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) +* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) + + +### Features + +* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) + + + + + +# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) + + +### Bug Fixes + +* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) + + + + + +# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) + + +### Bug Fixes + +* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) +* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) +* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) +* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) + + +### Features + +* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) + + + + + +# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) + + +### Features + +* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) + + + + + +# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) + + +### Features + +* update clients as of 12/12/2020 ([#1771](https://github.com/aws/aws-sdk-js-v3/issues/1771)) ([f69ff44](https://github.com/aws/aws-sdk-js-v3/commit/f69ff440a79018ad69fcb26ad46e3db65b23ce71)) + + + + + +# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) + + +### Bug Fixes + +* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) + + +### Features + +* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) + + + + + +# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) + + +### Features + +* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) + + + + + +# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) + + +### Bug Fixes + +* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) + + + + + +# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) + + +### Features + +* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) + + + + + +# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) + + +### Bug Fixes + +* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) + + + + + +# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) + + +### Features + +* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) + + + + + +# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.9...@aws-sdk/aws-restjson@1.0.0-gamma.10) (2020-10-07) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.8...@aws-sdk/aws-restjson@1.0.0-gamma.9) (2020-09-29) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.7...@aws-sdk/aws-restjson@1.0.0-gamma.8) (2020-09-15) + + +### Bug Fixes + +* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) +* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) + + + + + +# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.6...@aws-sdk/aws-restjson@1.0.0-gamma.7) (2020-09-01) + + +### Features + +* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) + + + + + +# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.5...@aws-sdk/aws-restjson@1.0.0-gamma.6) (2020-08-25) + + +### Features + +* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) +* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) +* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) + + + + + +# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.4...@aws-sdk/aws-restjson@1.0.0-gamma.5) (2020-08-04) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.3...@aws-sdk/aws-restjson@1.0.0-gamma.4) (2020-07-21) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.2...@aws-sdk/aws-restjson@1.0.0-gamma.3) (2020-07-13) + +**Note:** Version bump only for package @aws-sdk/aws-restjson + + + + + +# 1.0.0-gamma.2 (2020-07-08) + + +### Features + +* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) + + + +# 1.0.0-gamma.2 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.1 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.0 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-beta.0 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-restjson/LICENSE b/protocol_tests/aws-protocoltests-restjson/LICENSE new file mode 100644 index 000000000000..dd65ae06be7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-restjson/README.md b/protocol_tests/aws-protocoltests-restjson/README.md new file mode 100644 index 000000000000..da75b669b9ad --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/README.md @@ -0,0 +1,203 @@ +# @aws-sdk/aws-protocoltests-restjson + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-restjson/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restjson) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-restjson.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restjson) + +## Description + +AWS SDK for JavaScript RestJsonProtocol Client for Node.js, Browser and React Native. + +A REST JSON service that sends JSON requests and responses. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-restjson +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-restjson` +- `yarn add @aws-sdk/aws-protocoltests-restjson` +- `pnpm add @aws-sdk/aws-protocoltests-restjson` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `RestJsonProtocolClient` and +the commands you need, for example `AllQueryStringTypesCommand`: + +```js +// ES5 example +const { RestJsonProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); +``` + +```ts +// ES6+ example +import { RestJsonProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restjson"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new RestJsonProtocolClient({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new AllQueryStringTypesCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-restjson"; +const client = new AWS.RestJsonProtocol({ region: "REGION" }); + +// async/await. +try { + const data = await client.allQueryStringTypes(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .allQueryStringTypes(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.allQueryStringTypes(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-restjson` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-restjson/package.json b/protocol_tests/aws-protocoltests-restjson/package.json new file mode 100644 index 000000000000..5631187b9631 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/package.json @@ -0,0 +1,99 @@ +{ + "name": "@aws-sdk/aws-protocoltests-restjson", + "description": "@aws-sdk/aws-protocoltests-restjson client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-blob-browser": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/hash-stream-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/md5-js": "3.38.0", + "@aws-sdk/middleware-apply-body-checksum": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/querystring-builder": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-restjson", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-restjson" + } +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts new file mode 100644 index 000000000000..d1dbf27965a8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts @@ -0,0 +1,2796 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + AllQueryStringTypesCommand, + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "./commands/AllQueryStringTypesCommand"; +import { + ConstantAndVariableQueryStringCommand, + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "./commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommand, + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "./commands/ConstantQueryStringCommand"; +import { + DocumentTypeAsPayloadCommand, + DocumentTypeAsPayloadCommandInput, + DocumentTypeAsPayloadCommandOutput, +} from "./commands/DocumentTypeAsPayloadCommand"; +import { + DocumentTypeCommand, + DocumentTypeCommandInput, + DocumentTypeCommandOutput, +} from "./commands/DocumentTypeCommand"; +import { + EmptyInputAndEmptyOutputCommand, + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + GreetingWithErrorsCommand, + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, +} from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + HttpChecksumRequiredCommand, + HttpChecksumRequiredCommandInput, + HttpChecksumRequiredCommandOutput, +} from "./commands/HttpChecksumRequiredCommand"; +import { + HttpEnumPayloadCommand, + HttpEnumPayloadCommandInput, + HttpEnumPayloadCommandOutput, +} from "./commands/HttpEnumPayloadCommand"; +import { + HttpPayloadTraitsCommand, + HttpPayloadTraitsCommandInput, + HttpPayloadTraitsCommandOutput, +} from "./commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommand, + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithStructureCommand, + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "./commands/HttpPayloadWithStructureCommand"; +import { + HttpPrefixHeadersCommand, + HttpPrefixHeadersCommandInput, + HttpPrefixHeadersCommandOutput, +} from "./commands/HttpPrefixHeadersCommand"; +import { + HttpPrefixHeadersResponseCommand, + HttpPrefixHeadersResponseCommandInput, + HttpPrefixHeadersResponseCommandOutput, +} from "./commands/HttpPrefixHeadersResponseCommand"; +import { + HttpRequestWithFloatLabelsCommand, + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "./commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommand, + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommand, + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommand, + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "./commands/HttpRequestWithLabelsCommand"; +import { + HttpResponseCodeCommand, + HttpResponseCodeCommandInput, + HttpResponseCodeCommandOutput, +} from "./commands/HttpResponseCodeCommand"; +import { + HttpStringPayloadCommand, + HttpStringPayloadCommandInput, + HttpStringPayloadCommandOutput, +} from "./commands/HttpStringPayloadCommand"; +import { + IgnoreQueryParamsInResponseCommand, + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "./commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommand, + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "./commands/InputAndOutputWithHeadersCommand"; +import { JsonBlobsCommand, JsonBlobsCommandInput, JsonBlobsCommandOutput } from "./commands/JsonBlobsCommand"; +import { JsonEnumsCommand, JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; +import { JsonListsCommand, JsonListsCommandInput, JsonListsCommandOutput } from "./commands/JsonListsCommand"; +import { JsonMapsCommand, JsonMapsCommandInput, JsonMapsCommandOutput } from "./commands/JsonMapsCommand"; +import { + JsonTimestampsCommand, + JsonTimestampsCommandInput, + 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, + MediaTypeHeaderCommandOutput, +} from "./commands/MediaTypeHeaderCommand"; +import { + NoInputAndNoOutputCommand, + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, +} from "./commands/NoInputAndNoOutputCommand"; +import { + NoInputAndOutputCommand, + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, +} from "./commands/NoInputAndOutputCommand"; +import { + NullAndEmptyHeadersClientCommand, + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "./commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommand, + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "./commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommand, + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "./commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommand, + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommand, + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "./commands/QueryParamsAsStringListMapCommand"; +import { + QueryPrecedenceCommand, + QueryPrecedenceCommandInput, + QueryPrecedenceCommandOutput, +} from "./commands/QueryPrecedenceCommand"; +import { + RecursiveShapesCommand, + RecursiveShapesCommandInput, + RecursiveShapesCommandOutput, +} from "./commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommand, + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { + StreamingTraitsCommand, + StreamingTraitsCommandInput, + StreamingTraitsCommandOutput, +} from "./commands/StreamingTraitsCommand"; +import { + StreamingTraitsRequireLengthCommand, + StreamingTraitsRequireLengthCommandInput, + StreamingTraitsRequireLengthCommandOutput, +} from "./commands/StreamingTraitsRequireLengthCommand"; +import { + StreamingTraitsWithMediaTypeCommand, + StreamingTraitsWithMediaTypeCommandInput, + StreamingTraitsWithMediaTypeCommandOutput, +} from "./commands/StreamingTraitsWithMediaTypeCommand"; +import { + TimestampFormatHeadersCommand, + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "./commands/TimestampFormatHeadersCommand"; +import { RestJsonProtocolClient } from "./RestJsonProtocolClient"; + +/** + * A REST JSON service that sends JSON requests and responses. + */ +export class RestJsonProtocol extends RestJsonProtocolClient { + /** + * This example uses all query string types. + */ + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): void; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): void; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AllQueryStringTypesCommandOutput) => void), + cb?: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): Promise | void { + const command = new AllQueryStringTypesCommand(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 uses fixed query string params and variable query string params. + * The fixed query string parameters and variable parameters must both be + * serialized (implementations may need to merge them together). + */ + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): void; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): void; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void), + cb?: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): Promise | void { + const command = new ConstantAndVariableQueryStringCommand(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 uses a constant query string parameters and a label. + * This simply tests that labels and query string parameters are + * compatible. The fixed query string parameter named "hello" should + * in no way conflict with the label, `{hello}`. + */ + public constantQueryString( + args: ConstantQueryStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public constantQueryString( + args: ConstantQueryStringCommandInput, + cb: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): void; + public constantQueryString( + args: ConstantQueryStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): void; + public constantQueryString( + args: ConstantQueryStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantQueryStringCommandOutput) => void), + cb?: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): Promise | void { + const command = new ConstantQueryStringCommand(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 a document as part of the payload. + */ + public documentType( + args: DocumentTypeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public documentType(args: DocumentTypeCommandInput, cb: (err: any, data?: DocumentTypeCommandOutput) => void): void; + public documentType( + args: DocumentTypeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DocumentTypeCommandOutput) => void + ): void; + public documentType( + args: DocumentTypeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DocumentTypeCommandOutput) => void), + cb?: (err: any, data?: DocumentTypeCommandOutput) => void + ): Promise | void { + const command = new DocumentTypeCommand(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 a document as the entire HTTP payload. + */ + public documentTypeAsPayload( + args: DocumentTypeAsPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public documentTypeAsPayload( + args: DocumentTypeAsPayloadCommandInput, + cb: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void + ): void; + public documentTypeAsPayload( + args: DocumentTypeAsPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void + ): void; + public documentTypeAsPayload( + args: DocumentTypeAsPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DocumentTypeAsPayloadCommandOutput) => void), + cb?: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void + ): Promise | void { + const command = new DocumentTypeAsPayloadCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + */ + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), + cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): Promise | void { + const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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 has four possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * 4. A FooError. + * + * Implementations must be able to successfully take a response and + * properly (de)serialize successful and error responses based on the + * the presence of the + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 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 tests httpChecksumRequired trait + */ + public httpChecksumRequired( + args: HttpChecksumRequiredCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpChecksumRequired( + args: HttpChecksumRequiredCommandInput, + cb: (err: any, data?: HttpChecksumRequiredCommandOutput) => void + ): void; + public httpChecksumRequired( + args: HttpChecksumRequiredCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpChecksumRequiredCommandOutput) => void + ): void; + public httpChecksumRequired( + args: HttpChecksumRequiredCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpChecksumRequiredCommandOutput) => void), + cb?: (err: any, data?: HttpChecksumRequiredCommandOutput) => void + ): Promise | void { + const command = new HttpChecksumRequiredCommand(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 httpEnumPayload( + args: HttpEnumPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpEnumPayload( + args: HttpEnumPayloadCommandInput, + cb: (err: any, data?: HttpEnumPayloadCommandOutput) => void + ): void; + public httpEnumPayload( + args: HttpEnumPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpEnumPayloadCommandOutput) => void + ): void; + public httpEnumPayload( + args: HttpEnumPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpEnumPayloadCommandOutput) => void), + cb?: (err: any, data?: HttpEnumPayloadCommandOutput) => void + ): Promise | void { + const command = new HttpEnumPayloadCommand(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 examples serializes a blob shape in the payload. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + */ + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): void; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): void; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadTraitsCommand(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 examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + */ + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): void; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): void; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadTraitsWithMediaTypeCommand(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 examples serializes a structure in the payload. + * + * Note that serializing a structure changes the wrapper element name + * to match the targeted structure. + */ + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): void; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): void; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithStructureCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithStructureCommand(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 examples adds headers to the input of a request and response by prefix. + */ + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): void; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): void; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersCommandOutput) => void), + cb?: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): Promise | void { + const command = new HttpPrefixHeadersCommand(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); + } + } + + /** + * Clients that perform this test extract all headers from the response. + */ + public httpPrefixHeadersResponse( + args: HttpPrefixHeadersResponseCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPrefixHeadersResponse( + args: HttpPrefixHeadersResponseCommandInput, + cb: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void + ): void; + public httpPrefixHeadersResponse( + args: HttpPrefixHeadersResponseCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void + ): void; + public httpPrefixHeadersResponse( + args: HttpPrefixHeadersResponseCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void), + cb?: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void + ): Promise | void { + const command = new HttpPrefixHeadersResponseCommand(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 httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): void; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): void; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithFloatLabelsCommand(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 httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): void; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): void; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithGreedyLabelInPathCommand(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 example tests how requests are serialized when there's no input + * payload but there are HTTP labels. + */ + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): void; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): void; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithLabelsCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithLabelsCommand(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 example tests how requests serialize different timestamp formats in the + * URI path. + */ + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): void; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): void; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithLabelsAndTimestampFormatCommand(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 httpResponseCode( + args: HttpResponseCodeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + cb: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): void; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): void; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpResponseCodeCommandOutput) => void), + cb?: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): Promise | void { + const command = new HttpResponseCodeCommand(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 httpStringPayload( + args: HttpStringPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpStringPayload( + args: HttpStringPayloadCommandInput, + cb: (err: any, data?: HttpStringPayloadCommandOutput) => void + ): void; + public httpStringPayload( + args: HttpStringPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpStringPayloadCommandOutput) => void + ): void; + public httpStringPayload( + args: HttpStringPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpStringPayloadCommandOutput) => void), + cb?: (err: any, data?: HttpStringPayloadCommandOutput) => void + ): Promise | void { + const command = new HttpStringPayloadCommand(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 query string bound request parameters are + * serialized in the body of responses if the structure is used in both + * the request and response. + */ + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): void; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): void; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void), + cb?: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): Promise | void { + const command = new IgnoreQueryParamsInResponseCommand(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 example tests how requests and responses are serialized when there is + * no input or output payload but there are HTTP header bindings. + */ + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): void; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): void; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: InputAndOutputWithHeadersCommandOutput) => void), + cb?: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): Promise | void { + const command = new InputAndOutputWithHeadersCommand(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); + } + } + + /** + * Blobs are base64 encoded + */ + public jsonBlobs(args: JsonBlobsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonBlobs(args: JsonBlobsCommandInput, cb: (err: any, data?: JsonBlobsCommandOutput) => void): void; + public jsonBlobs( + args: JsonBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonBlobsCommandOutput) => void + ): void; + public jsonBlobs( + args: JsonBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonBlobsCommandOutput) => void), + cb?: (err: any, data?: JsonBlobsCommandOutput) => void + ): Promise | void { + const command = new JsonBlobsCommand(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. + */ + public jsonEnums(args: JsonEnumsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonEnums(args: JsonEnumsCommandInput, cb: (err: any, data?: JsonEnumsCommandOutput) => void): void; + public jsonEnums( + args: JsonEnumsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonEnumsCommandOutput) => void + ): void; + public jsonEnums( + args: JsonEnumsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonEnumsCommandOutput) => void), + cb?: (err: any, data?: JsonEnumsCommandOutput) => void + ): Promise | void { + const command = new JsonEnumsCommand(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 test case serializes JSON lists for the following cases for both + * input and output: + * + * 1. Normal JSON lists. + * 2. Normal JSON sets. + * 3. JSON lists of lists. + * 4. Lists of structures. + */ + public jsonLists(args: JsonListsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonLists(args: JsonListsCommandInput, cb: (err: any, data?: JsonListsCommandOutput) => void): void; + public jsonLists( + args: JsonListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonListsCommandOutput) => void + ): void; + public jsonLists( + args: JsonListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonListsCommandOutput) => void), + cb?: (err: any, data?: JsonListsCommandOutput) => void + ): Promise | void { + const command = new JsonListsCommand(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 example tests basic map serialization. + */ + public jsonMaps(args: JsonMapsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonMaps(args: JsonMapsCommandInput, cb: (err: any, data?: JsonMapsCommandOutput) => void): void; + public jsonMaps( + args: JsonMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonMapsCommandOutput) => void + ): void; + public jsonMaps( + args: JsonMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonMapsCommandOutput) => void), + cb?: (err: any, data?: JsonMapsCommandOutput) => void + ): Promise | void { + const command = new JsonMapsCommand(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 tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + */ + public jsonTimestamps( + args: JsonTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public jsonTimestamps( + args: JsonTimestampsCommandInput, + cb: (err: any, data?: JsonTimestampsCommandOutput) => void + ): void; + public jsonTimestamps( + args: JsonTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonTimestampsCommandOutput) => void + ): void; + public jsonTimestamps( + args: JsonTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonTimestampsCommandOutput) => void), + cb?: (err: any, data?: JsonTimestampsCommandOutput) => void + ): Promise | void { + const command = new JsonTimestampsCommand(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. + */ + public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; + public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; + public jsonUnions( + args: JsonUnionsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: JsonUnionsCommandOutput) => void + ): void; + public jsonUnions( + args: JsonUnionsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), + cb?: (err: any, data?: JsonUnionsCommandOutput) => void + ): Promise | void { + const command = new JsonUnionsCommand(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 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. + */ + public mediaTypeHeader( + args: MediaTypeHeaderCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public mediaTypeHeader( + args: MediaTypeHeaderCommandInput, + cb: (err: any, data?: MediaTypeHeaderCommandOutput) => void + ): void; + public mediaTypeHeader( + args: MediaTypeHeaderCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: MediaTypeHeaderCommandOutput) => void + ): void; + public mediaTypeHeader( + args: MediaTypeHeaderCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MediaTypeHeaderCommandOutput) => void), + cb?: (err: any, data?: MediaTypeHeaderCommandOutput) => void + ): Promise | void { + const command = new MediaTypeHeaderCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + */ + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + */ + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndOutputCommand(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); + } + } + + /** + * Null and empty headers are not sent over the wire. + */ + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): void; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): void; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void), + cb?: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): Promise | void { + const command = new NullAndEmptyHeadersClientCommand(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); + } + } + + /** + * Null and empty headers are not sent over the wire. + */ + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): void; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): void; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void), + cb?: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): Promise | void { + const command = new NullAndEmptyHeadersServerCommand(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); + } + } + + /** + * Omits null, but serializes empty string value. + */ + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): void; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): void; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void), + cb?: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): Promise | void { + const command = new OmitsNullSerializesEmptyStringCommand(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); + } + } + + /** + * Automatically adds idempotency tokens. + */ + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), + cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): Promise | void { + const command = new QueryIdempotencyTokenAutoFillCommand(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 queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): void; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): void; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryParamsAsStringListMapCommandOutput) => void), + cb?: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): Promise | void { + const command = new QueryParamsAsStringListMapCommand(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 queryPrecedence( + args: QueryPrecedenceCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + cb: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): void; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): void; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryPrecedenceCommandOutput) => void), + cb?: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): Promise | void { + const command = new QueryPrecedenceCommand(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); + } + } + + /** + * Recursive shapes + */ + public recursiveShapes( + args: RecursiveShapesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public recursiveShapes( + args: RecursiveShapesCommandInput, + cb: (err: any, data?: RecursiveShapesCommandOutput) => void + ): void; + public recursiveShapes( + args: RecursiveShapesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: RecursiveShapesCommandOutput) => void + ): void; + public recursiveShapes( + args: RecursiveShapesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveShapesCommandOutput) => void), + cb?: (err: any, data?: RecursiveShapesCommandOutput) => void + ): Promise | void { + const command = new RecursiveShapesCommand(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 simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarPropertiesCommand(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 examples serializes a streaming blob shape in the request body. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + */ + public streamingTraits( + args: StreamingTraitsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public streamingTraits( + args: StreamingTraitsCommandInput, + cb: (err: any, data?: StreamingTraitsCommandOutput) => void + ): void; + public streamingTraits( + args: StreamingTraitsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: StreamingTraitsCommandOutput) => void + ): void; + public streamingTraits( + args: StreamingTraitsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsCommandOutput) => void), + cb?: (err: any, data?: StreamingTraitsCommandOutput) => void + ): Promise | void { + const command = new StreamingTraitsCommand(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 examples serializes a streaming blob shape with a required content + * length in the request body. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + */ + public streamingTraitsRequireLength( + args: StreamingTraitsRequireLengthCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public streamingTraitsRequireLength( + args: StreamingTraitsRequireLengthCommandInput, + cb: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void + ): void; + public streamingTraitsRequireLength( + args: StreamingTraitsRequireLengthCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void + ): void; + public streamingTraitsRequireLength( + args: StreamingTraitsRequireLengthCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void), + cb?: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void + ): Promise | void { + const command = new StreamingTraitsRequireLengthCommand(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 examples serializes a streaming media-typed blob shape in the request body. + * + * This examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + */ + public streamingTraitsWithMediaType( + args: StreamingTraitsWithMediaTypeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public streamingTraitsWithMediaType( + args: StreamingTraitsWithMediaTypeCommandInput, + cb: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void + ): void; + public streamingTraitsWithMediaType( + args: StreamingTraitsWithMediaTypeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void + ): void; + public streamingTraitsWithMediaType( + args: StreamingTraitsWithMediaTypeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void), + cb?: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void + ): Promise | void { + const command = new StreamingTraitsWithMediaTypeCommand(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 tests how timestamp request and response headers are serialized. + */ + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): void; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): void; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TimestampFormatHeadersCommandOutput) => void), + cb?: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): Promise | void { + const command = new TimestampFormatHeadersCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts new file mode 100644 index 000000000000..c59738cacb33 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts @@ -0,0 +1,605 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + StreamHasher as __StreamHasher, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; +import { Readable } from "stream"; + +import { + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "./commands/AllQueryStringTypesCommand"; +import { + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "./commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "./commands/ConstantQueryStringCommand"; +import { + DocumentTypeAsPayloadCommandInput, + DocumentTypeAsPayloadCommandOutput, +} from "./commands/DocumentTypeAsPayloadCommand"; +import { DocumentTypeCommandInput, DocumentTypeCommandOutput } from "./commands/DocumentTypeCommand"; +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; +import { + HttpChecksumRequiredCommandInput, + HttpChecksumRequiredCommandOutput, +} from "./commands/HttpChecksumRequiredCommand"; +import { HttpEnumPayloadCommandInput, HttpEnumPayloadCommandOutput } from "./commands/HttpEnumPayloadCommand"; +import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "./commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "./commands/HttpPayloadWithStructureCommand"; +import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "./commands/HttpPrefixHeadersCommand"; +import { + HttpPrefixHeadersResponseCommandInput, + HttpPrefixHeadersResponseCommandOutput, +} from "./commands/HttpPrefixHeadersResponseCommand"; +import { + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "./commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "./commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "./commands/HttpResponseCodeCommand"; +import { HttpStringPayloadCommandInput, HttpStringPayloadCommandOutput } from "./commands/HttpStringPayloadCommand"; +import { + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "./commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "./commands/InputAndOutputWithHeadersCommand"; +import { JsonBlobsCommandInput, JsonBlobsCommandOutput } from "./commands/JsonBlobsCommand"; +import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; +import { JsonListsCommandInput, JsonListsCommandOutput } from "./commands/JsonListsCommand"; +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"; +import { + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "./commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "./commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "./commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "./commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "./commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "./commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { StreamingTraitsCommandInput, StreamingTraitsCommandOutput } from "./commands/StreamingTraitsCommand"; +import { + StreamingTraitsRequireLengthCommandInput, + StreamingTraitsRequireLengthCommandOutput, +} from "./commands/StreamingTraitsRequireLengthCommand"; +import { + StreamingTraitsWithMediaTypeCommandInput, + StreamingTraitsWithMediaTypeCommandOutput, +} from "./commands/StreamingTraitsWithMediaTypeCommand"; +import { + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "./commands/TimestampFormatHeadersCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | AllQueryStringTypesCommandInput + | ConstantAndVariableQueryStringCommandInput + | ConstantQueryStringCommandInput + | DocumentTypeAsPayloadCommandInput + | DocumentTypeCommandInput + | EmptyInputAndEmptyOutputCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | GreetingWithErrorsCommandInput + | HostWithPathOperationCommandInput + | HttpChecksumRequiredCommandInput + | HttpEnumPayloadCommandInput + | HttpPayloadTraitsCommandInput + | HttpPayloadTraitsWithMediaTypeCommandInput + | HttpPayloadWithStructureCommandInput + | HttpPrefixHeadersCommandInput + | HttpPrefixHeadersResponseCommandInput + | HttpRequestWithFloatLabelsCommandInput + | HttpRequestWithGreedyLabelInPathCommandInput + | HttpRequestWithLabelsAndTimestampFormatCommandInput + | HttpRequestWithLabelsCommandInput + | HttpResponseCodeCommandInput + | HttpStringPayloadCommandInput + | IgnoreQueryParamsInResponseCommandInput + | InputAndOutputWithHeadersCommandInput + | JsonBlobsCommandInput + | JsonEnumsCommandInput + | JsonListsCommandInput + | 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 + | NullAndEmptyHeadersClientCommandInput + | NullAndEmptyHeadersServerCommandInput + | OmitsNullSerializesEmptyStringCommandInput + | QueryIdempotencyTokenAutoFillCommandInput + | QueryParamsAsStringListMapCommandInput + | QueryPrecedenceCommandInput + | RecursiveShapesCommandInput + | SimpleScalarPropertiesCommandInput + | StreamingTraitsCommandInput + | StreamingTraitsRequireLengthCommandInput + | StreamingTraitsWithMediaTypeCommandInput + | TimestampFormatHeadersCommandInput; + +export type ServiceOutputTypes = + | AllQueryStringTypesCommandOutput + | ConstantAndVariableQueryStringCommandOutput + | ConstantQueryStringCommandOutput + | DocumentTypeAsPayloadCommandOutput + | DocumentTypeCommandOutput + | EmptyInputAndEmptyOutputCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | GreetingWithErrorsCommandOutput + | HostWithPathOperationCommandOutput + | HttpChecksumRequiredCommandOutput + | HttpEnumPayloadCommandOutput + | HttpPayloadTraitsCommandOutput + | HttpPayloadTraitsWithMediaTypeCommandOutput + | HttpPayloadWithStructureCommandOutput + | HttpPrefixHeadersCommandOutput + | HttpPrefixHeadersResponseCommandOutput + | HttpRequestWithFloatLabelsCommandOutput + | HttpRequestWithGreedyLabelInPathCommandOutput + | HttpRequestWithLabelsAndTimestampFormatCommandOutput + | HttpRequestWithLabelsCommandOutput + | HttpResponseCodeCommandOutput + | HttpStringPayloadCommandOutput + | IgnoreQueryParamsInResponseCommandOutput + | InputAndOutputWithHeadersCommandOutput + | JsonBlobsCommandOutput + | JsonEnumsCommandOutput + | JsonListsCommandOutput + | 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 + | NullAndEmptyHeadersClientCommandOutput + | NullAndEmptyHeadersServerCommandOutput + | OmitsNullSerializesEmptyStringCommandOutput + | QueryIdempotencyTokenAutoFillCommandOutput + | QueryParamsAsStringListMapCommandOutput + | QueryPrecedenceCommandOutput + | RecursiveShapesCommandOutput + | SimpleScalarPropertiesCommandOutput + | StreamingTraitsCommandOutput + | StreamingTraitsRequireLengthCommandOutput + | StreamingTraitsWithMediaTypeCommandOutput + | TimestampFormatHeadersCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; + + /** + * A function that, given a hash constructor and a stream, calculates the + * hash of the streamed value. + * @internal + */ + streamHasher?: __StreamHasher | __StreamHasher; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes MD5 hashes. + * @internal + */ + md5?: __HashConstructor; +} + +type RestJsonProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of RestJsonProtocolClient class constructor that set the region, credentials and other options. + */ +export interface RestJsonProtocolClientConfig extends RestJsonProtocolClientConfigType {} + +type RestJsonProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of RestJsonProtocolClient class. This is resolved and normalized from the {@link RestJsonProtocolClientConfig | constructor configuration interface}. + */ +export interface RestJsonProtocolClientResolvedConfig extends RestJsonProtocolClientResolvedConfigType {} + +/** + * A REST JSON service that sends JSON requests and responses. + */ +export class RestJsonProtocolClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + RestJsonProtocolClientResolvedConfig +> { + /** + * The resolved configuration of RestJsonProtocolClient class. This is resolved and normalized from the {@link RestJsonProtocolClientConfig | constructor configuration interface}. + */ + readonly config: RestJsonProtocolClientResolvedConfig; + + constructor(configuration: RestJsonProtocolClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveUserAgentConfig(_config_4); + super(_config_5); + this.config = _config_5; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts new file mode 100644 index 000000000000..086e9d19fe4c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts @@ -0,0 +1,95 @@ +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 { AllQueryStringTypesInput } from "../models/models_0"; +import { + deserializeAws_restJson1AllQueryStringTypesCommand, + serializeAws_restJson1AllQueryStringTypesCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface AllQueryStringTypesCommandInput extends AllQueryStringTypesInput {} +export interface AllQueryStringTypesCommandOutput extends __MetadataBearer {} + +/** + * This example uses all query string types. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new AllQueryStringTypesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link AllQueryStringTypesCommandInput} for command's `input` shape. + * @see {@link AllQueryStringTypesCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class AllQueryStringTypesCommand extends $Command< + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: AllQueryStringTypesCommandInput) { + // 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 = "AllQueryStringTypesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: AllQueryStringTypesInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: AllQueryStringTypesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1AllQueryStringTypesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1AllQueryStringTypesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts new file mode 100644 index 000000000000..9fa021d052b2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts @@ -0,0 +1,103 @@ +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 { ConstantAndVariableQueryStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1ConstantAndVariableQueryStringCommand, + serializeAws_restJson1ConstantAndVariableQueryStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface ConstantAndVariableQueryStringCommandInput extends ConstantAndVariableQueryStringInput {} +export interface ConstantAndVariableQueryStringCommandOutput extends __MetadataBearer {} + +/** + * This example uses fixed query string params and variable query string params. + * The fixed query string parameters and variable parameters must both be + * serialized (implementations may need to merge them together). + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, ConstantAndVariableQueryStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, ConstantAndVariableQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new ConstantAndVariableQueryStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link ConstantAndVariableQueryStringCommandInput} for command's `input` shape. + * @see {@link ConstantAndVariableQueryStringCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class ConstantAndVariableQueryStringCommand extends $Command< + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ConstantAndVariableQueryStringCommandInput) { + // 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 = "ConstantAndVariableQueryStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: ConstantAndVariableQueryStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: ConstantAndVariableQueryStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1ConstantAndVariableQueryStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1ConstantAndVariableQueryStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts new file mode 100644 index 000000000000..67e82e6ab301 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts @@ -0,0 +1,98 @@ +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 { ConstantQueryStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1ConstantQueryStringCommand, + serializeAws_restJson1ConstantQueryStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface ConstantQueryStringCommandInput extends ConstantQueryStringInput {} +export interface ConstantQueryStringCommandOutput extends __MetadataBearer {} + +/** + * This example uses a constant query string parameters and a label. + * This simply tests that labels and query string parameters are + * compatible. The fixed query string parameter named "hello" should + * in no way conflict with the label, `{hello}`. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, ConstantQueryStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, ConstantQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new ConstantQueryStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link ConstantQueryStringCommandInput} for command's `input` shape. + * @see {@link ConstantQueryStringCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class ConstantQueryStringCommand extends $Command< + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ConstantQueryStringCommandInput) { + // 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 = "ConstantQueryStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: ConstantQueryStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: ConstantQueryStringCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1ConstantQueryStringCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1ConstantQueryStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts new file mode 100644 index 000000000000..5b8751cdf867 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts @@ -0,0 +1,95 @@ +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 { DocumentTypeAsPayloadInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1DocumentTypeAsPayloadCommand, + serializeAws_restJson1DocumentTypeAsPayloadCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface DocumentTypeAsPayloadCommandInput extends DocumentTypeAsPayloadInputOutput {} +export interface DocumentTypeAsPayloadCommandOutput extends DocumentTypeAsPayloadInputOutput, __MetadataBearer {} + +/** + * This example serializes a document as the entire HTTP payload. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, DocumentTypeAsPayloadCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, DocumentTypeAsPayloadCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new DocumentTypeAsPayloadCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link DocumentTypeAsPayloadCommandInput} for command's `input` shape. + * @see {@link DocumentTypeAsPayloadCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class DocumentTypeAsPayloadCommand extends $Command< + DocumentTypeAsPayloadCommandInput, + DocumentTypeAsPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: DocumentTypeAsPayloadCommandInput) { + // 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 = "DocumentTypeAsPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: DocumentTypeAsPayloadInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: DocumentTypeAsPayloadInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: DocumentTypeAsPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1DocumentTypeAsPayloadCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1DocumentTypeAsPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts new file mode 100644 index 000000000000..0f1352469230 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts @@ -0,0 +1,95 @@ +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 { DocumentTypeInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1DocumentTypeCommand, + serializeAws_restJson1DocumentTypeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface DocumentTypeCommandInput extends DocumentTypeInputOutput {} +export interface DocumentTypeCommandOutput extends DocumentTypeInputOutput, __MetadataBearer {} + +/** + * This example serializes a document as part of the payload. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, DocumentTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, DocumentTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new DocumentTypeCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link DocumentTypeCommandInput} for command's `input` shape. + * @see {@link DocumentTypeCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class DocumentTypeCommand extends $Command< + DocumentTypeCommandInput, + DocumentTypeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: DocumentTypeCommandInput) { + // 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 = "DocumentTypeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: DocumentTypeInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: DocumentTypeInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: DocumentTypeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1DocumentTypeCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1DocumentTypeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts new file mode 100644 index 000000000000..24f726b44100 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts @@ -0,0 +1,98 @@ +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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1EmptyInputAndEmptyOutputCommand, + serializeAws_restJson1EmptyInputAndEmptyOutputCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} +export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new EmptyInputAndEmptyOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. + * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class EmptyInputAndEmptyOutputCommand extends $Command< + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { + // 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 = "EmptyInputAndEmptyOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1EmptyInputAndEmptyOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1EmptyInputAndEmptyOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..f334f5451db5 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.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_restJson1EndpointOperationCommand, + serializeAws_restJson1EndpointOperationCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // 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 = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1EndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1EndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..0e06aa0d5fbc --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.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 { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_restJson1EndpointWithHostLabelOperationCommand, + serializeAws_restJson1EndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // 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 = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1EndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1EndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..d752fcf6af4b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,104 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_restJson1GreetingWithErrorsCommand, + serializeAws_restJson1GreetingWithErrorsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has four possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * 4. A FooError. + * + * Implementations must be able to successfully take a response and + * properly (de)serialize successful and error responses based on the + * the presence of the + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // 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 = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1GreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1GreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts new file mode 100644 index 000000000000..f21860180d6b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/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_restJson1HostWithPathOperationCommand, + serializeAws_restJson1HostWithPathOperationCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // 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: 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 = "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_restJson1HostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts new file mode 100644 index 000000000000..b36be66e0461 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts @@ -0,0 +1,97 @@ +import { getApplyMd5BodyChecksumPlugin } from "@aws-sdk/middleware-apply-body-checksum"; +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 { HttpChecksumRequiredInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpChecksumRequiredCommand, + serializeAws_restJson1HttpChecksumRequiredCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpChecksumRequiredCommandInput extends HttpChecksumRequiredInputOutput {} +export interface HttpChecksumRequiredCommandOutput extends HttpChecksumRequiredInputOutput, __MetadataBearer {} + +/** + * This example tests httpChecksumRequired trait + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpChecksumRequiredCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpChecksumRequiredCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpChecksumRequiredCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpChecksumRequiredCommandInput} for command's `input` shape. + * @see {@link HttpChecksumRequiredCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpChecksumRequiredCommand extends $Command< + HttpChecksumRequiredCommandInput, + HttpChecksumRequiredCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpChecksumRequiredCommandInput) { + // 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)); + this.middlewareStack.use(getApplyMd5BodyChecksumPlugin(configuration)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "HttpChecksumRequiredCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpChecksumRequiredInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpChecksumRequiredInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpChecksumRequiredCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpChecksumRequiredCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpChecksumRequiredCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts new file mode 100644 index 000000000000..53f57c4ddc6a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.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 { EnumPayloadInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpEnumPayloadCommand, + serializeAws_restJson1HttpEnumPayloadCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpEnumPayloadCommandInput extends EnumPayloadInput {} +export interface HttpEnumPayloadCommandOutput extends EnumPayloadInput, __MetadataBearer {} + +export class HttpEnumPayloadCommand extends $Command< + HttpEnumPayloadCommandInput, + HttpEnumPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpEnumPayloadCommandInput) { + // 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 = "HttpEnumPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EnumPayloadInput.filterSensitiveLog, + outputFilterSensitiveLog: EnumPayloadInput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpEnumPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpEnumPayloadCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpEnumPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts new file mode 100644 index 000000000000..e92db52fc102 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts @@ -0,0 +1,98 @@ +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 { HttpPayloadTraitsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpPayloadTraitsCommand, + serializeAws_restJson1HttpPayloadTraitsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpPayloadTraitsCommandInput extends HttpPayloadTraitsInputOutput {} +export interface HttpPayloadTraitsCommandOutput extends HttpPayloadTraitsInputOutput, __MetadataBearer {} + +/** + * This examples serializes a blob shape in the payload. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpPayloadTraitsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpPayloadTraitsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpPayloadTraitsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadTraitsCommandInput} for command's `input` shape. + * @see {@link HttpPayloadTraitsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadTraitsCommand extends $Command< + HttpPayloadTraitsCommandInput, + HttpPayloadTraitsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadTraitsCommandInput) { + // 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 = "HttpPayloadTraitsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpPayloadTraitsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpPayloadTraitsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts new file mode 100644 index 000000000000..2b8bd6eba142 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts @@ -0,0 +1,104 @@ +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 { HttpPayloadTraitsWithMediaTypeInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand, + serializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpPayloadTraitsWithMediaTypeCommandInput extends HttpPayloadTraitsWithMediaTypeInputOutput {} +export interface HttpPayloadTraitsWithMediaTypeCommandOutput + extends HttpPayloadTraitsWithMediaTypeInputOutput, + __MetadataBearer {} + +/** + * This examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpPayloadTraitsWithMediaTypeCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadTraitsWithMediaTypeCommandInput} for command's `input` shape. + * @see {@link HttpPayloadTraitsWithMediaTypeCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadTraitsWithMediaTypeCommand extends $Command< + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadTraitsWithMediaTypeCommandInput) { + // 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 = "HttpPayloadTraitsWithMediaTypeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpPayloadTraitsWithMediaTypeCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts new file mode 100644 index 000000000000..1128967853b9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts @@ -0,0 +1,98 @@ +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 { HttpPayloadWithStructureInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpPayloadWithStructureCommand, + serializeAws_restJson1HttpPayloadWithStructureCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpPayloadWithStructureCommandInput extends HttpPayloadWithStructureInputOutput {} +export interface HttpPayloadWithStructureCommandOutput extends HttpPayloadWithStructureInputOutput, __MetadataBearer {} + +/** + * This examples serializes a structure in the payload. + * + * Note that serializing a structure changes the wrapper element name + * to match the targeted structure. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpPayloadWithStructureCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpPayloadWithStructureCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpPayloadWithStructureCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithStructureCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithStructureCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithStructureCommand extends $Command< + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithStructureCommandInput) { + // 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 = "HttpPayloadWithStructureCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadWithStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpPayloadWithStructureCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpPayloadWithStructureCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts new file mode 100644 index 000000000000..26f4f0e3616c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts @@ -0,0 +1,95 @@ +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 { HttpPrefixHeadersInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpPrefixHeadersCommand, + serializeAws_restJson1HttpPrefixHeadersCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpPrefixHeadersCommandInput extends HttpPrefixHeadersInputOutput {} +export interface HttpPrefixHeadersCommandOutput extends HttpPrefixHeadersInputOutput, __MetadataBearer {} + +/** + * This examples adds headers to the input of a request and response by prefix. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpPrefixHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpPrefixHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpPrefixHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPrefixHeadersCommandInput} for command's `input` shape. + * @see {@link HttpPrefixHeadersCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPrefixHeadersCommand extends $Command< + HttpPrefixHeadersCommandInput, + HttpPrefixHeadersCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPrefixHeadersCommandInput) { + // 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 = "HttpPrefixHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPrefixHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpPrefixHeadersCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpPrefixHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts new file mode 100644 index 000000000000..4aa93c192d3c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts @@ -0,0 +1,98 @@ +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 { HttpPrefixHeadersResponseOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpPrefixHeadersResponseCommand, + serializeAws_restJson1HttpPrefixHeadersResponseCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpPrefixHeadersResponseCommandInput {} +export interface HttpPrefixHeadersResponseCommandOutput extends HttpPrefixHeadersResponseOutput, __MetadataBearer {} + +/** + * Clients that perform this test extract all headers from the response. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpPrefixHeadersResponseCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpPrefixHeadersResponseCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpPrefixHeadersResponseCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPrefixHeadersResponseCommandInput} for command's `input` shape. + * @see {@link HttpPrefixHeadersResponseCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPrefixHeadersResponseCommand extends $Command< + HttpPrefixHeadersResponseCommandInput, + HttpPrefixHeadersResponseCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPrefixHeadersResponseCommandInput) { + // 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 = "HttpPrefixHeadersResponseCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: HttpPrefixHeadersResponseOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPrefixHeadersResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpPrefixHeadersResponseCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1HttpPrefixHeadersResponseCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts new file mode 100644 index 000000000000..0bf39efae04c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.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 { HttpRequestWithFloatLabelsInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpRequestWithFloatLabelsCommand, + serializeAws_restJson1HttpRequestWithFloatLabelsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpRequestWithFloatLabelsCommandInput extends HttpRequestWithFloatLabelsInput {} +export interface HttpRequestWithFloatLabelsCommandOutput extends __MetadataBearer {} + +export class HttpRequestWithFloatLabelsCommand extends $Command< + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithFloatLabelsCommandInput) { + // 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 = "HttpRequestWithFloatLabelsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithFloatLabelsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpRequestWithFloatLabelsCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1HttpRequestWithFloatLabelsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts new file mode 100644 index 000000000000..8dbe6577af22 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.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 { HttpRequestWithGreedyLabelInPathInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand, + serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpRequestWithGreedyLabelInPathCommandInput extends HttpRequestWithGreedyLabelInPathInput {} +export interface HttpRequestWithGreedyLabelInPathCommandOutput extends __MetadataBearer {} + +export class HttpRequestWithGreedyLabelInPathCommand extends $Command< + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithGreedyLabelInPathCommandInput) { + // 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 = "HttpRequestWithGreedyLabelInPathCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithGreedyLabelInPathInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpRequestWithGreedyLabelInPathCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts new file mode 100644 index 000000000000..b0e0d8641556 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts @@ -0,0 +1,106 @@ +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 { HttpRequestWithLabelsAndTimestampFormatInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand, + serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpRequestWithLabelsAndTimestampFormatCommandInput + extends HttpRequestWithLabelsAndTimestampFormatInput {} +export interface HttpRequestWithLabelsAndTimestampFormatCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests serialize different timestamp formats in the + * URI path. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpRequestWithLabelsAndTimestampFormatCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandInput} for command's `input` shape. + * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpRequestWithLabelsAndTimestampFormatCommand extends $Command< + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithLabelsAndTimestampFormatCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler< + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput + > { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "HttpRequestWithLabelsAndTimestampFormatCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithLabelsAndTimestampFormatInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpRequestWithLabelsAndTimestampFormatCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts new file mode 100644 index 000000000000..7b1a5282170a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts @@ -0,0 +1,96 @@ +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 { HttpRequestWithLabelsInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpRequestWithLabelsCommand, + serializeAws_restJson1HttpRequestWithLabelsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpRequestWithLabelsCommandInput extends HttpRequestWithLabelsInput {} +export interface HttpRequestWithLabelsCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests are serialized when there's no input + * payload but there are HTTP labels. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, HttpRequestWithLabelsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, HttpRequestWithLabelsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new HttpRequestWithLabelsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpRequestWithLabelsCommandInput} for command's `input` shape. + * @see {@link HttpRequestWithLabelsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpRequestWithLabelsCommand extends $Command< + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithLabelsCommandInput) { + // 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 = "HttpRequestWithLabelsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithLabelsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpRequestWithLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpRequestWithLabelsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpRequestWithLabelsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts new file mode 100644 index 000000000000..92230590ce55 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.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 { HttpResponseCodeOutput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpResponseCodeCommand, + serializeAws_restJson1HttpResponseCodeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpResponseCodeCommandInput {} +export interface HttpResponseCodeCommandOutput extends HttpResponseCodeOutput, __MetadataBearer {} + +export class HttpResponseCodeCommand extends $Command< + HttpResponseCodeCommandInput, + HttpResponseCodeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpResponseCodeCommandInput) { + // 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 = "HttpResponseCodeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: HttpResponseCodeOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpResponseCodeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpResponseCodeCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpResponseCodeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts new file mode 100644 index 000000000000..38a7c30b64d0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.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 { StringPayloadInput } from "../models/models_0"; +import { + deserializeAws_restJson1HttpStringPayloadCommand, + serializeAws_restJson1HttpStringPayloadCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface HttpStringPayloadCommandInput extends StringPayloadInput {} +export interface HttpStringPayloadCommandOutput extends StringPayloadInput, __MetadataBearer {} + +export class HttpStringPayloadCommand extends $Command< + HttpStringPayloadCommandInput, + HttpStringPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpStringPayloadCommandInput) { + // 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 = "HttpStringPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: StringPayloadInput.filterSensitiveLog, + outputFilterSensitiveLog: StringPayloadInput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpStringPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HttpStringPayloadCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HttpStringPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts new file mode 100644 index 000000000000..1bab8868204b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts @@ -0,0 +1,100 @@ +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 { IgnoreQueryParamsInResponseOutput } from "../models/models_0"; +import { + deserializeAws_restJson1IgnoreQueryParamsInResponseCommand, + serializeAws_restJson1IgnoreQueryParamsInResponseCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface IgnoreQueryParamsInResponseCommandInput {} +export interface IgnoreQueryParamsInResponseCommandOutput extends IgnoreQueryParamsInResponseOutput, __MetadataBearer {} + +/** + * This example ensures that query string bound request parameters are + * serialized in the body of responses if the structure is used in both + * the request and response. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, IgnoreQueryParamsInResponseCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, IgnoreQueryParamsInResponseCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new IgnoreQueryParamsInResponseCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link IgnoreQueryParamsInResponseCommandInput} for command's `input` shape. + * @see {@link IgnoreQueryParamsInResponseCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class IgnoreQueryParamsInResponseCommand extends $Command< + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: IgnoreQueryParamsInResponseCommandInput) { + // 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 = "IgnoreQueryParamsInResponseCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: IgnoreQueryParamsInResponseOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1IgnoreQueryParamsInResponseCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1IgnoreQueryParamsInResponseCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts new file mode 100644 index 000000000000..46ddf56ab33b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts @@ -0,0 +1,99 @@ +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 { InputAndOutputWithHeadersIO } from "../models/models_0"; +import { + deserializeAws_restJson1InputAndOutputWithHeadersCommand, + serializeAws_restJson1InputAndOutputWithHeadersCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface InputAndOutputWithHeadersCommandInput extends InputAndOutputWithHeadersIO {} +export interface InputAndOutputWithHeadersCommandOutput extends InputAndOutputWithHeadersIO, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there is + * no input or output payload but there are HTTP header bindings. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, InputAndOutputWithHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, InputAndOutputWithHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new InputAndOutputWithHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link InputAndOutputWithHeadersCommandInput} for command's `input` shape. + * @see {@link InputAndOutputWithHeadersCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class InputAndOutputWithHeadersCommand extends $Command< + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: InputAndOutputWithHeadersCommandInput) { + // 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 = "InputAndOutputWithHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1InputAndOutputWithHeadersCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1InputAndOutputWithHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts new file mode 100644 index 000000000000..9c0d0d1c3033 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts @@ -0,0 +1,95 @@ +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 { JsonBlobsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonBlobsCommand, + serializeAws_restJson1JsonBlobsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonBlobsCommandInput extends JsonBlobsInputOutput {} +export interface JsonBlobsCommandOutput extends JsonBlobsInputOutput, __MetadataBearer {} + +/** + * Blobs are base64 encoded + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonBlobsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonBlobsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonBlobsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonBlobsCommandInput} for command's `input` shape. + * @see {@link JsonBlobsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonBlobsCommand extends $Command< + JsonBlobsCommandInput, + JsonBlobsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonBlobsCommandInput) { + // 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 = "JsonBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonBlobsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonBlobsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts new file mode 100644 index 000000000000..b07445bb5a5e --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts @@ -0,0 +1,95 @@ +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 { JsonEnumsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonEnumsCommand, + serializeAws_restJson1JsonEnumsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonEnumsCommandInput extends JsonEnumsInputOutput {} +export interface JsonEnumsCommandOutput extends JsonEnumsInputOutput, __MetadataBearer {} + +/** + * This example serializes enums as top level properties, in lists, sets, and maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonEnumsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonEnumsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonEnumsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonEnumsCommandInput} for command's `input` shape. + * @see {@link JsonEnumsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonEnumsCommand extends $Command< + JsonEnumsCommandInput, + JsonEnumsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonEnumsCommandInput) { + // 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 = "JsonEnumsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonEnumsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonEnumsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts new file mode 100644 index 000000000000..610e9df3866d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts @@ -0,0 +1,101 @@ +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 { JsonListsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonListsCommand, + serializeAws_restJson1JsonListsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonListsCommandInput extends JsonListsInputOutput {} +export interface JsonListsCommandOutput extends JsonListsInputOutput, __MetadataBearer {} + +/** + * This test case serializes JSON lists for the following cases for both + * input and output: + * + * 1. Normal JSON lists. + * 2. Normal JSON sets. + * 3. JSON lists of lists. + * 4. Lists of structures. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonListsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonListsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonListsCommandInput} for command's `input` shape. + * @see {@link JsonListsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonListsCommand extends $Command< + JsonListsCommandInput, + JsonListsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonListsCommandInput) { + // 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 = "JsonListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonListsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonListsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts new file mode 100644 index 000000000000..757bd2b6883c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts @@ -0,0 +1,95 @@ +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 { JsonMapsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonMapsCommand, + serializeAws_restJson1JsonMapsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonMapsCommandInput extends JsonMapsInputOutput {} +export interface JsonMapsCommandOutput extends JsonMapsInputOutput, __MetadataBearer {} + +/** + * The example tests basic map serialization. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonMapsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonMapsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonMapsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonMapsCommandInput} for command's `input` shape. + * @see {@link JsonMapsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonMapsCommand extends $Command< + JsonMapsCommandInput, + JsonMapsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonMapsCommandInput) { + // 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 = "JsonMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonMapsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonMapsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts new file mode 100644 index 000000000000..5f97b5df8189 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts @@ -0,0 +1,97 @@ +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 { JsonTimestampsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonTimestampsCommand, + serializeAws_restJson1JsonTimestampsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonTimestampsCommandInput extends JsonTimestampsInputOutput {} +export interface JsonTimestampsCommandOutput extends JsonTimestampsInputOutput, __MetadataBearer {} + +/** + * This tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonTimestampsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonTimestampsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonTimestampsCommandInput} for command's `input` shape. + * @see {@link JsonTimestampsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonTimestampsCommand extends $Command< + JsonTimestampsCommandInput, + JsonTimestampsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonTimestampsCommandInput) { + // 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 = "JsonTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: JsonTimestampsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: JsonTimestampsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts new file mode 100644 index 000000000000..60c0b1989814 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts @@ -0,0 +1,95 @@ +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 { UnionInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1JsonUnionsCommand, + serializeAws_restJson1JsonUnionsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface JsonUnionsCommandInput extends UnionInputOutput {} +export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} + +/** + * This operation uses unions for inputs and outputs. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new JsonUnionsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link JsonUnionsCommandInput} for command's `input` shape. + * @see {@link JsonUnionsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class JsonUnionsCommand extends $Command< + JsonUnionsCommandInput, + JsonUnionsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: JsonUnionsCommandInput) { + // 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 = "JsonUnionsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1JsonUnionsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1JsonUnionsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts new file mode 100644 index 000000000000..5924cd4115f6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts new file mode 100644 index 000000000000..4c1c26c29af6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts new file mode 100644 index 000000000000..f35ceeefbb7f --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedBlobCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBlobCommand.ts new file mode 100644 index 000000000000..3e6965af7561 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts new file mode 100644 index 000000000000..98a5aad1d3ea --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedByteCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedByteCommand.ts new file mode 100644 index 000000000000..9f8fb7a12cba --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts new file mode 100644 index 000000000000..13a2d1722b92 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts new file mode 100644 index 000000000000..ffd29dc98f01 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts new file mode 100644 index 000000000000..3a01c271afdd --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts new file mode 100644 index 000000000000..30771b24accd --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts new file mode 100644 index 000000000000..fd616d073aff --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedFloatCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedFloatCommand.ts new file mode 100644 index 000000000000..848f2f385de0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts new file mode 100644 index 000000000000..245c7ac610db --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedListCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedListCommand.ts new file mode 100644 index 000000000000..bd83dc11d480 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedLongCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedLongCommand.ts new file mode 100644 index 000000000000..684fbe6741af --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedMapCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedMapCommand.ts new file mode 100644 index 000000000000..080b8be8cb49 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts new file mode 100644 index 000000000000..82d284ed749e --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedSetCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedSetCommand.ts new file mode 100644 index 000000000000..22d543ddf07e --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedShortCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedShortCommand.ts new file mode 100644 index 000000000000..f769c8fc8155 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedStringCommand.ts new file mode 100644 index 000000000000..b3f509c7404b --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts new file mode 100644 index 000000000000..3b90e4391dcd --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts new file mode 100644 index 000000000000..a591ad5eaeca --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts new file mode 100644 index 000000000000..13a80d458cb0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts new file mode 100644 index 000000000000..4001c1250f31 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts new file mode 100644 index 000000000000..f13adc566c26 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts new file mode 100644 index 000000000000..2e39dadfdd7b --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts new file mode 100644 index 000000000000..5314c67f55dc --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts new file mode 100644 index 000000000000..70eb25fbe197 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts new file mode 100644 index 000000000000..4b9f3ed93a8b --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts new file mode 100644 index 000000000000..eebe83963a5f --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts new file mode 100644 index 000000000000..5473b9e4ce03 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts new file mode 100644 index 000000000000..6b60c4f74eaf --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MalformedUnionCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedUnionCommand.ts new file mode 100644 index 000000000000..9741bee2f504 --- /dev/null +++ b/protocol_tests/aws-protocoltests-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-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts new file mode 100644 index 000000000000..613815066734 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts @@ -0,0 +1,95 @@ +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 { MediaTypeHeaderInput, MediaTypeHeaderOutput } from "../models/models_0"; +import { + deserializeAws_restJson1MediaTypeHeaderCommand, + serializeAws_restJson1MediaTypeHeaderCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface MediaTypeHeaderCommandInput extends MediaTypeHeaderInput {} +export interface MediaTypeHeaderCommandOutput extends MediaTypeHeaderOutput, __MetadataBearer {} + +/** + * This example ensures that mediaType strings are base64 encoded in headers. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, MediaTypeHeaderCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, MediaTypeHeaderCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new MediaTypeHeaderCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link MediaTypeHeaderCommandInput} for command's `input` shape. + * @see {@link MediaTypeHeaderCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class MediaTypeHeaderCommand extends $Command< + MediaTypeHeaderCommandInput, + MediaTypeHeaderCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: MediaTypeHeaderCommandInput) { + // 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 = "MediaTypeHeaderCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: MediaTypeHeaderInput.filterSensitiveLog, + outputFilterSensitiveLog: MediaTypeHeaderOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: MediaTypeHeaderCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1MediaTypeHeaderCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1MediaTypeHeaderCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts new file mode 100644 index 000000000000..44653767c903 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts @@ -0,0 +1,96 @@ +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_restJson1NoInputAndNoOutputCommand, + serializeAws_restJson1NoInputAndNoOutputCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface NoInputAndNoOutputCommandInput {} +export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new NoInputAndNoOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndNoOutputCommand extends $Command< + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndNoOutputCommandInput) { + // 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 = "NoInputAndNoOutputCommand"; + 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1NoInputAndNoOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1NoInputAndNoOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts new file mode 100644 index 000000000000..b834e6b635b1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts @@ -0,0 +1,98 @@ +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 { NoInputAndOutputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1NoInputAndOutputCommand, + serializeAws_restJson1NoInputAndOutputCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface NoInputAndOutputCommandInput {} +export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new NoInputAndOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndOutputCommand extends $Command< + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndOutputCommandInput) { + // 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 = "NoInputAndOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1NoInputAndOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1NoInputAndOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts new file mode 100644 index 000000000000..7aa96cdebc02 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts @@ -0,0 +1,98 @@ +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 { NullAndEmptyHeadersIO } from "../models/models_0"; +import { + deserializeAws_restJson1NullAndEmptyHeadersClientCommand, + serializeAws_restJson1NullAndEmptyHeadersClientCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface NullAndEmptyHeadersClientCommandInput extends NullAndEmptyHeadersIO {} +export interface NullAndEmptyHeadersClientCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} + +/** + * Null and empty headers are not sent over the wire. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, NullAndEmptyHeadersClientCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, NullAndEmptyHeadersClientCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new NullAndEmptyHeadersClientCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NullAndEmptyHeadersClientCommandInput} for command's `input` shape. + * @see {@link NullAndEmptyHeadersClientCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NullAndEmptyHeadersClientCommand extends $Command< + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NullAndEmptyHeadersClientCommandInput) { + // 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 = "NullAndEmptyHeadersClientCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1NullAndEmptyHeadersClientCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1NullAndEmptyHeadersClientCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts new file mode 100644 index 000000000000..62b9054a838d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts @@ -0,0 +1,98 @@ +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 { NullAndEmptyHeadersIO } from "../models/models_0"; +import { + deserializeAws_restJson1NullAndEmptyHeadersServerCommand, + serializeAws_restJson1NullAndEmptyHeadersServerCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface NullAndEmptyHeadersServerCommandInput extends NullAndEmptyHeadersIO {} +export interface NullAndEmptyHeadersServerCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} + +/** + * Null and empty headers are not sent over the wire. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, NullAndEmptyHeadersServerCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, NullAndEmptyHeadersServerCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new NullAndEmptyHeadersServerCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NullAndEmptyHeadersServerCommandInput} for command's `input` shape. + * @see {@link NullAndEmptyHeadersServerCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NullAndEmptyHeadersServerCommand extends $Command< + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NullAndEmptyHeadersServerCommandInput) { + // 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 = "NullAndEmptyHeadersServerCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1NullAndEmptyHeadersServerCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1NullAndEmptyHeadersServerCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts new file mode 100644 index 000000000000..908e58db5275 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts @@ -0,0 +1,101 @@ +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 { OmitsNullSerializesEmptyStringInput } from "../models/models_0"; +import { + deserializeAws_restJson1OmitsNullSerializesEmptyStringCommand, + serializeAws_restJson1OmitsNullSerializesEmptyStringCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface OmitsNullSerializesEmptyStringCommandInput extends OmitsNullSerializesEmptyStringInput {} +export interface OmitsNullSerializesEmptyStringCommandOutput extends __MetadataBearer {} + +/** + * Omits null, but serializes empty string value. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, OmitsNullSerializesEmptyStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, OmitsNullSerializesEmptyStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new OmitsNullSerializesEmptyStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link OmitsNullSerializesEmptyStringCommandInput} for command's `input` shape. + * @see {@link OmitsNullSerializesEmptyStringCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class OmitsNullSerializesEmptyStringCommand extends $Command< + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: OmitsNullSerializesEmptyStringCommandInput) { + // 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 = "OmitsNullSerializesEmptyStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: OmitsNullSerializesEmptyStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: OmitsNullSerializesEmptyStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1OmitsNullSerializesEmptyStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1OmitsNullSerializesEmptyStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts new file mode 100644 index 000000000000..dc694a7ba03d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts @@ -0,0 +1,98 @@ +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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; +import { + deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommand, + serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} +export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} + +/** + * Automatically adds idempotency tokens. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new QueryIdempotencyTokenAutoFillCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. + * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryIdempotencyTokenAutoFillCommand extends $Command< + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { + // 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 = "QueryIdempotencyTokenAutoFillCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts new file mode 100644 index 000000000000..9567e56735ec --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.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 { QueryParamsAsStringListMapInput } from "../models/models_0"; +import { + deserializeAws_restJson1QueryParamsAsStringListMapCommand, + serializeAws_restJson1QueryParamsAsStringListMapCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface QueryParamsAsStringListMapCommandInput extends QueryParamsAsStringListMapInput {} +export interface QueryParamsAsStringListMapCommandOutput extends __MetadataBearer {} + +export class QueryParamsAsStringListMapCommand extends $Command< + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryParamsAsStringListMapCommandInput) { + // 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 = "QueryParamsAsStringListMapCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryParamsAsStringListMapInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1QueryParamsAsStringListMapCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1QueryParamsAsStringListMapCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts new file mode 100644 index 000000000000..1b65575ecf2e --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.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 { QueryPrecedenceInput } from "../models/models_0"; +import { + deserializeAws_restJson1QueryPrecedenceCommand, + serializeAws_restJson1QueryPrecedenceCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface QueryPrecedenceCommandInput extends QueryPrecedenceInput {} +export interface QueryPrecedenceCommandOutput extends __MetadataBearer {} + +export class QueryPrecedenceCommand extends $Command< + QueryPrecedenceCommandInput, + QueryPrecedenceCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryPrecedenceCommandInput) { + // 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 = "QueryPrecedenceCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryPrecedenceInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryPrecedenceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1QueryPrecedenceCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1QueryPrecedenceCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts new file mode 100644 index 000000000000..a1e7027b2bbd --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts @@ -0,0 +1,95 @@ +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 { RecursiveShapesInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1RecursiveShapesCommand, + serializeAws_restJson1RecursiveShapesCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface RecursiveShapesCommandInput extends RecursiveShapesInputOutput {} +export interface RecursiveShapesCommandOutput extends RecursiveShapesInputOutput, __MetadataBearer {} + +/** + * Recursive shapes + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, RecursiveShapesCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, RecursiveShapesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new RecursiveShapesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link RecursiveShapesCommandInput} for command's `input` shape. + * @see {@link RecursiveShapesCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class RecursiveShapesCommand extends $Command< + RecursiveShapesCommandInput, + RecursiveShapesCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: RecursiveShapesCommandInput) { + // 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 = "RecursiveShapesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: RecursiveShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1RecursiveShapesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1RecursiveShapesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts new file mode 100644 index 000000000000..a736cd75da0f --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1SimpleScalarPropertiesCommand, + serializeAws_restJson1SimpleScalarPropertiesCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} +export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} + +export class SimpleScalarPropertiesCommand extends $Command< + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarPropertiesCommandInput) { + // 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 = "SimpleScalarPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1SimpleScalarPropertiesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1SimpleScalarPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts new file mode 100644 index 000000000000..ffcc824a5c08 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts @@ -0,0 +1,107 @@ +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 { StreamingTraitsInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1StreamingTraitsCommand, + serializeAws_restJson1StreamingTraitsCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +type StreamingTraitsCommandInputType = Omit & { + /** + * For *`StreamingTraitsInputOutput["blob"]`*, see {@link StreamingTraitsInputOutput.blob}. + */ + blob?: StreamingTraitsInputOutput["blob"] | string | Uint8Array | Buffer; +}; +/** + * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} + */ +export interface StreamingTraitsCommandInput extends StreamingTraitsCommandInputType {} +export interface StreamingTraitsCommandOutput extends StreamingTraitsInputOutput, __MetadataBearer {} + +/** + * This examples serializes a streaming blob shape in the request body. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, StreamingTraitsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, StreamingTraitsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new StreamingTraitsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link StreamingTraitsCommandInput} for command's `input` shape. + * @see {@link StreamingTraitsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class StreamingTraitsCommand extends $Command< + StreamingTraitsCommandInput, + StreamingTraitsCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: StreamingTraitsCommandInput) { + // 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 = "StreamingTraitsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: StreamingTraitsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: StreamingTraitsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: StreamingTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1StreamingTraitsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1StreamingTraitsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts new file mode 100644 index 000000000000..2a5ebb003a22 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts @@ -0,0 +1,113 @@ +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 { StreamingTraitsRequireLengthInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1StreamingTraitsRequireLengthCommand, + serializeAws_restJson1StreamingTraitsRequireLengthCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +type StreamingTraitsRequireLengthCommandInputType = Omit & { + /** + * For *`StreamingTraitsRequireLengthInputOutput["blob"]`*, see {@link StreamingTraitsRequireLengthInputOutput.blob}. + */ + blob?: StreamingTraitsRequireLengthInputOutput["blob"] | string | Uint8Array | Buffer; +}; +/** + * This interface extends from `StreamingTraitsRequireLengthInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsRequireLengthInputOutput} + */ +export interface StreamingTraitsRequireLengthCommandInput extends StreamingTraitsRequireLengthCommandInputType {} +export interface StreamingTraitsRequireLengthCommandOutput + extends StreamingTraitsRequireLengthInputOutput, + __MetadataBearer {} + +/** + * This examples serializes a streaming blob shape with a required content + * length in the request body. + * + * In this example, no JSON document is synthesized because the payload is + * not a structure or a union type. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, StreamingTraitsRequireLengthCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, StreamingTraitsRequireLengthCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new StreamingTraitsRequireLengthCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link StreamingTraitsRequireLengthCommandInput} for command's `input` shape. + * @see {@link StreamingTraitsRequireLengthCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class StreamingTraitsRequireLengthCommand extends $Command< + StreamingTraitsRequireLengthCommandInput, + StreamingTraitsRequireLengthCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: StreamingTraitsRequireLengthCommandInput) { + // 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 = "StreamingTraitsRequireLengthCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: StreamingTraitsRequireLengthInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: StreamingTraitsRequireLengthInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: StreamingTraitsRequireLengthCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1StreamingTraitsRequireLengthCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1StreamingTraitsRequireLengthCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts new file mode 100644 index 000000000000..857f60e33124 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts @@ -0,0 +1,112 @@ +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 { StreamingTraitsWithMediaTypeInputOutput } from "../models/models_0"; +import { + deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand, + serializeAws_restJson1StreamingTraitsWithMediaTypeCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +type StreamingTraitsWithMediaTypeCommandInputType = Omit & { + /** + * For *`StreamingTraitsWithMediaTypeInputOutput["blob"]`*, see {@link StreamingTraitsWithMediaTypeInputOutput.blob}. + */ + blob?: StreamingTraitsWithMediaTypeInputOutput["blob"] | string | Uint8Array | Buffer; +}; +/** + * This interface extends from `StreamingTraitsWithMediaTypeInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsWithMediaTypeInputOutput} + */ +export interface StreamingTraitsWithMediaTypeCommandInput extends StreamingTraitsWithMediaTypeCommandInputType {} +export interface StreamingTraitsWithMediaTypeCommandOutput + extends StreamingTraitsWithMediaTypeInputOutput, + __MetadataBearer {} + +/** + * This examples serializes a streaming media-typed blob shape in the request body. + * + * This examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, StreamingTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, StreamingTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new StreamingTraitsWithMediaTypeCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link StreamingTraitsWithMediaTypeCommandInput} for command's `input` shape. + * @see {@link StreamingTraitsWithMediaTypeCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class StreamingTraitsWithMediaTypeCommand extends $Command< + StreamingTraitsWithMediaTypeCommandInput, + StreamingTraitsWithMediaTypeCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: StreamingTraitsWithMediaTypeCommandInput) { + // 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 = "StreamingTraitsWithMediaTypeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: StreamingTraitsWithMediaTypeInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: StreamingTraitsWithMediaTypeInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: StreamingTraitsWithMediaTypeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1StreamingTraitsWithMediaTypeCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts new file mode 100644 index 000000000000..ea9fb44629ee --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts @@ -0,0 +1,95 @@ +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 { TimestampFormatHeadersIO } from "../models/models_0"; +import { + deserializeAws_restJson1TimestampFormatHeadersCommand, + serializeAws_restJson1TimestampFormatHeadersCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +export interface TimestampFormatHeadersCommandInput extends TimestampFormatHeadersIO {} +export interface TimestampFormatHeadersCommandOutput extends TimestampFormatHeadersIO, __MetadataBearer {} + +/** + * This example tests how timestamp request and response headers are serialized. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, TimestampFormatHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, TimestampFormatHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const command = new TimestampFormatHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link TimestampFormatHeadersCommandInput} for command's `input` shape. + * @see {@link TimestampFormatHeadersCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class TimestampFormatHeadersCommand extends $Command< + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: TimestampFormatHeadersCommandInput) { + // 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 = "TimestampFormatHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: TimestampFormatHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1TimestampFormatHeadersCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1TimestampFormatHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts new file mode 100644 index 000000000000..039dfc6816fc --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts @@ -0,0 +1,79 @@ +export * from "./AllQueryStringTypesCommand"; +export * from "./ConstantAndVariableQueryStringCommand"; +export * from "./ConstantQueryStringCommand"; +export * from "./DocumentTypeAsPayloadCommand"; +export * from "./DocumentTypeCommand"; +export * from "./EmptyInputAndEmptyOutputCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HostWithPathOperationCommand"; +export * from "./HttpChecksumRequiredCommand"; +export * from "./HttpEnumPayloadCommand"; +export * from "./HttpPayloadTraitsCommand"; +export * from "./HttpPayloadTraitsWithMediaTypeCommand"; +export * from "./HttpPayloadWithStructureCommand"; +export * from "./HttpPrefixHeadersCommand"; +export * from "./HttpPrefixHeadersResponseCommand"; +export * from "./HttpRequestWithFloatLabelsCommand"; +export * from "./HttpRequestWithGreedyLabelInPathCommand"; +export * from "./HttpRequestWithLabelsAndTimestampFormatCommand"; +export * from "./HttpRequestWithLabelsCommand"; +export * from "./HttpResponseCodeCommand"; +export * from "./HttpStringPayloadCommand"; +export * from "./IgnoreQueryParamsInResponseCommand"; +export * from "./InputAndOutputWithHeadersCommand"; +export * from "./JsonBlobsCommand"; +export * from "./JsonEnumsCommand"; +export * from "./JsonListsCommand"; +export * from "./JsonMapsCommand"; +export * from "./JsonTimestampsCommand"; +export * from "./JsonUnionsCommand"; +export * from "./MalformedAcceptWithBodyCommand"; +export * from "./MalformedAcceptWithGenericStringCommand"; +export * from "./MalformedAcceptWithPayloadCommand"; +export * from "./MalformedBlobCommand"; +export * from "./MalformedBooleanCommand"; +export * from "./MalformedByteCommand"; +export * from "./MalformedContentTypeWithBodyCommand"; +export * from "./MalformedContentTypeWithGenericStringCommand"; +export * from "./MalformedContentTypeWithPayloadCommand"; +export * from "./MalformedContentTypeWithoutBodyCommand"; +export * from "./MalformedDoubleCommand"; +export * from "./MalformedFloatCommand"; +export * from "./MalformedIntegerCommand"; +export * from "./MalformedListCommand"; +export * from "./MalformedLongCommand"; +export * from "./MalformedMapCommand"; +export * from "./MalformedRequestBodyCommand"; +export * from "./MalformedSetCommand"; +export * from "./MalformedShortCommand"; +export * from "./MalformedStringCommand"; +export * from "./MalformedTimestampBodyDateTimeCommand"; +export * from "./MalformedTimestampBodyDefaultCommand"; +export * from "./MalformedTimestampBodyHttpDateCommand"; +export * from "./MalformedTimestampHeaderDateTimeCommand"; +export * from "./MalformedTimestampHeaderDefaultCommand"; +export * from "./MalformedTimestampHeaderEpochCommand"; +export * from "./MalformedTimestampPathDefaultCommand"; +export * from "./MalformedTimestampPathEpochCommand"; +export * from "./MalformedTimestampPathHttpDateCommand"; +export * from "./MalformedTimestampQueryDefaultCommand"; +export * from "./MalformedTimestampQueryEpochCommand"; +export * from "./MalformedTimestampQueryHttpDateCommand"; +export * from "./MalformedUnionCommand"; +export * from "./MediaTypeHeaderCommand"; +export * from "./NoInputAndNoOutputCommand"; +export * from "./NoInputAndOutputCommand"; +export * from "./NullAndEmptyHeadersClientCommand"; +export * from "./NullAndEmptyHeadersServerCommand"; +export * from "./OmitsNullSerializesEmptyStringCommand"; +export * from "./QueryIdempotencyTokenAutoFillCommand"; +export * from "./QueryParamsAsStringListMapCommand"; +export * from "./QueryPrecedenceCommand"; +export * from "./RecursiveShapesCommand"; +export * from "./SimpleScalarPropertiesCommand"; +export * from "./StreamingTraitsCommand"; +export * from "./StreamingTraitsRequireLengthCommand"; +export * from "./StreamingTraitsWithMediaTypeCommand"; +export * from "./TimestampFormatHeadersCommand"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts b/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts new file mode 100644 index 000000000000..cb7b16a70f63 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "restjson.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "restjson.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "restjson.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "restjson.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "restjson.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "restjson", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-restjson/src/index.ts b/protocol_tests/aws-protocoltests-restjson/src/index.ts new file mode 100644 index 000000000000..e397b549b73c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/index.ts @@ -0,0 +1,4 @@ +export * from "./RestJsonProtocol"; +export * from "./RestJsonProtocolClient"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/models/index.ts b/protocol_tests/aws-protocoltests-restjson/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts b/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts new file mode 100644 index 000000000000..bfe279dd3bec --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts @@ -0,0 +1,1530 @@ +import { LazyJsonString as __LazyJsonString } from "@aws-sdk/smithy-client"; +import { + DocumentType as __DocumentType, + MetadataBearer as $MetadataBearer, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { Readable } from "stream"; + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface AllQueryStringTypesInput { + queryString?: string; + queryStringList?: string[]; + queryStringSet?: string[]; + queryByte?: number; + queryShort?: number; + queryInteger?: number; + queryIntegerList?: number[]; + queryIntegerSet?: number[]; + queryLong?: number; + queryFloat?: number; + queryDouble?: number; + queryDoubleList?: number[]; + queryBoolean?: boolean; + queryBooleanList?: boolean[]; + queryTimestamp?: Date; + queryTimestampList?: Date[]; + queryEnum?: FooEnum | string; + queryEnumList?: (FooEnum | string)[]; + queryParamsMapOfStringList?: { [key: string]: string[] }; +} + +export namespace AllQueryStringTypesInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: AllQueryStringTypesInput): any => ({ + ...obj, + }); +} + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + Header?: string; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface ConstantAndVariableQueryStringInput { + baz?: string; + maybeSet?: string; +} + +export namespace ConstantAndVariableQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantAndVariableQueryStringInput): any => ({ + ...obj, + }); +} + +export interface ConstantQueryStringInput { + hello: string | undefined; +} + +export namespace ConstantQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantQueryStringInput): any => ({ + ...obj, + }); +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +export interface DocumentTypeInputOutput { + stringValue?: string; + documentValue?: __DocumentType; +} + +export namespace DocumentTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: DocumentTypeInputOutput): any => ({ + ...obj, + }); +} + +export interface DocumentTypeAsPayloadInputOutput { + documentValue?: __DocumentType; +} + +export namespace DocumentTypeAsPayloadInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: DocumentTypeAsPayloadInputOutput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputOutput {} + +export namespace EmptyInputAndEmptyOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +export enum StringEnum { + V = "enumvalue", +} + +export interface EnumPayloadInput { + payload?: StringEnum | string; +} + +export namespace EnumPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EnumPayloadInput): any => ({ + ...obj, + }); +} + +/** + * This error has test cases that test some of the dark corners of Amazon service + * framework history. It should only be implemented by clients. + */ +export interface FooError extends __SmithyException, $MetadataBearer { + name: "FooError"; + $fault: "server"; +} + +export namespace FooError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FooError): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export interface HttpChecksumRequiredInputOutput { + foo?: string; +} + +export namespace HttpChecksumRequiredInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpChecksumRequiredInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPayloadTraitsInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPayloadTraitsWithMediaTypeInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsWithMediaTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsWithMediaTypeInputOutput): any => ({ + ...obj, + }); +} + +export interface NestedPayload { + greeting?: string; + name?: string; +} + +export namespace NestedPayload { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedPayload): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithStructureInputOutput { + nested?: NestedPayload; +} + +export namespace HttpPayloadWithStructureInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithStructureInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPrefixHeadersInputOutput { + foo?: string; + fooMap?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPrefixHeadersResponseOutput { + prefixHeaders?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersResponseOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersResponseOutput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithFloatLabelsInput { + float: number | undefined; + double: number | undefined; +} + +export namespace HttpRequestWithFloatLabelsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithFloatLabelsInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithGreedyLabelInPathInput { + foo: string | undefined; + baz: string | undefined; +} + +export namespace HttpRequestWithGreedyLabelInPathInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithGreedyLabelInPathInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithLabelsInput { + string: string | undefined; + short: number | undefined; + integer: number | undefined; + long: number | undefined; + float: number | undefined; + double: number | undefined; + /** + * Serialized in the path as true or false. + */ + boolean: boolean | undefined; + + /** + * Note that this member has no format, so it's serialized as an RFC 3399 date-time. + */ + timestamp: Date | undefined; +} + +export namespace HttpRequestWithLabelsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithLabelsInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithLabelsAndTimestampFormatInput { + memberEpochSeconds: Date | undefined; + memberHttpDate: Date | undefined; + memberDateTime: Date | undefined; + defaultFormat: Date | undefined; + targetEpochSeconds: Date | undefined; + targetHttpDate: Date | undefined; + targetDateTime: Date | undefined; +} + +export namespace HttpRequestWithLabelsAndTimestampFormatInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithLabelsAndTimestampFormatInput): any => ({ + ...obj, + }); +} + +export interface HttpResponseCodeOutput { + Status?: number; +} + +export namespace HttpResponseCodeOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpResponseCodeOutput): any => ({ + ...obj, + }); +} + +export interface StringPayloadInput { + payload?: string; +} + +export namespace StringPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StringPayloadInput): any => ({ + ...obj, + }); +} + +export interface IgnoreQueryParamsInResponseOutput { + baz?: string; +} + +export namespace IgnoreQueryParamsInResponseOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: IgnoreQueryParamsInResponseOutput): any => ({ + ...obj, + }); +} + +export interface InputAndOutputWithHeadersIO { + headerString?: string; + headerByte?: number; + headerShort?: number; + headerInteger?: number; + headerLong?: number; + headerFloat?: number; + headerDouble?: number; + headerTrueBool?: boolean; + headerFalseBool?: boolean; + headerStringList?: string[]; + headerStringSet?: string[]; + headerIntegerList?: number[]; + headerBooleanList?: boolean[]; + headerTimestampList?: Date[]; + headerEnum?: FooEnum | string; + headerEnumList?: (FooEnum | string)[]; +} + +export namespace InputAndOutputWithHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InputAndOutputWithHeadersIO): any => ({ + ...obj, + }); +} + +export interface JsonBlobsInputOutput { + data?: Uint8Array; +} + +export namespace JsonBlobsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonBlobsInputOutput): any => ({ + ...obj, + }); +} + +export interface JsonEnumsInputOutput { + fooEnum1?: FooEnum | string; + fooEnum2?: FooEnum | string; + fooEnum3?: FooEnum | string; + fooEnumList?: (FooEnum | string)[]; + fooEnumSet?: (FooEnum | string)[]; + fooEnumMap?: { [key: string]: FooEnum | string }; +} + +export namespace JsonEnumsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonEnumsInputOutput): any => ({ + ...obj, + }); +} + +export interface StructureListMember { + a?: string; + b?: string; +} + +export namespace StructureListMember { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructureListMember): any => ({ + ...obj, + }); +} + +export interface JsonListsInputOutput { + stringList?: string[]; + sparseStringList?: string[]; + stringSet?: string[]; + integerList?: number[]; + booleanList?: boolean[]; + timestampList?: Date[]; + enumList?: (FooEnum | string)[]; + /** + * A list of lists of strings. + */ + nestedStringList?: string[][]; + + structureList?: StructureListMember[]; +} + +export namespace JsonListsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonListsInputOutput): any => ({ + ...obj, + }); +} + +export interface JsonMapsInputOutput { + denseStructMap?: { [key: string]: GreetingStruct }; + sparseStructMap?: { [key: string]: GreetingStruct }; + denseNumberMap?: { [key: string]: number }; + denseBooleanMap?: { [key: string]: boolean }; + denseStringMap?: { [key: string]: string }; + sparseNumberMap?: { [key: string]: number }; + sparseBooleanMap?: { [key: string]: boolean }; + sparseStringMap?: { [key: string]: string }; + denseSetMap?: { [key: string]: string[] }; + sparseSetMap?: { [key: string]: string[] }; +} + +export namespace JsonMapsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonMapsInputOutput): any => ({ + ...obj, + }); +} + +export interface JsonTimestampsInputOutput { + normal?: Date; + dateTime?: Date; + epochSeconds?: Date; + httpDate?: Date; +} + +export namespace JsonTimestampsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonTimestampsInputOutput): any => ({ + ...obj, + }); +} + +export interface RenamedGreeting { + salutation?: string; +} + +export namespace RenamedGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RenamedGreeting): any => ({ + ...obj, + }); +} + +/** + * A union with a representative set of types for members. + */ +export type MyUnion = + | MyUnion.BlobValueMember + | MyUnion.BooleanValueMember + | MyUnion.EnumValueMember + | MyUnion.ListValueMember + | MyUnion.MapValueMember + | MyUnion.NumberValueMember + | MyUnion.RenamedStructureValueMember + | MyUnion.StringValueMember + | MyUnion.StructureValueMember + | MyUnion.TimestampValueMember + | MyUnion.$UnknownMember; + +export namespace MyUnion { + export interface StringValueMember { + stringValue: string; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface BooleanValueMember { + stringValue?: never; + booleanValue: boolean; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface NumberValueMember { + stringValue?: never; + booleanValue?: never; + numberValue: number; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface BlobValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue: Uint8Array; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface TimestampValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue: Date; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface EnumValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue: FooEnum | string; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface ListValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue: string[]; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface MapValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue: { [key: string]: string }; + structureValue?: never; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface StructureValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue: GreetingStruct; + renamedStructureValue?: never; + $unknown?: never; + } + + export interface RenamedStructureValueMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue: RenamedGreeting; + $unknown?: never; + } + + export interface $UnknownMember { + stringValue?: never; + booleanValue?: never; + numberValue?: never; + blobValue?: never; + timestampValue?: never; + enumValue?: never; + listValue?: never; + mapValue?: never; + structureValue?: never; + renamedStructureValue?: never; + $unknown: [string, any]; + } + + export interface Visitor { + stringValue: (value: string) => T; + booleanValue: (value: boolean) => T; + numberValue: (value: number) => T; + blobValue: (value: Uint8Array) => T; + timestampValue: (value: Date) => T; + enumValue: (value: FooEnum | string) => T; + listValue: (value: string[]) => T; + mapValue: (value: { [key: string]: string }) => T; + structureValue: (value: GreetingStruct) => T; + renamedStructureValue: (value: RenamedGreeting) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: MyUnion, visitor: Visitor): T => { + if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); + if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); + if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); + if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); + if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); + if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); + if (value.listValue !== undefined) return visitor.listValue(value.listValue); + if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); + if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); + if (value.renamedStructureValue !== undefined) return visitor.renamedStructureValue(value.renamedStructureValue); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: MyUnion): any => { + if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; + if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; + if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; + if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; + if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; + if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; + if (obj.listValue !== undefined) return { listValue: obj.listValue }; + if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; + if (obj.structureValue !== undefined) + return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; + if (obj.renamedStructureValue !== undefined) + return { renamedStructureValue: RenamedGreeting.filterSensitiveLog(obj.renamedStructureValue) }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; +} + +/** + * A shared structure that contains a single union member. + */ +export interface UnionInputOutput { + /** + * A union with a representative set of types for members. + */ + contents?: MyUnion; +} + +export namespace UnionInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ + ...obj, + ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), + }); +} + +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; +} + +export namespace MediaTypeHeaderInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MediaTypeHeaderInput): any => ({ + ...obj, + }); +} + +export interface MediaTypeHeaderOutput { + json?: __LazyJsonString | string; +} + +export namespace MediaTypeHeaderOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MediaTypeHeaderOutput): any => ({ + ...obj, + }); +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); +} + +export interface NullAndEmptyHeadersIO { + a?: string; + b?: string; + c?: string[]; +} + +export namespace NullAndEmptyHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NullAndEmptyHeadersIO): any => ({ + ...obj, + }); +} + +export interface OmitsNullSerializesEmptyStringInput { + nullValue?: string; + emptyString?: string; +} + +export namespace OmitsNullSerializesEmptyStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: OmitsNullSerializesEmptyStringInput): any => ({ + ...obj, + }); +} + +export interface QueryIdempotencyTokenAutoFillInput { + token?: string; +} + +export namespace QueryIdempotencyTokenAutoFillInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ + ...obj, + }); +} + +export interface QueryParamsAsStringListMapInput { + qux?: string; + foo?: { [key: string]: string[] }; +} + +export namespace QueryParamsAsStringListMapInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryParamsAsStringListMapInput): any => ({ + ...obj, + }); +} + +export interface QueryPrecedenceInput { + foo?: string; + baz?: { [key: string]: string }; +} + +export namespace QueryPrecedenceInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryPrecedenceInput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarPropertiesInputOutput { + foo?: string; + stringValue?: string; + trueBooleanValue?: boolean; + falseBooleanValue?: boolean; + byteValue?: number; + shortValue?: number; + integerValue?: number; + longValue?: number; + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarPropertiesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ + ...obj, + }); +} + +export interface StreamingTraitsInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsInputOutput): any => ({ + ...obj, + }); +} + +export interface StreamingTraitsRequireLengthInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsRequireLengthInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsRequireLengthInputOutput): any => ({ + ...obj, + }); +} + +export interface StreamingTraitsWithMediaTypeInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsWithMediaTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsWithMediaTypeInputOutput): any => ({ + ...obj, + }); +} + +export interface TimestampFormatHeadersIO { + memberEpochSeconds?: Date; + memberHttpDate?: Date; + memberDateTime?: Date; + defaultFormat?: Date; + targetEpochSeconds?: Date; + targetHttpDate?: Date; + targetDateTime?: Date; +} + +export namespace TimestampFormatHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TimestampFormatHeadersIO): any => ({ + ...obj, + }); +} + +export interface RecursiveShapesInputOutputNested1 { + foo?: string; + nested?: RecursiveShapesInputOutputNested2; +} + +export namespace RecursiveShapesInputOutputNested1 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested1): any => ({ + ...obj, + }); +} + +export interface RecursiveShapesInputOutputNested2 { + bar?: string; + recursiveMember?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutputNested2 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested2): any => ({ + ...obj, + }); +} + +export interface RecursiveShapesInputOutput { + nested?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutput): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts b/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts new file mode 100644 index 000000000000..8b5b7e8f07a2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts @@ -0,0 +1,7387 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + dateToUtcString as __dateToUtcString, + expectBoolean as __expectBoolean, + expectByte as __expectByte, + expectInt32 as __expectInt32, + expectLong as __expectLong, + expectNonNull as __expectNonNull, + expectNumber as __expectNumber, + expectObject as __expectObject, + expectShort as __expectShort, + expectString as __expectString, + expectUnion as __expectUnion, + extendedEncodeURIComponent as __extendedEncodeURIComponent, + LazyJsonString as __LazyJsonString, + limitedParseDouble as __limitedParseDouble, + limitedParseFloat32 as __limitedParseFloat32, + parseBoolean as __parseBoolean, + parseEpochTimestamp as __parseEpochTimestamp, + parseRfc3339DateTime as __parseRfc3339DateTime, + parseRfc7231DateTime as __parseRfc7231DateTime, + serializeFloat as __serializeFloat, + splitEvery as __splitEvery, + strictParseByte as __strictParseByte, + strictParseDouble as __strictParseDouble, + strictParseFloat as __strictParseFloat, + strictParseInt32 as __strictParseInt32, + strictParseLong as __strictParseLong, + strictParseShort as __strictParseShort, +} from "@aws-sdk/smithy-client"; +import { + DocumentType as __DocumentType, + Endpoint as __Endpoint, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "../commands/AllQueryStringTypesCommand"; +import { + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "../commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "../commands/ConstantQueryStringCommand"; +import { + DocumentTypeAsPayloadCommandInput, + DocumentTypeAsPayloadCommandOutput, +} from "../commands/DocumentTypeAsPayloadCommand"; +import { DocumentTypeCommandInput, DocumentTypeCommandOutput } from "../commands/DocumentTypeCommand"; +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "../commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "../commands/EndpointWithHostLabelOperationCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; +import { + HttpChecksumRequiredCommandInput, + HttpChecksumRequiredCommandOutput, +} from "../commands/HttpChecksumRequiredCommand"; +import { HttpEnumPayloadCommandInput, HttpEnumPayloadCommandOutput } from "../commands/HttpEnumPayloadCommand"; +import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "../commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "../commands/HttpPayloadWithStructureCommand"; +import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "../commands/HttpPrefixHeadersCommand"; +import { + HttpPrefixHeadersResponseCommandInput, + HttpPrefixHeadersResponseCommandOutput, +} from "../commands/HttpPrefixHeadersResponseCommand"; +import { + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "../commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "../commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "../commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "../commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "../commands/HttpResponseCodeCommand"; +import { HttpStringPayloadCommandInput, HttpStringPayloadCommandOutput } from "../commands/HttpStringPayloadCommand"; +import { + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "../commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "../commands/InputAndOutputWithHeadersCommand"; +import { JsonBlobsCommandInput, JsonBlobsCommandOutput } from "../commands/JsonBlobsCommand"; +import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "../commands/JsonEnumsCommand"; +import { JsonListsCommandInput, JsonListsCommandOutput } from "../commands/JsonListsCommand"; +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"; +import { + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "../commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "../commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "../commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "../commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "../commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "../commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "../commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "../commands/SimpleScalarPropertiesCommand"; +import { StreamingTraitsCommandInput, StreamingTraitsCommandOutput } from "../commands/StreamingTraitsCommand"; +import { + StreamingTraitsRequireLengthCommandInput, + StreamingTraitsRequireLengthCommandOutput, +} from "../commands/StreamingTraitsRequireLengthCommand"; +import { + StreamingTraitsWithMediaTypeCommandInput, + StreamingTraitsWithMediaTypeCommandOutput, +} from "../commands/StreamingTraitsWithMediaTypeCommand"; +import { + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "../commands/TimestampFormatHeadersCommand"; +import { + ComplexError, + ComplexNestedErrorData, + FooEnum, + FooError, + GreetingStruct, + InvalidGreeting, + MyUnion, + NestedPayload, + RecursiveShapesInputOutputNested1, + RecursiveShapesInputOutputNested2, + RenamedGreeting, + SimpleUnion, + StructureListMember, +} from "../models/models_0"; + +export const serializeAws_restJson1AllQueryStringTypesCommand = async ( + input: AllQueryStringTypesCommandInput, + 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 || ""}` + "/AllQueryStringTypesInput"; + const query: any = { + ...(input.queryParamsMapOfStringList !== undefined && input.queryParamsMapOfStringList), + ...(input.queryString !== undefined && { String: input.queryString }), + ...(input.queryStringList !== undefined && { + StringList: (input.queryStringList || []).map((_entry) => _entry as any), + }), + ...(input.queryStringSet !== undefined && { + StringSet: (Array.from(input.queryStringSet.values()) || []).map((_entry) => _entry as any), + }), + ...(input.queryByte !== undefined && { Byte: input.queryByte.toString() }), + ...(input.queryShort !== undefined && { Short: input.queryShort.toString() }), + ...(input.queryInteger !== undefined && { Integer: input.queryInteger.toString() }), + ...(input.queryIntegerList !== undefined && { + IntegerList: (input.queryIntegerList || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryIntegerSet !== undefined && { + IntegerSet: (Array.from(input.queryIntegerSet.values()) || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryLong !== undefined && { Long: input.queryLong.toString() }), + ...(input.queryFloat !== undefined && { + Float: input.queryFloat % 1 == 0 ? input.queryFloat + ".0" : input.queryFloat.toString(), + }), + ...(input.queryDouble !== undefined && { + Double: input.queryDouble % 1 == 0 ? input.queryDouble + ".0" : input.queryDouble.toString(), + }), + ...(input.queryDoubleList !== undefined && { + DoubleList: (input.queryDoubleList || []).map( + (_entry) => (_entry % 1 == 0 ? _entry + ".0" : _entry.toString()) as any + ), + }), + ...(input.queryBoolean !== undefined && { Boolean: input.queryBoolean.toString() }), + ...(input.queryBooleanList !== undefined && { + BooleanList: (input.queryBooleanList || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryTimestamp !== undefined && { + Timestamp: (input.queryTimestamp.toISOString().split(".")[0] + "Z").toString(), + }), + ...(input.queryTimestampList !== undefined && { + TimestampList: (input.queryTimestampList || []).map( + (_entry) => (_entry.toISOString().split(".")[0] + "Z").toString() as any + ), + }), + ...(input.queryEnum !== undefined && { Enum: input.queryEnum }), + ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry as any) }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1ConstantAndVariableQueryStringCommand = async ( + input: ConstantAndVariableQueryStringCommandInput, + 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 || ""}` + "/ConstantAndVariableQueryString"; + const query: any = { + foo: "bar", + ...(input.baz !== undefined && { baz: input.baz }), + ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1ConstantQueryStringCommand = async ( + input: ConstantQueryStringCommandInput, + 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 || ""}` + "/ConstantQueryString/{hello}"; + if (input.hello !== undefined) { + const labelValue: string = input.hello; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: hello."); + } + resolvedPath = resolvedPath.replace("{hello}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: hello."); + } + const query: any = { + foo: "bar", + hello: "", + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1DocumentTypeCommand = async ( + input: DocumentTypeCommandInput, + 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 || ""}` + "/DocumentType"; + let body: any; + body = JSON.stringify({ + ...(input.documentValue !== undefined && + input.documentValue !== null && { documentValue: serializeAws_restJson1Document(input.documentValue, context) }), + ...(input.stringValue !== undefined && input.stringValue !== null && { stringValue: input.stringValue }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1DocumentTypeAsPayloadCommand = async ( + input: DocumentTypeAsPayloadCommandInput, + 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 || ""}` + "/DocumentTypeAsPayload"; + let body: any; + if (input.documentValue !== undefined) { + if (input.documentValue === null) { + body = "null"; + } else { + body = input.documentValue; + } + } + body = JSON.stringify(body); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1EmptyInputAndEmptyOutputCommand = async ( + input: EmptyInputAndEmptyOutputCommandInput, + 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 || ""}` + "/EmptyInputAndEmptyOutput"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1EndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + 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 || ""}` + "/EndpointOperation"; + let body: any; + body = ""; + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return new __HttpRequest({ + protocol, + hostname: resolvedHostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1EndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + 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 || ""}` + "/EndpointWithHostLabelOperation"; + let body: any; + body = JSON.stringify({ + ...(input.label !== undefined && input.label !== null && { label: input.label }), + }); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return new __HttpRequest({ + protocol, + hostname: resolvedHostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1GreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + 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 || ""}` + "/GreetingWithErrors"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + 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 || ""}` + "/HostWithPathOperation"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpChecksumRequiredCommand = async ( + input: HttpChecksumRequiredCommandInput, + 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 || ""}` + "/HttpChecksumRequired"; + let body: any; + body = JSON.stringify({ + ...(input.foo !== undefined && input.foo !== null && { foo: input.foo }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpEnumPayloadCommand = async ( + input: HttpEnumPayloadCommandInput, + 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 || ""}` + "/EnumPayload"; + let body: any; + if (input.payload !== undefined) { + body = input.payload; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpPayloadTraitsCommand = async ( + input: HttpPayloadTraitsCommandInput, + 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 || ""}` + "/HttpPayloadTraits"; + 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_restJson1HttpPayloadTraitsWithMediaTypeCommand = async ( + input: HttpPayloadTraitsWithMediaTypeCommandInput, + 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 || ""}` + "/HttpPayloadTraitsWithMediaType"; + 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_restJson1HttpPayloadWithStructureCommand = async ( + input: HttpPayloadWithStructureCommandInput, + 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 || ""}` + "/HttpPayloadWithStructure"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restJson1NestedPayload(input.nested, context); + } + if (body === undefined) { + body = {}; + } + body = JSON.stringify(body); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpPrefixHeadersCommand = async ( + input: HttpPrefixHeadersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + ...(input.fooMap !== undefined && + Object.keys(input.fooMap).reduce( + (acc: any, suffix: string) => ({ + ...acc, + [`x-foo-${suffix.toLowerCase()}`]: input.fooMap![suffix], + }), + {} + )), + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpPrefixHeadersResponseCommand = async ( + input: HttpPrefixHeadersResponseCommandInput, + 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 || ""}` + "/HttpPrefixHeadersResponse"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( + input: HttpRequestWithFloatLabelsCommandInput, + 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 || ""}` + "/FloatHttpLabels/{float}/{double}"; + if (input.float !== undefined) { + const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: float."); + } + resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: float."); + } + if (input.double !== undefined) { + const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: double."); + } + resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: double."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = async ( + input: HttpRequestWithGreedyLabelInPathCommandInput, + 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 || ""}` + + "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; + if (input.foo !== undefined) { + const labelValue: string = input.foo; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: foo."); + } + resolvedPath = resolvedPath.replace("{foo}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: foo."); + } + if (input.baz !== undefined) { + const labelValue: string = input.baz; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: baz."); + } + resolvedPath = resolvedPath.replace( + "{baz+}", + labelValue + .split("/") + .map((segment) => __extendedEncodeURIComponent(segment)) + .join("/") + ); + } else { + throw new Error("No value provided for input HTTP label: baz."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpRequestWithLabelsCommand = async ( + input: HttpRequestWithLabelsCommandInput, + 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 || ""}` + + "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; + if (input.string !== undefined) { + const labelValue: string = input.string; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: string."); + } + resolvedPath = resolvedPath.replace("{string}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: string."); + } + if (input.short !== undefined) { + const labelValue: string = input.short.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: short."); + } + resolvedPath = resolvedPath.replace("{short}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: short."); + } + if (input.integer !== undefined) { + const labelValue: string = input.integer.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: integer."); + } + resolvedPath = resolvedPath.replace("{integer}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: integer."); + } + if (input.long !== undefined) { + const labelValue: string = input.long.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: long."); + } + resolvedPath = resolvedPath.replace("{long}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: long."); + } + if (input.float !== undefined) { + const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: float."); + } + resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: float."); + } + if (input.double !== undefined) { + const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: double."); + } + resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: double."); + } + if (input.boolean !== undefined) { + const labelValue: string = input.boolean.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: boolean."); + } + resolvedPath = resolvedPath.replace("{boolean}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: boolean."); + } + 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: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand = async ( + input: HttpRequestWithLabelsAndTimestampFormatCommandInput, + 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 || ""}` + + "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; + if (input.memberEpochSeconds !== undefined) { + const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberEpochSeconds."); + } + resolvedPath = resolvedPath.replace("{memberEpochSeconds}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberEpochSeconds."); + } + if (input.memberHttpDate !== undefined) { + const labelValue: string = __dateToUtcString(input.memberHttpDate).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberHttpDate."); + } + resolvedPath = resolvedPath.replace("{memberHttpDate}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberHttpDate."); + } + if (input.memberDateTime !== undefined) { + const labelValue: string = (input.memberDateTime.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberDateTime."); + } + resolvedPath = resolvedPath.replace("{memberDateTime}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberDateTime."); + } + if (input.defaultFormat !== undefined) { + const labelValue: string = (input.defaultFormat.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: defaultFormat."); + } + resolvedPath = resolvedPath.replace("{defaultFormat}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: defaultFormat."); + } + if (input.targetEpochSeconds !== undefined) { + const labelValue: string = Math.round(input.targetEpochSeconds.getTime() / 1000).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetEpochSeconds."); + } + resolvedPath = resolvedPath.replace("{targetEpochSeconds}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetEpochSeconds."); + } + if (input.targetHttpDate !== undefined) { + const labelValue: string = __dateToUtcString(input.targetHttpDate).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetHttpDate."); + } + resolvedPath = resolvedPath.replace("{targetHttpDate}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetHttpDate."); + } + if (input.targetDateTime !== undefined) { + const labelValue: string = (input.targetDateTime.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetDateTime."); + } + resolvedPath = resolvedPath.replace("{targetDateTime}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetDateTime."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpResponseCodeCommand = async ( + input: HttpResponseCodeCommandInput, + 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 || ""}` + "/HttpResponseCode"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1HttpStringPayloadCommand = async ( + input: HttpStringPayloadCommandInput, + 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 || ""}` + "/StringPayload"; + let body: any; + if (input.payload !== undefined) { + body = input.payload; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1IgnoreQueryParamsInResponseCommand = async ( + input: IgnoreQueryParamsInResponseCommandInput, + 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 || ""}` + "/IgnoreQueryParamsInResponse"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1InputAndOutputWithHeadersCommand = async ( + input: InputAndOutputWithHeadersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), + ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), + ...(isSerializableHeaderValue(input.headerShort) && { "x-short": input.headerShort!.toString() }), + ...(isSerializableHeaderValue(input.headerInteger) && { "x-integer": input.headerInteger!.toString() }), + ...(isSerializableHeaderValue(input.headerLong) && { "x-long": input.headerLong!.toString() }), + ...(isSerializableHeaderValue(input.headerFloat) && { + "x-float": input.headerFloat! % 1 == 0 ? input.headerFloat! + ".0" : input.headerFloat!.toString(), + }), + ...(isSerializableHeaderValue(input.headerDouble) && { + "x-double": input.headerDouble! % 1 == 0 ? input.headerDouble! + ".0" : input.headerDouble!.toString(), + }), + ...(isSerializableHeaderValue(input.headerTrueBool) && { "x-boolean1": input.headerTrueBool!.toString() }), + ...(isSerializableHeaderValue(input.headerFalseBool) && { "x-boolean2": input.headerFalseBool!.toString() }), + ...(isSerializableHeaderValue(input.headerStringList) && { + "x-stringlist": (input.headerStringList! || []).map((_entry) => _entry as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerStringSet) && { + "x-stringset": (Array.from(input.headerStringSet!.values()) || []).map((_entry) => _entry as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerIntegerList) && { + "x-integerlist": (input.headerIntegerList! || []).map((_entry) => _entry.toString() as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerBooleanList) && { + "x-booleanlist": (input.headerBooleanList! || []).map((_entry) => _entry.toString() as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerTimestampList) && { + "x-timestamplist": (input.headerTimestampList! || []) + .map((_entry) => __dateToUtcString(_entry).toString() as any) + .join(", "), + }), + ...(isSerializableHeaderValue(input.headerEnum) && { "x-enum": input.headerEnum! }), + ...(isSerializableHeaderValue(input.headerEnumList) && { + "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry as any).join(", "), + }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonBlobsCommand = async ( + input: JsonBlobsCommandInput, + 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 || ""}` + "/JsonBlobs"; + let body: any; + body = JSON.stringify({ + ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonEnumsCommand = async ( + input: JsonEnumsCommandInput, + 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 || ""}` + "/JsonEnums"; + let body: any; + body = JSON.stringify({ + ...(input.fooEnum1 !== undefined && input.fooEnum1 !== null && { fooEnum1: input.fooEnum1 }), + ...(input.fooEnum2 !== undefined && input.fooEnum2 !== null && { fooEnum2: input.fooEnum2 }), + ...(input.fooEnum3 !== undefined && input.fooEnum3 !== null && { fooEnum3: input.fooEnum3 }), + ...(input.fooEnumList !== undefined && + input.fooEnumList !== null && { fooEnumList: serializeAws_restJson1FooEnumList(input.fooEnumList, context) }), + ...(input.fooEnumMap !== undefined && + input.fooEnumMap !== null && { fooEnumMap: serializeAws_restJson1FooEnumMap(input.fooEnumMap, context) }), + ...(input.fooEnumSet !== undefined && + input.fooEnumSet !== null && { fooEnumSet: serializeAws_restJson1FooEnumSet(input.fooEnumSet, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonListsCommand = async ( + input: JsonListsCommandInput, + 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 || ""}` + "/JsonLists"; + let body: any; + body = JSON.stringify({ + ...(input.booleanList !== undefined && + input.booleanList !== null && { booleanList: serializeAws_restJson1BooleanList(input.booleanList, context) }), + ...(input.enumList !== undefined && + input.enumList !== null && { enumList: serializeAws_restJson1FooEnumList(input.enumList, context) }), + ...(input.integerList !== undefined && + input.integerList !== null && { integerList: serializeAws_restJson1IntegerList(input.integerList, context) }), + ...(input.nestedStringList !== undefined && + input.nestedStringList !== null && { + nestedStringList: serializeAws_restJson1NestedStringList(input.nestedStringList, context), + }), + ...(input.sparseStringList !== undefined && + input.sparseStringList !== null && { + sparseStringList: serializeAws_restJson1SparseStringList(input.sparseStringList, context), + }), + ...(input.stringList !== undefined && + input.stringList !== null && { stringList: serializeAws_restJson1StringList(input.stringList, context) }), + ...(input.stringSet !== undefined && + input.stringSet !== null && { stringSet: serializeAws_restJson1StringSet(input.stringSet, context) }), + ...(input.structureList !== undefined && + input.structureList !== null && { + myStructureList: serializeAws_restJson1StructureList(input.structureList, context), + }), + ...(input.timestampList !== undefined && + input.timestampList !== null && { + timestampList: serializeAws_restJson1TimestampList(input.timestampList, context), + }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonMapsCommand = async ( + input: JsonMapsCommandInput, + 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 || ""}` + "/JsonMaps"; + let body: any; + body = JSON.stringify({ + ...(input.denseBooleanMap !== undefined && + input.denseBooleanMap !== null && { + denseBooleanMap: serializeAws_restJson1DenseBooleanMap(input.denseBooleanMap, context), + }), + ...(input.denseNumberMap !== undefined && + input.denseNumberMap !== null && { + denseNumberMap: serializeAws_restJson1DenseNumberMap(input.denseNumberMap, context), + }), + ...(input.denseSetMap !== undefined && + input.denseSetMap !== null && { denseSetMap: serializeAws_restJson1DenseSetMap(input.denseSetMap, context) }), + ...(input.denseStringMap !== undefined && + input.denseStringMap !== null && { + denseStringMap: serializeAws_restJson1DenseStringMap(input.denseStringMap, context), + }), + ...(input.denseStructMap !== undefined && + input.denseStructMap !== null && { + denseStructMap: serializeAws_restJson1DenseStructMap(input.denseStructMap, context), + }), + ...(input.sparseBooleanMap !== undefined && + input.sparseBooleanMap !== null && { + sparseBooleanMap: serializeAws_restJson1SparseBooleanMap(input.sparseBooleanMap, context), + }), + ...(input.sparseNumberMap !== undefined && + input.sparseNumberMap !== null && { + sparseNumberMap: serializeAws_restJson1SparseNumberMap(input.sparseNumberMap, context), + }), + ...(input.sparseSetMap !== undefined && + input.sparseSetMap !== null && { sparseSetMap: serializeAws_restJson1SparseSetMap(input.sparseSetMap, context) }), + ...(input.sparseStringMap !== undefined && + input.sparseStringMap !== null && { + sparseStringMap: serializeAws_restJson1SparseStringMap(input.sparseStringMap, context), + }), + ...(input.sparseStructMap !== undefined && + input.sparseStructMap !== null && { + sparseStructMap: serializeAws_restJson1SparseStructMap(input.sparseStructMap, context), + }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonTimestampsCommand = async ( + input: JsonTimestampsCommandInput, + 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 || ""}` + "/JsonTimestamps"; + let body: any; + body = JSON.stringify({ + ...(input.dateTime !== undefined && + input.dateTime !== null && { dateTime: input.dateTime.toISOString().split(".")[0] + "Z" }), + ...(input.epochSeconds !== undefined && + input.epochSeconds !== null && { epochSeconds: Math.round(input.epochSeconds.getTime() / 1000) }), + ...(input.httpDate !== undefined && input.httpDate !== null && { httpDate: __dateToUtcString(input.httpDate) }), + ...(input.normal !== undefined && input.normal !== null && { normal: Math.round(input.normal.getTime() / 1000) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1JsonUnionsCommand = async ( + input: JsonUnionsCommandInput, + 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 || ""}` + "/JsonUnions"; + let body: any; + body = JSON.stringify({ + ...(input.contents !== undefined && + input.contents !== null && { contents: serializeAws_restJson1MyUnion(input.contents, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedAcceptWithBodyCommand = async ( + input: MalformedAcceptWithBodyCommandInput, + 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 || ""}` + "/MalformedAcceptWithBody"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +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/octet-stream", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedAcceptWithGenericString"; + let body: any; + if (input.payload !== undefined) { + body = input.payload; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedAcceptWithPayloadCommand = async ( + input: MalformedAcceptWithPayloadCommandInput, + 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 || ""}` + "/MalformedAcceptWithPayload"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedBlobCommand = async ( + input: MalformedBlobCommandInput, + 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 || ""}` + "/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: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedBooleanCommand = async ( + input: MalformedBooleanCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "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() }), + }; + let body: any; + body = JSON.stringify({ + ...(input.booleanInBody !== undefined && input.booleanInBody !== null && { booleanInBody: input.booleanInBody }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedByteCommand = async ( + input: MalformedByteCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + 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.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: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedContentTypeWithBodyCommand = async ( + input: MalformedContentTypeWithBodyCommandInput, + 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 || ""}` + "/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, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedContentTypeWithoutBodyCommand = async ( + input: MalformedContentTypeWithoutBodyCommandInput, + 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 || ""}` + "/MalformedContentTypeWithoutBody"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1MalformedContentTypeWithPayloadCommand = async ( + input: MalformedContentTypeWithPayloadCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + 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, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +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(), + }), + }; + let body: any; + body = JSON.stringify({ + ...(input.doubleInBody !== undefined && + input.doubleInBody !== null && { doubleInBody: __serializeFloat(input.doubleInBody) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +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.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(), + }), + }; + let body: any; + body = JSON.stringify({ + ...(input.floatInBody !== undefined && + input.floatInBody !== null && { floatInBody: __serializeFloat(input.floatInBody) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +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/json", + ...(isSerializableHeaderValue(input.integerInHeader) && { integerinheader: input.integerInHeader!.toString() }), + }; + 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, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +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/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedList"; + let body: any; + body = JSON.stringify({ + ...(input.bodyList !== undefined && + input.bodyList !== null && { bodyList: serializeAws_restJson1SimpleList(input.bodyList, context) }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +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": "application/json", + ...(isSerializableHeaderValue(input.longInHeader) && { longinheader: input.longInHeader!.toString() }), + }; + 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, + port, + method: "POST", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restJson1MalformedMapCommand = async ( + input: MalformedMapCommandInput, + 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 || ""}` + "/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!))), + }), + }; + 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(), + }), + }; + 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 || ""}` + "/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_restJson1JsonTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonTimestampsCommandError(output, context); + } + const contents: JsonTimestampsCommandOutput = { + $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)); + } + if (data.normal !== undefined && data.normal !== null) { + contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonTimestampsCommandError = 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_restJson1JsonUnionsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1JsonUnionsCommandError(output, context); + } + const contents: JsonUnionsCommandOutput = { + $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); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1JsonUnionsCommandError = 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_restJson1MalformedAcceptWithBodyCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedAcceptWithBodyCommandError(output, context); + } + const contents: MalformedAcceptWithBodyCommandOutput = { + $metadata: deserializeMetadata(output), + hi: undefined, + }; + 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_restJson1MalformedAcceptWithBodyCommandError = 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_restJson1MalformedAcceptWithGenericStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError(output, context); + } + const contents: MalformedAcceptWithGenericStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError = 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_restJson1MalformedAcceptWithPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedAcceptWithPayloadCommandError(output, context); + } + const contents: MalformedAcceptWithPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + payload: undefined, + }; + const data: any = await collectBody(output.body, context); + contents.payload = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedAcceptWithPayloadCommandError = 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_restJson1MalformedBlobCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedBlobCommandError(output, context); + } + const contents: MalformedBlobCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedBlobCommandError = 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_restJson1MalformedBooleanCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedBooleanCommandError(output, context); + } + const contents: MalformedBooleanCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedBooleanCommandError = 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_restJson1MalformedByteCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedByteCommandError(output, context); + } + const contents: MalformedByteCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedByteCommandError = 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_restJson1MalformedContentTypeWithBodyCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedContentTypeWithBodyCommandError(output, context); + } + const contents: MalformedContentTypeWithBodyCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedContentTypeWithBodyCommandError = 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_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 = { + ...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_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; + 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_restJson1MalformedContentTypeWithPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError(output, context); + } + const contents: MalformedContentTypeWithPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError = 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_restJson1MalformedDoubleCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedDoubleCommandError(output, context); + } + const contents: MalformedDoubleCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedDoubleCommandError = 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_restJson1MalformedFloatCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedFloatCommandError(output, context); + } + const contents: MalformedFloatCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedFloatCommandError = 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_restJson1MalformedIntegerCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedIntegerCommandError(output, context); + } + const contents: MalformedIntegerCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedIntegerCommandError = 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_restJson1MalformedListCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedListCommandError(output, context); + } + const contents: MalformedListCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedListCommandError = 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_restJson1MalformedLongCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedLongCommandError(output, context); + } + const contents: MalformedLongCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedLongCommandError = 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_restJson1MalformedMapCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedMapCommandError(output, context); + } + const contents: MalformedMapCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedMapCommandError = 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_restJson1MalformedRequestBodyCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedRequestBodyCommandError(output, context); + } + const contents: MalformedRequestBodyCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedRequestBodyCommandError = 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_restJson1MalformedSetCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedSetCommandError(output, context); + } + const contents: MalformedSetCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedSetCommandError = 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_restJson1MalformedShortCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedShortCommandError(output, context); + } + const contents: MalformedShortCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedShortCommandError = 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_restJson1MalformedStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedStringCommandError(output, context); + } + const contents: MalformedStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedStringCommandError = 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_restJson1MalformedTimestampBodyDateTimeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError(output, context); + } + const contents: MalformedTimestampBodyDateTimeCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError = 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_restJson1MalformedTimestampBodyDefaultCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError(output, context); + } + const contents: MalformedTimestampBodyDefaultCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError = 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_restJson1MalformedTimestampBodyHttpDateCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError(output, context); + } + const contents: MalformedTimestampBodyHttpDateCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError = 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_restJson1MalformedTimestampHeaderDateTimeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError(output, context); + } + const contents: MalformedTimestampHeaderDateTimeCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError = 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_restJson1MalformedTimestampHeaderDefaultCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampHeaderDefaultCommandError(output, context); + } + const contents: MalformedTimestampHeaderDefaultCommandOutput = { + $metadata: deserializeMetadata(output), + }; + 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; + } + 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_restJson1MalformedTimestampHeaderEpochCommandError = 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_restJson1MalformedTimestampPathDefaultCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampPathDefaultCommandError(output, context); + } + const contents: MalformedTimestampPathDefaultCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampPathDefaultCommandError = 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_restJson1MalformedTimestampPathEpochCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampPathEpochCommandError(output, context); + } + const contents: MalformedTimestampPathEpochCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampPathEpochCommandError = 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_restJson1MalformedTimestampPathHttpDateCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError(output, context); + } + const contents: MalformedTimestampPathHttpDateCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError = 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_restJson1MalformedTimestampQueryDefaultCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError(output, context); + } + const contents: MalformedTimestampQueryDefaultCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError = 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_restJson1MalformedTimestampQueryEpochCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedTimestampQueryEpochCommandError(output, context); + } + const contents: MalformedTimestampQueryEpochCommandOutput = { + $metadata: deserializeMetadata(output), + }; + 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; + } + 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_restJson1MalformedTimestampQueryHttpDateCommandError = 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_restJson1MalformedUnionCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MalformedUnionCommandError(output, context); + } + const contents: MalformedUnionCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MalformedUnionCommandError = 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_restJson1MediaTypeHeaderCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1MediaTypeHeaderCommandError(output, context); + } + const contents: MediaTypeHeaderCommandOutput = { + $metadata: deserializeMetadata(output), + json: undefined, + }; + if (output.headers["x-json"] !== undefined) { + contents.json = new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-json"])).toString("utf8")); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1MediaTypeHeaderCommandError = 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_restJson1NoInputAndNoOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1NoInputAndNoOutputCommandError(output, context); + } + const contents: NoInputAndNoOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1NoInputAndNoOutputCommandError = 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_restJson1NoInputAndOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1NoInputAndOutputCommandError(output, context); + } + const contents: NoInputAndOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1NoInputAndOutputCommandError = 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_restJson1NullAndEmptyHeadersClientCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1NullAndEmptyHeadersClientCommandError(output, context); + } + const contents: NullAndEmptyHeadersClientCommandOutput = { + $metadata: deserializeMetadata(output), + a: undefined, + b: undefined, + c: undefined, + }; + if (output.headers["x-a"] !== undefined) { + contents.a = output.headers["x-a"]; + } + if (output.headers["x-b"] !== undefined) { + contents.b = output.headers["x-b"]; + } + if (output.headers["x-c"] !== undefined) { + contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1NullAndEmptyHeadersClientCommandError = 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_restJson1NullAndEmptyHeadersServerCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1NullAndEmptyHeadersServerCommandError(output, context); + } + const contents: NullAndEmptyHeadersServerCommandOutput = { + $metadata: deserializeMetadata(output), + a: undefined, + b: undefined, + c: undefined, + }; + if (output.headers["x-a"] !== undefined) { + contents.a = output.headers["x-a"]; + } + if (output.headers["x-b"] !== undefined) { + contents.b = output.headers["x-b"]; + } + if (output.headers["x-c"] !== undefined) { + contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1NullAndEmptyHeadersServerCommandError = 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_restJson1OmitsNullSerializesEmptyStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1OmitsNullSerializesEmptyStringCommandError(output, context); + } + const contents: OmitsNullSerializesEmptyStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1OmitsNullSerializesEmptyStringCommandError = 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_restJson1QueryIdempotencyTokenAutoFillCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommandError(output, context); + } + const contents: QueryIdempotencyTokenAutoFillCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommandError = 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_restJson1QueryParamsAsStringListMapCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1QueryParamsAsStringListMapCommandError(output, context); + } + const contents: QueryParamsAsStringListMapCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1QueryParamsAsStringListMapCommandError = 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_restJson1QueryPrecedenceCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1QueryPrecedenceCommandError(output, context); + } + const contents: QueryPrecedenceCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1QueryPrecedenceCommandError = 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_restJson1RecursiveShapesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1RecursiveShapesCommandError(output, context); + } + const contents: RecursiveShapesCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.nested !== undefined && data.nested !== null) { + contents.nested = deserializeAws_restJson1RecursiveShapesInputOutputNested1(data.nested, context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1RecursiveShapesCommandError = 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_restJson1SimpleScalarPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1SimpleScalarPropertiesCommandError(output, context); + } + const contents: SimpleScalarPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + byteValue: undefined, + doubleValue: undefined, + falseBooleanValue: undefined, + floatValue: undefined, + foo: undefined, + integerValue: undefined, + longValue: undefined, + shortValue: undefined, + stringValue: undefined, + trueBooleanValue: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.byteValue !== undefined && data.byteValue !== null) { + contents.byteValue = __expectByte(data.byteValue); + } + if (data.DoubleDribble !== undefined && data.DoubleDribble !== null) { + contents.doubleValue = __limitedParseDouble(data.DoubleDribble); + } + if (data.falseBooleanValue !== undefined && data.falseBooleanValue !== null) { + contents.falseBooleanValue = __expectBoolean(data.falseBooleanValue); + } + if (data.floatValue !== undefined && data.floatValue !== null) { + contents.floatValue = __limitedParseFloat32(data.floatValue); + } + if (data.integerValue !== undefined && data.integerValue !== null) { + contents.integerValue = __expectInt32(data.integerValue); + } + if (data.longValue !== undefined && data.longValue !== null) { + contents.longValue = __expectLong(data.longValue); + } + if (data.shortValue !== undefined && data.shortValue !== null) { + contents.shortValue = __expectShort(data.shortValue); + } + if (data.stringValue !== undefined && data.stringValue !== null) { + contents.stringValue = __expectString(data.stringValue); + } + if (data.trueBooleanValue !== undefined && data.trueBooleanValue !== null) { + contents.trueBooleanValue = __expectBoolean(data.trueBooleanValue); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1SimpleScalarPropertiesCommandError = 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_restJson1StreamingTraitsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1StreamingTraitsCommandError(output, context); + } + const contents: StreamingTraitsCommandOutput = { + $metadata: deserializeMetadata(output), + blob: undefined, + foo: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: any = output.body; + contents.blob = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1StreamingTraitsCommandError = 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_restJson1StreamingTraitsRequireLengthCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1StreamingTraitsRequireLengthCommandError(output, context); + } + const contents: StreamingTraitsRequireLengthCommandOutput = { + $metadata: deserializeMetadata(output), + blob: undefined, + foo: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: any = output.body; + contents.blob = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1StreamingTraitsRequireLengthCommandError = 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_restJson1StreamingTraitsWithMediaTypeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommandError(output, context); + } + const contents: StreamingTraitsWithMediaTypeCommandOutput = { + $metadata: deserializeMetadata(output), + blob: undefined, + foo: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: any = output.body; + contents.blob = data; + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1StreamingTraitsWithMediaTypeCommandError = 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_restJson1TimestampFormatHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1TimestampFormatHeadersCommandError(output, context); + } + const contents: TimestampFormatHeadersCommandOutput = { + $metadata: deserializeMetadata(output), + defaultFormat: undefined, + memberDateTime: undefined, + memberEpochSeconds: undefined, + memberHttpDate: undefined, + targetDateTime: undefined, + targetEpochSeconds: undefined, + targetHttpDate: undefined, + }; + if (output.headers["x-memberepochseconds"] !== undefined) { + contents.memberEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-memberepochseconds"])); + } + if (output.headers["x-memberhttpdate"] !== undefined) { + contents.memberHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-memberhttpdate"])); + } + if (output.headers["x-memberdatetime"] !== undefined) { + contents.memberDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-memberdatetime"])); + } + if (output.headers["x-defaultformat"] !== undefined) { + contents.defaultFormat = __expectNonNull(__parseRfc7231DateTime(output.headers["x-defaultformat"])); + } + if (output.headers["x-targetepochseconds"] !== undefined) { + contents.targetEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-targetepochseconds"])); + } + if (output.headers["x-targethttpdate"] !== undefined) { + contents.targetHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-targethttpdate"])); + } + if (output.headers["x-targetdatetime"] !== undefined) { + contents.targetDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-targetdatetime"])); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1TimestampFormatHeadersCommandError = 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)); +}; + +const deserializeAws_restJson1ComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + Header: undefined, + Nested: undefined, + TopLevel: undefined, + }; + if (parsedOutput.headers["x-header"] !== undefined) { + contents.Header = parsedOutput.headers["x-header"]; + } + const data: any = parsedOutput.body; + if (data.Nested !== undefined && data.Nested !== null) { + contents.Nested = deserializeAws_restJson1ComplexNestedErrorData(data.Nested, context); + } + if (data.TopLevel !== undefined && data.TopLevel !== null) { + contents.TopLevel = __expectString(data.TopLevel); + } + return contents; +}; + +const deserializeAws_restJson1FooErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: FooError = { + name: "FooError", + $fault: "server", + $metadata: deserializeMetadata(parsedOutput), + }; + const data: any = parsedOutput.body; + return contents; +}; + +const deserializeAws_restJson1InvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + Message: undefined, + }; + const data: any = parsedOutput.body; + if (data.Message !== undefined && data.Message !== null) { + contents.Message = __expectString(data.Message); + } + return contents; +}; + +const serializeAws_restJson1DenseBooleanMap = (input: { [key: string]: boolean }, 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_restJson1DenseNumberMap = (input: { [key: string]: number }, 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_restJson1DenseSetMap = (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]: serializeAws_restJson1StringSet(value, context), + }; + }, {}); +}; + +const serializeAws_restJson1DenseStringMap = (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_restJson1DenseStructMap = ( + input: { [key: string]: GreetingStruct }, + context: __SerdeContext +): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: serializeAws_restJson1GreetingStruct(value, context), + }; + }, {}); +}; + +const serializeAws_restJson1Document = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + +const serializeAws_restJson1MyUnion = (input: MyUnion, context: __SerdeContext): any => { + return MyUnion.visit(input, { + blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), + booleanValue: (value) => ({ booleanValue: value }), + enumValue: (value) => ({ enumValue: value }), + listValue: (value) => ({ listValue: serializeAws_restJson1StringList(value, context) }), + mapValue: (value) => ({ mapValue: serializeAws_restJson1StringMap(value, context) }), + numberValue: (value) => ({ numberValue: value }), + renamedStructureValue: (value) => ({ + renamedStructureValue: serializeAws_restJson1RenamedGreeting(value, context), + }), + stringValue: (value) => ({ stringValue: value }), + structureValue: (value) => ({ structureValue: serializeAws_restJson1GreetingStruct(value, context) }), + timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), + _: (name, value) => ({ name: value } as any), + }); +}; + +const serializeAws_restJson1NestedPayload = (input: NestedPayload, context: __SerdeContext): any => { + return { + ...(input.greeting !== undefined && input.greeting !== null && { greeting: input.greeting }), + ...(input.name !== undefined && input.name !== null && { name: input.name }), + }; +}; + +const serializeAws_restJson1RecursiveShapesInputOutputNested1 = ( + input: RecursiveShapesInputOutputNested1, + context: __SerdeContext +): any => { + return { + ...(input.foo !== undefined && input.foo !== null && { foo: input.foo }), + ...(input.nested !== undefined && + input.nested !== null && { + nested: serializeAws_restJson1RecursiveShapesInputOutputNested2(input.nested, context), + }), + }; +}; + +const serializeAws_restJson1RecursiveShapesInputOutputNested2 = ( + input: RecursiveShapesInputOutputNested2, + context: __SerdeContext +): any => { + return { + ...(input.bar !== undefined && input.bar !== null && { bar: input.bar }), + ...(input.recursiveMember !== undefined && + input.recursiveMember !== null && { + recursiveMember: serializeAws_restJson1RecursiveShapesInputOutputNested1(input.recursiveMember, context), + }), + }; +}; + +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) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: value, + }; + }, {}); +}; + +const serializeAws_restJson1SparseNumberMap = (input: { [key: string]: number }, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: value, + }; + }, {}); +}; + +const serializeAws_restJson1SparseSetMap = (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, [key]: null as any }; + } + return { + ...acc, + [key]: serializeAws_restJson1StringSet(value, context), + }; + }, {}); +}; + +const serializeAws_restJson1SparseStructMap = ( + input: { [key: string]: GreetingStruct }, + context: __SerdeContext +): any => { + return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: serializeAws_restJson1GreetingStruct(value, context), + }; + }, {}); +}; + +const serializeAws_restJson1StructureList = (input: StructureListMember[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_restJson1StructureListMember(entry, context); + }); +}; + +const serializeAws_restJson1StructureListMember = (input: StructureListMember, context: __SerdeContext): any => { + return { + ...(input.a !== undefined && input.a !== null && { value: input.a }), + ...(input.b !== undefined && input.b !== null && { other: input.b }), + }; +}; + +const serializeAws_restJson1RenamedGreeting = (input: RenamedGreeting, context: __SerdeContext): any => { + return { + ...(input.salutation !== undefined && input.salutation !== null && { salutation: input.salutation }), + }; +}; + +const serializeAws_restJson1BooleanList = (input: boolean[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1FooEnumMap = (input: { [key: string]: FooEnum | 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_restJson1FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + return { + ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), + }; +}; + +const serializeAws_restJson1IntegerList = (input: number[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1NestedStringList = (input: string[][], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return serializeAws_restJson1StringList(entry, context); + }); +}; + +const serializeAws_restJson1SparseStringList = (input: string[], context: __SerdeContext): any => { + return input.map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + +const serializeAws_restJson1SparseStringMap = (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, [key]: null as any }; + } + return { + ...acc, + [key]: value, + }; + }, {}); +}; + +const serializeAws_restJson1StringList = (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_restJson1StringMap = (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_restJson1StringSet = (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_restJson1TimestampList = (input: Date[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return Math.round(entry.getTime() / 1000); + }); +}; + +const deserializeAws_restJson1ComplexNestedErrorData = ( + output: any, + context: __SerdeContext +): ComplexNestedErrorData => { + return { + Foo: __expectString(output.Fooooo), + } as any; +}; + +const deserializeAws_restJson1DenseBooleanMap = (output: any, context: __SerdeContext): { [key: string]: boolean } => { + return Object.entries(output).reduce((acc: { [key: string]: boolean }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectBoolean(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1DenseNumberMap = (output: any, context: __SerdeContext): { [key: string]: number } => { + return Object.entries(output).reduce((acc: { [key: string]: number }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectInt32(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1DenseSetMap = (output: any, context: __SerdeContext): { [key: string]: string[] } => { + return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_restJson1StringSet(value, context), + }; + }, {}); +}; + +const deserializeAws_restJson1DenseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1DenseStructMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return Object.entries(output).reduce((acc: { [key: string]: GreetingStruct }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: deserializeAws_restJson1GreetingStruct(value, context), + }; + }, {}); +}; + +const deserializeAws_restJson1Document = (output: any, context: __SerdeContext): __DocumentType => { + return output; +}; + +const deserializeAws_restJson1MyUnion = (output: any, context: __SerdeContext): MyUnion => { + if (output.blobValue !== undefined && output.blobValue !== null) { + return { + blobValue: context.base64Decoder(output.blobValue), + }; + } + if (__expectBoolean(output.booleanValue) !== undefined) { + return { booleanValue: __expectBoolean(output.booleanValue) as any }; + } + if (__expectString(output.enumValue) !== undefined) { + return { enumValue: __expectString(output.enumValue) as any }; + } + if (output.listValue !== undefined && output.listValue !== null) { + return { + listValue: deserializeAws_restJson1StringList(output.listValue, context), + }; + } + if (output.mapValue !== undefined && output.mapValue !== null) { + return { + mapValue: deserializeAws_restJson1StringMap(output.mapValue, context), + }; + } + if (__expectInt32(output.numberValue) !== undefined) { + return { numberValue: __expectInt32(output.numberValue) as any }; + } + if (output.renamedStructureValue !== undefined && output.renamedStructureValue !== null) { + return { + renamedStructureValue: deserializeAws_restJson1RenamedGreeting(output.renamedStructureValue, context), + }; + } + if (__expectString(output.stringValue) !== undefined) { + return { stringValue: __expectString(output.stringValue) as any }; + } + if (output.structureValue !== undefined && output.structureValue !== null) { + return { + structureValue: deserializeAws_restJson1GreetingStruct(output.structureValue, context), + }; + } + if (output.timestampValue !== undefined && output.timestampValue !== null) { + return { + timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), + }; + } + return { $unknown: Object.entries(output)[0] }; +}; + +const deserializeAws_restJson1NestedPayload = (output: any, context: __SerdeContext): NestedPayload => { + return { + greeting: __expectString(output.greeting), + name: __expectString(output.name), + } as any; +}; + +const deserializeAws_restJson1RecursiveShapesInputOutputNested1 = ( + output: any, + context: __SerdeContext +): RecursiveShapesInputOutputNested1 => { + return { + foo: __expectString(output.foo), + nested: + output.nested !== undefined && output.nested !== null + ? deserializeAws_restJson1RecursiveShapesInputOutputNested2(output.nested, context) + : undefined, + } as any; +}; + +const deserializeAws_restJson1RecursiveShapesInputOutputNested2 = ( + output: any, + context: __SerdeContext +): RecursiveShapesInputOutputNested2 => { + return { + bar: __expectString(output.bar), + recursiveMember: + output.recursiveMember !== undefined && output.recursiveMember !== null + ? deserializeAws_restJson1RecursiveShapesInputOutputNested1(output.recursiveMember, context) + : undefined, + } as any; +}; + +const deserializeAws_restJson1SparseBooleanMap = (output: any, context: __SerdeContext): { [key: string]: boolean } => { + return Object.entries(output).reduce((acc: { [key: string]: boolean }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: __expectBoolean(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1SparseNumberMap = (output: any, context: __SerdeContext): { [key: string]: number } => { + return Object.entries(output).reduce((acc: { [key: string]: number }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: __expectInt32(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1SparseSetMap = (output: any, context: __SerdeContext): { [key: string]: string[] } => { + return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: deserializeAws_restJson1StringSet(value, context), + }; + }, {}); +}; + +const deserializeAws_restJson1SparseStructMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return Object.entries(output).reduce((acc: { [key: string]: GreetingStruct }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: deserializeAws_restJson1GreetingStruct(value, context), + }; + }, {}); +}; + +const deserializeAws_restJson1StructureList = (output: any, context: __SerdeContext): StructureListMember[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_restJson1StructureListMember(entry, context); + }); +}; + +const deserializeAws_restJson1StructureListMember = (output: any, context: __SerdeContext): StructureListMember => { + return { + a: __expectString(output.value), + b: __expectString(output.other), + } as any; +}; + +const deserializeAws_restJson1RenamedGreeting = (output: any, context: __SerdeContext): RenamedGreeting => { + return { + salutation: __expectString(output.salutation), + } as any; +}; + +const deserializeAws_restJson1BooleanList = (output: any, context: __SerdeContext): boolean[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectBoolean(entry) as any; + }); +}; + +const deserializeAws_restJson1FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restJson1FooEnumMap = ( + output: any, + context: __SerdeContext +): { [key: string]: FooEnum | string } => { + return Object.entries(output).reduce((acc: { [key: string]: FooEnum | string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + const uniqueValues = new Set(); + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + const parsedEntry = __expectString(entry) as any; + if (uniqueValues.has(parsedEntry)) { + throw new TypeError('All elements of the set "aws.protocoltests.shared#FooEnumSet" must be unique.'); + } else { + uniqueValues.add(parsedEntry); + return parsedEntry; + } + }); +}; + +const deserializeAws_restJson1GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { + return { + hi: __expectString(output.hi), + } as any; +}; + +const deserializeAws_restJson1IntegerList = (output: any, context: __SerdeContext): number[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectInt32(entry) as any; + }); +}; + +const deserializeAws_restJson1NestedStringList = (output: any, context: __SerdeContext): string[][] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_restJson1StringList(entry, context); + }); +}; + +const deserializeAws_restJson1SparseStringList = (output: any, context: __SerdeContext): string[] => { + return (output || []).map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restJson1SparseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return { ...acc, [key]: null as any }; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1StringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restJson1StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { + return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + return { + ...acc, + [key]: __expectString(value) as any, + }; + }, {}); +}; + +const deserializeAws_restJson1StringSet = (output: any, context: __SerdeContext): string[] => { + const uniqueValues = new Set(); + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + const parsedEntry = __expectString(entry) as any; + if (uniqueValues.has(parsedEntry)) { + throw new TypeError('All elements of the set "aws.protocoltests.shared#StringSet" must be unique.'); + } else { + uniqueValues.add(parsedEntry); + return parsedEntry; + } + }); +}; + +const deserializeAws_restJson1TimestampList = (output: any, context: __SerdeContext): Date[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectNonNull(__parseEpochTimestamp(__expectNumber(entry))); + }); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const isSerializableHeaderValue = (value: any): boolean => + value !== undefined && + value !== null && + value !== "" && + (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && + (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + return JSON.parse(encoded); + } + return {}; + }); + +/** + * Load an error code for the aws.rest-json-1.1 protocol. + */ +const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { + const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + + const sanitizeErrorCode = (rawValue: string): string => { + let cleanValue = rawValue; + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== undefined) { + return sanitizeErrorCode(output.headers[headerKey]); + } + + if (data.code !== undefined) { + return sanitizeErrorCode(data.code); + } + + if (data["__type"] !== undefined) { + return sanitizeErrorCode(data["__type"]); + } + + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..eb22e57df908 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts @@ -0,0 +1,41 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { blobHasher as streamHasher } from "@aws-sdk/hash-blob-browser"; +import { Md5 } from "@aws-sdk/md5-js"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + md5: config?.md5 ?? Md5, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + streamHasher: config?.streamHasher ?? streamHasher, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..f18442bcf90d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..548bcfef2cee --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { defaultRegionInfoProvider } from "./endpoints"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => ({ + apiVersion: "2019-12-16", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "Rest Json Protocol", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts new file mode 100644 index 000000000000..5fce08d94ec8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts @@ -0,0 +1,44 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { fileStreamHasher as streamHasher } from "@aws-sdk/hash-stream-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + md5: config?.md5 ?? Hash.bind(null, "md5"), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + streamHasher: config?.streamHasher ?? streamHasher, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts b/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts new file mode 100644 index 000000000000..879c3fd9d52f --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts @@ -0,0 +1,7617 @@ +import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; +import { buildQueryString } from "@aws-sdk/querystring-builder"; +import { Encoder as __Encoder } from "@aws-sdk/types"; +import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; +import { Readable } from "stream"; + +import { AllQueryStringTypesCommand } from "../../src/commands/AllQueryStringTypesCommand"; +import { ConstantAndVariableQueryStringCommand } from "../../src/commands/ConstantAndVariableQueryStringCommand"; +import { ConstantQueryStringCommand } from "../../src/commands/ConstantQueryStringCommand"; +import { DocumentTypeAsPayloadCommand } from "../../src/commands/DocumentTypeAsPayloadCommand"; +import { DocumentTypeCommand } from "../../src/commands/DocumentTypeCommand"; +import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; +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 { HttpChecksumRequiredCommand } from "../../src/commands/HttpChecksumRequiredCommand"; +import { HttpEnumPayloadCommand } from "../../src/commands/HttpEnumPayloadCommand"; +import { HttpPayloadTraitsCommand } from "../../src/commands/HttpPayloadTraitsCommand"; +import { HttpPayloadTraitsWithMediaTypeCommand } from "../../src/commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { HttpPayloadWithStructureCommand } from "../../src/commands/HttpPayloadWithStructureCommand"; +import { HttpPrefixHeadersCommand } from "../../src/commands/HttpPrefixHeadersCommand"; +import { HttpPrefixHeadersResponseCommand } from "../../src/commands/HttpPrefixHeadersResponseCommand"; +import { HttpRequestWithFloatLabelsCommand } from "../../src/commands/HttpRequestWithFloatLabelsCommand"; +import { HttpRequestWithGreedyLabelInPathCommand } from "../../src/commands/HttpRequestWithGreedyLabelInPathCommand"; +import { HttpRequestWithLabelsAndTimestampFormatCommand } from "../../src/commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { HttpRequestWithLabelsCommand } from "../../src/commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommand } from "../../src/commands/HttpResponseCodeCommand"; +import { HttpStringPayloadCommand } from "../../src/commands/HttpStringPayloadCommand"; +import { IgnoreQueryParamsInResponseCommand } from "../../src/commands/IgnoreQueryParamsInResponseCommand"; +import { InputAndOutputWithHeadersCommand } from "../../src/commands/InputAndOutputWithHeadersCommand"; +import { JsonBlobsCommand } from "../../src/commands/JsonBlobsCommand"; +import { JsonEnumsCommand } from "../../src/commands/JsonEnumsCommand"; +import { JsonListsCommand } from "../../src/commands/JsonListsCommand"; +import { JsonMapsCommand } from "../../src/commands/JsonMapsCommand"; +import { JsonTimestampsCommand } from "../../src/commands/JsonTimestampsCommand"; +import { JsonUnionsCommand } from "../../src/commands/JsonUnionsCommand"; +import { MediaTypeHeaderCommand } from "../../src/commands/MediaTypeHeaderCommand"; +import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; +import { NullAndEmptyHeadersClientCommand } from "../../src/commands/NullAndEmptyHeadersClientCommand"; +import { OmitsNullSerializesEmptyStringCommand } from "../../src/commands/OmitsNullSerializesEmptyStringCommand"; +import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryParamsAsStringListMapCommand } from "../../src/commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommand } from "../../src/commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommand } from "../../src/commands/RecursiveShapesCommand"; +import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; +import { StreamingTraitsCommand } from "../../src/commands/StreamingTraitsCommand"; +import { StreamingTraitsRequireLengthCommand } from "../../src/commands/StreamingTraitsRequireLengthCommand"; +import { StreamingTraitsWithMediaTypeCommand } from "../../src/commands/StreamingTraitsWithMediaTypeCommand"; +import { TimestampFormatHeadersCommand } from "../../src/commands/TimestampFormatHeadersCommand"; +import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; +import { RestJsonProtocolClient } from "../../src/RestJsonProtocolClient"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Serializes query string parameters with all supported types + */ +it("RestJsonAllQueryStringTypes:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryString: "Hello there", + + queryStringList: ["a", "b", "c"], + + queryStringSet: ["a", "b", "c"], + + queryByte: 1, + + queryShort: 2, + + queryInteger: 3, + + queryIntegerList: [ + 1, + + 2, + + 3, + ], + + queryIntegerSet: [ + 1, + + 2, + + 3, + ], + + queryLong: 4, + + queryFloat: 1.1, + + queryDouble: 1.1, + + queryDoubleList: [ + 1.1, + + 2.1, + + 3.1, + ], + + queryBoolean: true, + + queryBooleanList: [true, false, true], + + queryTimestamp: new Date(1000), + + queryTimestampList: [new Date(1000), new Date(2000), new Date(3000)], + + queryEnum: "Foo", + + queryEnumList: ["Foo", "Baz", "Bar"], + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("String=Hello%20there"); + expect(queryString).toContain("StringList=a"); + expect(queryString).toContain("StringList=b"); + expect(queryString).toContain("StringList=c"); + expect(queryString).toContain("StringSet=a"); + expect(queryString).toContain("StringSet=b"); + expect(queryString).toContain("StringSet=c"); + expect(queryString).toContain("Byte=1"); + expect(queryString).toContain("Short=2"); + expect(queryString).toContain("Integer=3"); + expect(queryString).toContain("IntegerList=1"); + expect(queryString).toContain("IntegerList=2"); + expect(queryString).toContain("IntegerList=3"); + expect(queryString).toContain("IntegerSet=1"); + expect(queryString).toContain("IntegerSet=2"); + expect(queryString).toContain("IntegerSet=3"); + expect(queryString).toContain("Long=4"); + expect(queryString).toContain("Float=1.1"); + expect(queryString).toContain("Double=1.1"); + expect(queryString).toContain("DoubleList=1.1"); + expect(queryString).toContain("DoubleList=2.1"); + expect(queryString).toContain("DoubleList=3.1"); + expect(queryString).toContain("Boolean=true"); + expect(queryString).toContain("BooleanList=true"); + expect(queryString).toContain("BooleanList=false"); + expect(queryString).toContain("BooleanList=true"); + expect(queryString).toContain("Timestamp=1970-01-01T00%3A00%3A01Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A01Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A02Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A03Z"); + expect(queryString).toContain("Enum=Foo"); + expect(queryString).toContain("EnumList=Foo"); + expect(queryString).toContain("EnumList=Baz"); + expect(queryString).toContain("EnumList=Bar"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Handles query string maps + */ +it("RestJsonQueryStringMap:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryParamsMapOfStringList: { + QueryParamsStringKeyA: ["Foo"], + + QueryParamsStringKeyB: ["Bar"], + } as any, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("QueryParamsStringKeyA=Foo"); + expect(queryString).toContain("QueryParamsStringKeyB=Bar"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Handles escaping all required characters in the query string. + */ +it("RestJsonQueryStringEscaping:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryString: "%:/?#[]@!$&'()*+,;=😹", + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("String=%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling NaN float query values. + */ +it("RestJsonSupportsNaNFloatQueryValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: NaN, + + queryDouble: NaN, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=NaN"); + expect(queryString).toContain("Double=NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float query values. + */ +it("RestJsonSupportsInfinityFloatQueryValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: Infinity, + + queryDouble: Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=Infinity"); + expect(queryString).toContain("Double=Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float query values. + */ +it("RestJsonSupportsNegativeInfinityFloatQueryValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: -Infinity, + + queryDouble: -Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=-Infinity"); + expect(queryString).toContain("Double=-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Mixes constant and variable query string parameters + */ +it("RestJsonConstantAndVariableQueryStringMissingOneValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantAndVariableQueryStringCommand({ + baz: "bam", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantAndVariableQueryString"); + + expect(r.query["maybeSet"]).toBeUndefined(); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("baz=bam"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Mixes constant and variable query string parameters + */ +it("RestJsonConstantAndVariableQueryStringAllValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantAndVariableQueryStringCommand({ + baz: "bam", + + maybeSet: "yes", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantAndVariableQueryString"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("baz=bam"); + expect(queryString).toContain("maybeSet=yes"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Includes constant query string parameters + */ +it("RestJsonConstantQueryString:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantQueryStringCommand({ + hello: "hi", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantQueryString/hi"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("hello"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes document types as part of the JSON request payload with no escaping. + */ +it("DocumentTypeInputWithObject:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeCommand({ + stringValue: "string", + + documentValue: { + foo: "bar", + }, + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"documentValue\": { + \"foo\": \"bar\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes document types using a string. + */ +it("DocumentInputWithString:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeCommand({ + stringValue: "string", + + documentValue: "hello", + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"documentValue\": \"hello\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes document types using a number. + */ +it("DocumentInputWithNumber:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeCommand({ + stringValue: "string", + + documentValue: 10, + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"documentValue\": 10 + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes document types using a boolean. + */ +it("DocumentInputWithBoolean:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeCommand({ + stringValue: "string", + + documentValue: true, + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"documentValue\": true + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes document types using a list. + */ +it("DocumentInputWithList:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeCommand({ + stringValue: "string", + + documentValue: [ + true, + + "hi", + + [ + 1, + + 2, + ], + + { + foo: { + baz: [3, 4], + }, + }, + ], + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"documentValue\": [ + true, + \"hi\", + [ + 1, + 2 + ], + { + \"foo\": { + \"baz\": [ + 3, + 4 + ] + } + } + ] + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes documents as part of the JSON response payload with no escaping. + */ +it("DocumentOutput:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "documentValue": { + "foo": "bar" + } + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + documentValue: { + foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Document types can be JSON scalars too. + */ +it("DocumentOutputString:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "documentValue": "hello" + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + documentValue: "hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Document types can be JSON scalars too. + */ +it("DocumentOutputNumber:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "documentValue": 10 + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + documentValue: 10, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Document types can be JSON scalars too. + */ +it("DocumentOutputBoolean:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "documentValue": false + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + documentValue: false, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Document types can be JSON arrays. + */ +it("DocumentOutputArray:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "documentValue": [ + true, + false + ] + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringValue: "string", + + documentValue: [true, false], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a document as the target of the httpPayload trait. + */ +it("DocumentTypeAsPayloadInput:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeAsPayloadCommand({ + documentValue: { + foo: "bar", + }, + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentTypeAsPayload"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"foo\": \"bar\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a document as the target of the httpPayload trait using a string. + */ +it("DocumentTypeAsPayloadInputString:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new DocumentTypeAsPayloadCommand({ + documentValue: "hello", + } as any); + 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("PUT"); + expect(r.path).toBe("/DocumentTypeAsPayload"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `\"hello\"`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a document as the target of the httpPayload trait. + */ +it("DocumentTypeAsPayloadOutput:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "foo": "bar" + }` + ), + }); + + const params: any = {}; + const command = new DocumentTypeAsPayloadCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + documentValue: { + foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a document as a payload string. + */ +it("DocumentTypeAsPayloadOutputString:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `"hello"` + ), + }); + + const params: any = {}; + const command = new DocumentTypeAsPayloadCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + documentValue: "hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Clients should not serialize a JSON payload when no parameters + * are given that are sent in the body. A service will tolerate + * clients that omit a payload or that send a JSON object. + */ +it("RestJsonEmptyInputAndEmptyOutput:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyInputAndEmptyOutputCommand({} as any); + 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("/EmptyInputAndEmptyOutput"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * As of January 2021, server implementations are expected to + * respond with a JSON object regardless of if the output + * parameters are empty. + */ +it("RestJsonEmptyInputAndEmptyOutput:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * This test ensures that clients can gracefully handle + * situations where a service omits a JSON payload entirely. + */ +it("RestJsonEmptyInputAndEmptyOutputJsonObjectOutput:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("RestJsonEndpointTrait:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/EndpointOperation"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("RestJsonEndpointTraitWithHostLabel:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/EndpointWithHostLabelOperation"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{\"label\": \"bar\"}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that operations with errors successfully know how + * to deserialize a successful response. As of January 2021, + * server implementations are expected to respond with a + * JSON object regardless of if the output parameters are + * empty. + */ +it("RestJsonGreetingWithErrors:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-greeting": "Hello", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + greeting: "Hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * This test is similar to RestJsonGreetingWithErrors, but it + * ensures that clients can gracefully deal with a server + * omitting a response payload. + */ +it("RestJsonGreetingWithErrorsNoPayload:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-greeting": "Hello", + }, + `` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + greeting: "Hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. + */ +it("RestJsonFooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' + * is to be interpreted as 'ValidationException'. + * + * For an example service see Amazon Polly. + */ +it("RestJsonFooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. + */ +it("RestJsonFooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(false, 500, { + "x-amzn-errortype": + "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", + }), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. + * + * For example service see Amazon S3 Glacier. + */ +it("RestJsonFooErrorUsingCode:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "code": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("RestJsonFooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "code": "aws.protocoltests.restjson#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("RestJsonFooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "code": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type. + */ +it("RestJsonFooErrorWithDunderType:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "__type": "FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. + */ +it("RestJsonFooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "__type": "aws.protocoltests.restjson#FooError" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. + */ +it("RestJsonFooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 500, + { + "content-type": "application/json", + }, + `{ + "__type": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "FooError") { + console.log(err); + fail(`Expected a FooError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(500); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Serializes a complex error with no message member + */ +it("RestJsonComplexErrorWithNoMessage:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 403, + { + "x-amzn-errortype": "ComplexError", + "x-header": "Header", + "content-type": "application/json", + }, + `{ + "TopLevel": "Top level", + "Nested": { + "Fooooo": "bar" + } + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(403); + const paramsToValidate: any = [ + { + Header: "Header", + + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +it("RestJsonEmptyComplexErrorWithNoMessage:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 403, + { + "x-amzn-errortype": "ComplexError", + "content-type": "application/json", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(403); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Parses simple JSON errors + */ +it("RestJsonInvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "x-amzn-errortype": "InvalidGreeting", + "content-type": "application/json", + }, + `{ + "Message": "Hi" + }` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Custom endpoints supplied by users can have paths + */ +it("RestJsonHostWithPath:Request", async () => { + const client = new RestJsonProtocolClient({ + ...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("GET"); + expect(r.path).toBe("/custom/HostWithPathOperation"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Adds Content-MD5 header + */ +it("RestJsonHttpChecksumRequired:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpChecksumRequiredCommand({ + foo: "base64 encoded md5 checksum", + } as any); + 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("/HttpChecksumRequired"); + + expect(r.headers["content-md5"]).toBeDefined(); + expect(r.headers["content-md5"]).toBe("iB0/3YSo7maijL0IGOgA9g=="); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"foo\":\"base64 encoded md5 checksum\" + } + `; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +it("EnumPayloadRequest:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpEnumPayloadCommand({ + payload: "enumvalue", + } as any); + 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("/EnumPayload"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `enumvalue`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +it("EnumPayloadResponse:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `enumvalue`), + }); + + const params: any = {}; + const command = new HttpEnumPayloadCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + payload: "enumvalue", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("RestJsonHttpPayloadTraitsWithBlob:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/HttpPayloadTraits"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/octet-stream"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonHttpPayloadTraitsWithNoBlobBody:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsCommand({ + foo: "Foo", + } as any); + 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("/HttpPayloadTraits"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("RestJsonHttpPayloadTraitsWithBlob:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonHttpPayloadTraitsWithNoBlobBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("RestJsonHttpPayloadTraitsWithMediaTypeWithBlob:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsWithMediaTypeCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/HttpPayloadTraitsWithMediaType"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("RestJsonHttpPayloadTraitsWithMediaTypeWithBlob:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "text/plain", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsWithMediaTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload + */ +it("RestJsonHttpPayloadWithStructure:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithStructureCommand({ + nested: { + greeting: "hello", + + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithStructure"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"greeting\": \"hello\", + \"name\": \"Phreddy\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload + */ +it("RestJsonHttpPayloadWithStructure:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "greeting": "hello", + "name": "Phreddy" + }` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithStructureCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + greeting: "hello", + + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Adds headers by prefix + */ +it("RestJsonHttpPrefixHeadersArePresent:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPrefixHeadersCommand({ + foo: "Foo", + + fooMap: { + Abc: "Abc value", + + Def: "Def value", + } as any, + } as any); + 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("GET"); + expect(r.path).toBe("/HttpPrefixHeaders"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + expect(r.headers["x-foo-abc"]).toBeDefined(); + expect(r.headers["x-foo-abc"]).toBe("Abc value"); + expect(r.headers["x-foo-def"]).toBeDefined(); + expect(r.headers["x-foo-def"]).toBe("Def value"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * No prefix headers are serialized because the value is empty + */ +it("RestJsonHttpPrefixHeadersAreNotPresent:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPrefixHeadersCommand({ + foo: "Foo", + + fooMap: {} as any, + } as any); + 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("GET"); + expect(r.path).toBe("/HttpPrefixHeaders"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Adds headers by prefix + */ +it("RestJsonHttpPrefixHeadersArePresent:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-foo": "Foo", + "x-foo-abc": "Abc value", + "x-foo-def": "Def value", + }), + }); + + const params: any = {}; + const command = new HttpPrefixHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + fooMap: { + abc: "Abc value", + + def: "Def value", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * (de)serializes all response headers + */ +it("HttpPrefixHeadersResponse:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-foo": "Foo", + hello: "Hello", + }), + }); + + const params: any = {}; + const command = new HttpPrefixHeadersResponseCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + prefixHeaders: { + "x-foo": "Foo", + + hello: "Hello", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float label values. + */ +it("RestJsonSupportsNaNFloatLabels:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: NaN, + + double: NaN, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/NaN/NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float label values. + */ +it("RestJsonSupportsInfinityFloatLabels:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: Infinity, + + double: Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/Infinity/Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float label values. + */ +it("RestJsonSupportsNegativeInfinityFloatLabels:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: -Infinity, + + double: -Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/-Infinity/-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes greedy labels and normal labels + */ +it("RestJsonHttpRequestWithGreedyLabelInPath:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithGreedyLabelInPathCommand({ + foo: "hello/escape", + + baz: "there/guy", + } as any); + 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("GET"); + expect(r.path).toBe("/HttpRequestWithGreedyLabelInPath/foo/hello%2Fescape/baz/there/guy"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Sends a GET request that uses URI label bindings + */ +it("RestJsonInputWithHeadersAndAllParams:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithLabelsCommand({ + string: "string", + + short: 1, + + integer: 2, + + long: 3, + + float: 4.1, + + double: 5.1, + + boolean: true, + + timestamp: new Date(1576540098000), + } as any); + 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("GET"); + expect(r.path).toBe("/HttpRequestWithLabels/string/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Sends a GET request that uses URI label bindings + */ +it("RestJsonHttpRequestLabelEscaping:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithLabelsCommand({ + string: "%:/?#[]@!$&'()*+,;=😹", + + short: 1, + + integer: 2, + + long: 3, + + float: 4.1, + + double: 5.1, + + boolean: true, + + timestamp: new Date(1576540098000), + } as any); + 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("GET"); + expect(r.path).toBe( + "/HttpRequestWithLabels/%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z" + ); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes different timestamp formats in URI labels + */ +it("RestJsonHttpRequestWithLabelsAndTimestampFormat:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithLabelsAndTimestampFormatCommand({ + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + } as any); + 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("GET"); + expect(r.path).toBe( + "/HttpRequestWithLabelsAndTimestampFormat/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z/2019-12-16T23%3A48%3A18Z/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z" + ); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Binds the http response code to an output structure. Note that + * even though all members are bound outside of the payload, an + * empty JSON object is serialized in the response. However, + * clients should be able to handle an empty JSON object or an + * empty payload without failing to deserialize a response. + */ +it("RestJsonHttpResponseCode:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 201, + { + "content-type": "application/json", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new HttpResponseCodeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(201); + const paramsToValidate: any = [ + { + Status: 201, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * This test ensures that clients gracefully handle cases where + * the service responds with no payload rather than an empty JSON + * object. + */ +it("RestJsonHttpResponseCodeWithNoPayload:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 201, undefined, ``), + }); + + const params: any = {}; + const command = new HttpResponseCodeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(201); + const paramsToValidate: any = [ + { + Status: 201, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +it("StringPayloadRequest:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpStringPayloadCommand({ + payload: "rawstring", + } as any); + 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("/StringPayload"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `rawstring`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +it("StringPayloadResponse:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `rawstring`), + }); + + const params: any = {}; + const command = new HttpStringPayloadCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + payload: "rawstring", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Query parameters must be ignored when serializing the output + * of an operation. As of January 2021, server implementations + * are expected to respond with a JSON object regardless of + * if the output parameters are empty. + */ +it("RestJsonIgnoreQueryParamsInResponse:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new IgnoreQueryParamsInResponseCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * This test is similar to RestJsonIgnoreQueryParamsInResponse, + * but it ensures that clients gracefully handle responses from + * the server that do not serialize an empty JSON object. + */ +it("RestJsonIgnoreQueryParamsInResponseNoPayload:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new IgnoreQueryParamsInResponseCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Tests requests with string header bindings + */ +it("RestJsonInputAndOutputWithStringHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerString: "Hello", + + headerStringList: ["a", "b", "c"], + + headerStringSet: ["a", "b", "c"], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-string"]).toBeDefined(); + expect(r.headers["x-string"]).toBe("Hello"); + expect(r.headers["x-stringlist"]).toBeDefined(); + expect(r.headers["x-stringlist"]).toBe("a, b, c"); + expect(r.headers["x-stringset"]).toBeDefined(); + expect(r.headers["x-stringset"]).toBe("a, b, c"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with numeric header bindings + */ +it("RestJsonInputAndOutputWithNumericHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerByte: 1, + + headerShort: 123, + + headerInteger: 123, + + headerLong: 123, + + headerFloat: 1.1, + + headerDouble: 1.1, + + headerIntegerList: [ + 1, + + 2, + + 3, + ], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-byte"]).toBeDefined(); + expect(r.headers["x-byte"]).toBe("1"); + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("1.1"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("1.1"); + expect(r.headers["x-integer"]).toBeDefined(); + expect(r.headers["x-integer"]).toBe("123"); + expect(r.headers["x-integerlist"]).toBeDefined(); + expect(r.headers["x-integerlist"]).toBe("1, 2, 3"); + expect(r.headers["x-long"]).toBeDefined(); + expect(r.headers["x-long"]).toBe("123"); + expect(r.headers["x-short"]).toBeDefined(); + expect(r.headers["x-short"]).toBe("123"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with boolean header bindings + */ +it("RestJsonInputAndOutputWithBooleanHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerTrueBool: true, + + headerFalseBool: false, + + headerBooleanList: [true, false, true], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-boolean1"]).toBeDefined(); + expect(r.headers["x-boolean1"]).toBe("true"); + expect(r.headers["x-boolean2"]).toBeDefined(); + expect(r.headers["x-boolean2"]).toBe("false"); + expect(r.headers["x-booleanlist"]).toBeDefined(); + expect(r.headers["x-booleanlist"]).toBe("true, false, true"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with timestamp header bindings + */ +it("RestJsonInputAndOutputWithTimestampHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-timestamplist"]).toBeDefined(); + expect(r.headers["x-timestamplist"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with enum header bindings + */ +it("RestJsonInputAndOutputWithEnumHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerEnum: "Foo", + + headerEnumList: ["Foo", "Bar", "Baz"], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-enum"]).toBeDefined(); + expect(r.headers["x-enum"]).toBe("Foo"); + expect(r.headers["x-enumlist"]).toBeDefined(); + expect(r.headers["x-enumlist"]).toBe("Foo, Bar, Baz"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling NaN float header values. + */ +it("RestJsonSupportsNaNFloatHeaderInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: NaN, + + headerDouble: NaN, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("NaN"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float header values. + */ +it("RestJsonSupportsInfinityFloatHeaderInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: Infinity, + + headerDouble: Infinity, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("Infinity"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float header values. + */ +it("RestJsonSupportsNegativeInfinityFloatHeaderInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: -Infinity, + + headerDouble: -Infinity, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("-Infinity"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests responses with string header bindings + */ +it("RestJsonInputAndOutputWithStringHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-stringlist": "a, b, c", + "x-stringset": "a, b, c", + "x-string": "Hello", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerString: "Hello", + + headerStringList: ["a", "b", "c"], + + headerStringSet: ["a", "b", "c"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with numeric header bindings + */ +it("RestJsonInputAndOutputWithNumericHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-float": "1.1", + "x-byte": "1", + "x-long": "123", + "x-integer": "123", + "x-integerlist": "1, 2, 3", + "x-double": "1.1", + "x-short": "123", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerByte: 1, + + headerShort: 123, + + headerInteger: 123, + + headerLong: 123, + + headerFloat: 1.1, + + headerDouble: 1.1, + + headerIntegerList: [ + 1, + + 2, + + 3, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with boolean header bindings + */ +it("RestJsonInputAndOutputWithBooleanHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-booleanlist": "true, false, true", + "x-boolean1": "true", + "x-boolean2": "false", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerTrueBool: true, + + headerFalseBool: false, + + headerBooleanList: [true, false, true], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with timestamp header bindings + */ +it("RestJsonInputAndOutputWithTimestampHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-timestamplist": "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with enum header bindings + */ +it("RestJsonInputAndOutputWithEnumHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-enumlist": "Foo, Bar, Baz", + "x-enum": "Foo", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerEnum: "Foo", + + headerEnumList: ["Foo", "Bar", "Baz"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float header values. + */ +it("RestJsonSupportsNaNFloatHeaderOutputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-float": "NaN", + "x-double": "NaN", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: NaN, + + headerDouble: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float header values. + */ +it("RestJsonSupportsInfinityFloatHeaderOutputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-float": "Infinity", + "x-double": "Infinity", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: Infinity, + + headerDouble: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float header values. + */ +it("RestJsonSupportsNegativeInfinityFloatHeaderOutputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-float": "-Infinity", + "x-double": "-Infinity", + }), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: -Infinity, + + headerDouble: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Blobs are base64 encoded + */ +it("RestJsonJsonBlobs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonBlobsCommand({ + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + } as any); + 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("/JsonBlobs"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"data\": \"dmFsdWU=\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Blobs are base64 encoded + */ +it("RestJsonJsonBlobs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "data": "dmFsdWU=" + }` + ), + }); + + const params: any = {}; + const command = new JsonBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("RestJsonJsonEnums:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonEnumsCommand({ + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonEnums"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"fooEnum1\": \"Foo\", + \"fooEnum2\": \"0\", + \"fooEnum3\": \"1\", + \"fooEnumList\": [ + \"Foo\", + \"0\" + ], + \"fooEnumSet\": [ + \"Foo\", + \"0\" + ], + \"fooEnumMap\": { + \"hi\": \"Foo\", + \"zero\": \"0\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("RestJsonJsonEnums:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "fooEnum1": "Foo", + "fooEnum2": "0", + "fooEnum3": "1", + "fooEnumList": [ + "Foo", + "0" + ], + "fooEnumSet": [ + "Foo", + "0" + ], + "fooEnumMap": { + "hi": "Foo", + "zero": "0" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonEnumsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes JSON lists + */ +it("RestJsonLists:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonListsCommand({ + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + structureList: [ + { + a: "1", + + b: "2", + } as any, + + { + a: "3", + + b: "4", + } as any, + ], + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonLists"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringList\": [ + \"foo\", + \"bar\" + ], + \"stringSet\": [ + \"foo\", + \"bar\" + ], + \"integerList\": [ + 1, + 2 + ], + \"booleanList\": [ + true, + false + ], + \"timestampList\": [ + 1398796238, + 1398796238 + ], + \"enumList\": [ + \"Foo\", + \"0\" + ], + \"nestedStringList\": [ + [ + \"foo\", + \"bar\" + ], + [ + \"baz\", + \"qux\" + ] + ], + \"myStructureList\": [ + { + \"value\": \"1\", + \"other\": \"2\" + }, + { + \"value\": \"3\", + \"other\": \"4\" + } + ] + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes empty JSON lists + */ +it("RestJsonListsEmpty:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonListsCommand({ + stringList: [], + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonLists"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringList\": [] + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes null values in lists + */ +it("RestJsonListsSerializeNull:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonListsCommand({ + sparseStringList: [null, "hi"], + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonLists"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseStringList\": [ + null, + \"hi\" + ] + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes JSON lists + */ +it("RestJsonLists:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringList": [ + "foo", + "bar" + ], + "stringSet": [ + "foo", + "bar" + ], + "integerList": [ + 1, + 2 + ], + "booleanList": [ + true, + false + ], + "timestampList": [ + 1398796238, + 1398796238 + ], + "enumList": [ + "Foo", + "0" + ], + "nestedStringList": [ + [ + "foo", + "bar" + ], + [ + "baz", + "qux" + ] + ], + "myStructureList": [ + { + "value": "1", + "other": "2" + }, + { + "value": "3", + "other": "4" + } + ] + }` + ), + }); + + const params: any = {}; + const command = new JsonListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + structureList: [ + { + a: "1", + + b: "2", + }, + + { + a: "3", + + b: "4", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes empty JSON lists + */ +it("RestJsonListsEmpty:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringList": [] + }` + ), + }); + + const params: any = {}; + const command = new JsonListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: [], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes null values in sparse lists + */ +it("RestJsonListsSerializeNull:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "sparseStringList": [ + null, + "hi" + ] + }` + ), + }); + + const params: any = {}; + const command = new JsonListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseStringList: [null, "hi"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes JSON maps + */ +it("RestJsonJsonMaps:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + denseStructMap: { + foo: { + hi: "there", + } as any, + + baz: { + hi: "bye", + } as any, + } as any, + + sparseStructMap: { + foo: { + hi: "there", + } as any, + + baz: { + hi: "bye", + } as any, + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"denseStructMap\": { + \"foo\": { + \"hi\": \"there\" + }, + \"baz\": { + \"hi\": \"bye\" + } + }, + \"sparseStructMap\": { + \"foo\": { + \"hi\": \"there\" + }, + \"baz\": { + \"hi\": \"bye\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes JSON map values in sparse maps + */ +it("RestJsonSerializesNullMapValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + sparseBooleanMap: { + x: null, + } as any, + + sparseNumberMap: { + x: null, + } as any, + + sparseStringMap: { + x: null, + } as any, + + sparseStructMap: { + x: null, + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseBooleanMap\": { + \"x\": null + }, + \"sparseNumberMap\": { + \"x\": null + }, + \"sparseStringMap\": { + \"x\": null + }, + \"sparseStructMap\": { + \"x\": null + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensure that 0 and false are sent over the wire in all maps and lists + */ +it("RestJsonSerializesZeroValuesInMaps:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + denseNumberMap: { + x: 0, + } as any, + + sparseNumberMap: { + x: 0, + } as any, + + denseBooleanMap: { + x: false, + } as any, + + sparseBooleanMap: { + x: false, + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"denseNumberMap\": { + \"x\": 0 + }, + \"sparseNumberMap\": { + \"x\": 0 + }, + \"denseBooleanMap\": { + \"x\": false + }, + \"sparseBooleanMap\": { + \"x\": false + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * A request that contains a sparse map of sets + */ +it("RestJsonSerializesSparseSetMap:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + sparseSetMap: { + x: [], + + y: ["a", "b"], + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"] + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * A request that contains a dense map of sets. + */ +it("RestJsonSerializesDenseSetMap:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + denseSetMap: { + x: [], + + y: ["a", "b"], + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"denseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"] + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * A request that contains a sparse map of sets. + */ +it("RestJsonSerializesSparseSetMapAndRetainsNull:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonMapsCommand({ + sparseSetMap: { + x: [], + + y: ["a", "b"], + + z: null, + } as any, + } as any); + 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("/JsonMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"sparseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"], + \"z\": null + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes JSON maps + */ +it("RestJsonJsonMaps:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "denseStructMap": { + "foo": { + "hi": "there" + }, + "baz": { + "hi": "bye" + } + }, + "sparseStructMap": { + "foo": { + "hi": "there" + }, + "baz": { + "hi": "bye" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + denseStructMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + + sparseStructMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes null JSON map values + */ +it("RestJsonDeserializesNullMapValues:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "sparseBooleanMap": { + "x": null + }, + "sparseNumberMap": { + "x": null + }, + "sparseStringMap": { + "x": null + }, + "sparseStructMap": { + "x": null + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseBooleanMap: { + x: null, + }, + + sparseNumberMap: { + x: null, + }, + + sparseStringMap: { + x: null, + }, + + sparseStructMap: { + x: null, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensure that 0 and false are sent over the wire in all maps and lists + */ +it("RestJsonDeserializesZeroValuesInMaps:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "denseNumberMap": { + "x": 0 + }, + "sparseNumberMap": { + "x": 0 + }, + "denseBooleanMap": { + "x": false + }, + "sparseBooleanMap": { + "x": false + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + denseNumberMap: { + x: 0, + }, + + sparseNumberMap: { + x: 0, + }, + + denseBooleanMap: { + x: false, + }, + + sparseBooleanMap: { + x: false, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * A response that contains a sparse map of sets + */ +it("RestJsonDeserializesSparseSetMap:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "sparseSetMap": { + "x": [], + "y": ["a", "b"] + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseSetMap: { + x: [], + + y: ["a", "b"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * A response that contains a dense map of sets. + */ +it("RestJsonDeserializesDenseSetMap:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + denseSetMap: { + x: [], + + y: ["a", "b"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * A response that contains a sparse map of sets. + */ +it("RestJsonDeserializesSparseSetMapAndRetainsNull:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "sparseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + sparseSetMap: { + x: [], + + y: ["a", "b"], + + z: null, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Clients SHOULD tolerate seeing a null value in a dense map, and they SHOULD + * drop the null key-value pair. + */ +it("RestJsonDeserializesDenseSetMapAndSkipsNull:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "denseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + }` + ), + }); + + const params: any = {}; + const command = new JsonMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + denseSetMap: { + x: [], + + y: ["a", "b"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests how normal timestamps are serialized + */ +it("RestJsonJsonTimestamps:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonTimestampsCommand({ + normal: new Date(1398796238000), + } as any); + 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("/JsonTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"normal\": 1398796238 + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("RestJsonJsonTimestampsWithDateTimeFormat:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonTimestampsCommand({ + dateTime: new Date(1398796238000), + } as any); + 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("/JsonTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"dateTime\": \"2014-04-29T18:30:38Z\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("RestJsonJsonTimestampsWithEpochSecondsFormat:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonTimestampsCommand({ + epochSeconds: new Date(1398796238000), + } as any); + 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("/JsonTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"epochSeconds\": 1398796238 + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("RestJsonJsonTimestampsWithHttpDateFormat:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonTimestampsCommand({ + httpDate: new Date(1398796238000), + } as any); + 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("/JsonTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"httpDate\": \"Tue, 29 Apr 2014 18:30:38 GMT\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests how normal timestamps are serialized + */ +it("RestJsonJsonTimestamps:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "normal": 1398796238 + }` + ), + }); + + const params: any = {}; + const command = new JsonTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + normal: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("RestJsonJsonTimestampsWithDateTimeFormat:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "dateTime": "2014-04-29T18:30:38Z" + }` + ), + }); + + const params: any = {}; + const command = new JsonTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + dateTime: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("RestJsonJsonTimestampsWithEpochSecondsFormat:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "epochSeconds": 1398796238 + }` + ), + }); + + const params: any = {}; + const command = new JsonTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + epochSeconds: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("RestJsonJsonTimestampsWithHttpDateFormat:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "httpDate": "Tue, 29 Apr 2014 18:30:38 GMT" + }` + ), + }); + + const params: any = {}; + const command = new JsonTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + httpDate: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a string union value + */ +it("RestJsonSerializeStringUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + stringValue: "foo", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"stringValue\": \"foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a boolean union value + */ +it("RestJsonSerializeBooleanUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + booleanValue: true, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"booleanValue\": true + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a number union value + */ +it("RestJsonSerializeNumberUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + numberValue: 1, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"numberValue\": 1 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob union value + */ +it("RestJsonSerializeBlobUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"blobValue\": \"Zm9v\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a timestamp union value + */ +it("RestJsonSerializeTimestampUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + timestampValue: new Date(1398796238000), + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"timestampValue\": 1398796238 + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an enum union value + */ +it("RestJsonSerializeEnumUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + enumValue: "Foo", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"enumValue\": \"Foo\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a list union value + */ +it("RestJsonSerializeListUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + listValue: ["foo", "bar"], + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"listValue\": [\"foo\", \"bar\"] + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a map union value + */ +it("RestJsonSerializeMapUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"mapValue\": { + \"foo\": \"bar\", + \"spam\": \"eggs\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure union value + */ +it("RestJsonSerializeStructureUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + structureValue: { + hi: "hello", + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"structureValue\": { + \"hi\": \"hello\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a renamed structure union value + */ +it("RestJsonSerializeRenamedStructureUnionValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new JsonUnionsCommand({ + contents: { + renamedStructureValue: { + salutation: "hello!", + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/JsonUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"contents\": { + \"renamedStructureValue\": { + \"salutation\": \"hello!\" + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes a string union value + */ +it("RestJsonDeserializeStringUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "stringValue": "foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + stringValue: "foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a boolean union value + */ +it("RestJsonDeserializeBooleanUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "booleanValue": true + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + booleanValue: true, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a number union value + */ +it("RestJsonDeserializeNumberUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "numberValue": 1 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + numberValue: 1, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a blob union value + */ +it("RestJsonDeserializeBlobUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "blobValue": "Zm9v" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a timestamp union value + */ +it("RestJsonDeserializeTimestampUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "timestampValue": 1398796238 + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + timestampValue: new Date(1398796238000), + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes an enum union value + */ +it("RestJsonDeserializeEnumUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "enumValue": "Foo" + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + enumValue: "Foo", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a list union value + */ +it("RestJsonDeserializeListUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "listValue": ["foo", "bar"] + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + listValue: ["foo", "bar"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a map union value + */ +it("RestJsonDeserializeMapUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "mapValue": { + "foo": "bar", + "spam": "eggs" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + mapValue: { + foo: "bar", + + spam: "eggs", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes a structure union value + */ +it("RestJsonDeserializeStructureUnionValue:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "contents": { + "structureValue": { + "hi": "hello" + } + } + }` + ), + }); + + const params: any = {}; + const command = new JsonUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + contents: { + structureValue: { + hi: "hello", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Headers that target strings with a mediaType are base64 encoded + */ +it("MediaTypeHeaderInputBase64:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new MediaTypeHeaderCommand({ + json: "true", + } as any); + 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("GET"); + expect(r.path).toBe("/MediaTypeHeader"); + + expect(r.headers["x-json"]).toBeDefined(); + expect(r.headers["x-json"]).toBe("dHJ1ZQ=="); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Headers that target strings with a mediaType are base64 encoded + */ +it("MediaTypeHeaderOutputBase64:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-json": "dHJ1ZQ==", + }), + }); + + const params: any = {}; + const command = new MediaTypeHeaderCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + json: "true", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * No input serializes no payload. When clients do not need to + * serialize any data in the payload, they should omit a payload + * altogether. + */ +it("RestJsonNoInputAndNoOutput:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndNoOutputCommand({}); + 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("/NoInputAndNoOutput"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * When an operation does not define output, the service will respond + * with an empty payload, and may optionally include the content-type + * header. + */ +it("RestJsonNoInputAndNoOutput:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * No input serializes no payload. When clients do not need to + * serialize any data in the payload, they should omit a payload + * altogether. + */ +it.skip("RestJsonNoInputAndOutput:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndOutputCommand({}); + 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("/NoInputAndOutputOutput"); + + expect(r.headers["accept"]).toBeDefined(); + expect(r.headers["accept"]).toBe("application/json"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Operations that define output and do not bind anything to + * the payload return a JSON object in the response. + */ +it("RestJsonNoInputAndOutputWithJson:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{}` + ), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * This test is similar to RestJsonNoInputAndOutputWithJson, but + * it ensures that clients can gracefully handle responses that + * omit a JSON payload. + */ +it("RestJsonNoInputAndOutputNoPayload:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Do not send null values, empty strings, or empty lists over the wire in headers + */ +it("RestJsonNullAndEmptyHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NullAndEmptyHeadersClientCommand({ + a: null, + + b: "", + + c: [], + } as any); + 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("GET"); + expect(r.path).toBe("/NullAndEmptyHeadersClient"); + + expect(r.headers["x-a"]).toBeUndefined(); + expect(r.headers["x-b"]).toBeUndefined(); + expect(r.headers["x-c"]).toBeUndefined(); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Omits null query values + */ +it("RestJsonOmitsNullQuery:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OmitsNullSerializesEmptyStringCommand({ + nullValue: null, + } as any); + 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("GET"); + expect(r.path).toBe("/OmitsNullSerializesEmptyString"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes empty query strings + */ +it("RestJsonSerializesEmptyQueryValue:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OmitsNullSerializesEmptyStringCommand({ + emptyString: "", + } as any); + 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("GET"); + expect(r.path).toBe("/OmitsNullSerializesEmptyString"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Empty="); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Automatically adds idempotency token when not set + */ +it("RestJsonQueryIdempotencyTokenAutoFill:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/QueryIdempotencyTokenAutoFill"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Uses the given idempotency token as-is + */ +it("RestJsonQueryIdempotencyTokenAutoFillIsSet:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/QueryIdempotencyTokenAutoFill"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serialize query params from map of list strings + */ +it("RestJsonQueryParamsStringListMap:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryParamsAsStringListMapCommand({ + qux: "named", + + foo: { + baz: ["bar", "qux"], + } as any, + } as any); + 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("/StringListMap"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("corge=named"); + expect(queryString).toContain("baz=bar"); + expect(queryString).toContain("baz=qux"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Prefer named query parameters when serializing + */ +it("RestJsonQueryPrecedence:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryPrecedenceCommand({ + foo: "named", + + baz: { + bar: "fromMap", + + qux: "alsoFromMap", + } as any, + } as any); + 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("/Precedence"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("bar=named"); + expect(queryString).toContain("qux=alsoFromMap"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes recursive structures + */ +it("RestJsonRecursiveShapes:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new RecursiveShapesCommand({ + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + } as any, + } as any, + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/RecursiveShapes"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"nested\": { + \"foo\": \"Foo1\", + \"nested\": { + \"bar\": \"Bar1\", + \"recursiveMember\": { + \"foo\": \"Foo2\", + \"nested\": { + \"bar\": \"Bar2\" + } + } + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes recursive structures + */ +it("RestJsonRecursiveShapes:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "nested": { + "foo": "Foo1", + "nested": { + "bar": "Bar1", + "recursiveMember": { + "foo": "Foo2", + "nested": { + "bar": "Bar2" + } + } + } + } + }` + ), + }); + + const params: any = {}; + const command = new RecursiveShapesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("RestJsonSimpleScalarProperties:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + foo: "Foo", + + stringValue: "string", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"stringValue\": \"string\", + \"trueBooleanValue\": true, + \"falseBooleanValue\": false, + \"byteValue\": 1, + \"shortValue\": 2, + \"integerValue\": 3, + \"longValue\": 4, + \"floatValue\": 5.5, + \"DoubleDribble\": 6.5 + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Rest Json should not serialize null structure values + */ +it("RestJsonDoesntSerializeNullStructureValues:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + stringValue: null, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{}`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("RestJsonSupportsNaNFloatInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: NaN, + + doubleValue: NaN, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"NaN\", + \"DoubleDribble\": \"NaN\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("RestJsonSupportsInfinityFloatInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: Infinity, + + doubleValue: Infinity, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"Infinity\", + \"DoubleDribble\": \"Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("RestJsonSupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: -Infinity, + + doubleValue: -Infinity, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"floatValue\": \"-Infinity\", + \"DoubleDribble\": \"-Infinity\" + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("RestJsonSimpleScalarProperties:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/json", + }, + `{ + "stringValue": "string", + "trueBooleanValue": true, + "falseBooleanValue": false, + "byteValue": 1, + "shortValue": 2, + "integerValue": 3, + "longValue": 4, + "floatValue": 5.5, + "DoubleDribble": 6.5 + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: "string", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Rest Json should not deserialize null structure values + */ +it("RestJsonDoesntDeserializeNullStructureValues:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "stringValue": null + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Supports handling NaN float values. + */ +it("RestJsonSupportsNaNFloatInputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "floatValue": "NaN", + "DoubleDribble": "NaN" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("RestJsonSupportsInfinityFloatInputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "floatValue": "Infinity", + "DoubleDribble": "Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("RestJsonSupportsNegativeInfinityFloatInputs:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "floatValue": "-Infinity", + "DoubleDribble": "-Infinity" + }` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("RestJsonStreamingTraitsWithBlob:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new StreamingTraitsCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/StreamingTraits"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/octet-stream"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonStreamingTraitsWithNoBlobBody:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new StreamingTraitsCommand({ + foo: "Foo", + } as any); + 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("/StreamingTraits"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("RestJsonStreamingTraitsWithBlob:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/octet-stream", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new StreamingTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + const comparableBlob = await client.config.streamCollector(r["blob"]); + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + if (param === "blob") { + expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); + } else { + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + } + }); +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonStreamingTraitsWithNoBlobBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new StreamingTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + }, + ][0]; + const comparableBlob = await client.config.streamCollector(r["blob"]); + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + if (param === "blob") { + expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); + } else { + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + } + }); +}); + +/** + * Serializes a blob in the HTTP payload with a required length + */ +it("RestJsonStreamingTraitsRequireLengthWithBlob:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new StreamingTraitsRequireLengthCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/StreamingTraitsRequireLength"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/octet-stream"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonStreamingTraitsRequireLengthWithNoBlobBody:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new StreamingTraitsRequireLengthCommand({ + foo: "Foo", + } as any); + 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("/StreamingTraitsRequireLength"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes a blob in the HTTP payload with a required length + */ +it("RestJsonStreamingTraitsRequireLengthWithBlob:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/octet-stream", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new StreamingTraitsRequireLengthCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + const comparableBlob = await client.config.streamCollector(r["blob"]); + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + if (param === "blob") { + expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); + } else { + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + } + }); +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("RestJsonStreamingTraitsRequireLengthWithNoBlobBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new StreamingTraitsRequireLengthCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + }, + ][0]; + const comparableBlob = await client.config.streamCollector(r["blob"]); + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + if (param === "blob") { + expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); + } else { + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + } + }); +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("RestJsonStreamingTraitsWithMediaTypeWithBlob:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new StreamingTraitsWithMediaTypeCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/StreamingTraitsWithMediaType"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("RestJsonStreamingTraitsWithMediaTypeWithBlob:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "text/plain", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new StreamingTraitsWithMediaTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + const comparableBlob = await client.config.streamCollector(r["blob"]); + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + if (param === "blob") { + expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); + } else { + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + } + }); +}); + +/** + * Tests how timestamp request headers are serialized + */ +it("RestJsonTimestampFormatHeaders:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new TimestampFormatHeadersCommand({ + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + } as any); + 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("/TimestampFormatHeaders"); + + expect(r.headers["x-defaultformat"]).toBeDefined(); + expect(r.headers["x-defaultformat"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + expect(r.headers["x-memberdatetime"]).toBeDefined(); + expect(r.headers["x-memberdatetime"]).toBe("2019-12-16T23:48:18Z"); + expect(r.headers["x-memberepochseconds"]).toBeDefined(); + expect(r.headers["x-memberepochseconds"]).toBe("1576540098"); + expect(r.headers["x-memberhttpdate"]).toBeDefined(); + expect(r.headers["x-memberhttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + expect(r.headers["x-targetdatetime"]).toBeDefined(); + expect(r.headers["x-targetdatetime"]).toBe("2019-12-16T23:48:18Z"); + expect(r.headers["x-targetepochseconds"]).toBeDefined(); + expect(r.headers["x-targetepochseconds"]).toBe("1576540098"); + expect(r.headers["x-targethttpdate"]).toBeDefined(); + expect(r.headers["x-targethttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests how timestamp response headers are serialized + */ +it("RestJsonTimestampFormatHeaders:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, { + "x-targetepochseconds": "1576540098", + "x-memberdatetime": "2019-12-16T23:48:18Z", + "x-defaultformat": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-memberepochseconds": "1576540098", + "x-targethttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-memberhttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-targetdatetime": "2019-12-16T23:48:18Z", + }), + }); + + const params: any = {}; + const command = new TimestampFormatHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { + const expectedParts = JSON.parse(expectedBody); + const generatedParts = JSON.parse(generatedBody); + + return compareParts(expectedParts, generatedParts); +}; + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentOctetStreamBodies = ( + utf8Encoder: __Encoder, + expectedBody: string, + generatedBody: Uint8Array +): Object => { + const expectedParts = { Value: expectedBody }; + const generatedParts = { Value: utf8Encoder(generatedBody) }; + + 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-protocoltests-restjson/tsconfig.es.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-restjson/tsconfig.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-restxml/.gitignore b/protocol_tests/aws-protocoltests-restxml/.gitignore new file mode 100644 index 000000000000..619adfbf932a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/.gitignore @@ -0,0 +1,13 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json + +*.d.ts +*.js +*.js.map diff --git a/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md b/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md new file mode 100644 index 000000000000..5b159d5d1ef8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md @@ -0,0 +1,797 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) + + +### Features + +* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) +* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) + + + + + +# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) + + +### Features + +* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) + + + + + +# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) + + +### Features + +* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) +* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) +* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) + + + + + +# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) + + +### Bug Fixes + +* **client-s3:** use member xmlname if applicable ([#2835](https://github.com/aws/aws-sdk-js-v3/issues/2835)) ([7e634cf](https://github.com/aws/aws-sdk-js-v3/commit/7e634cfab78d0a82864f828c4c8c10c9d0cccc97)) +* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) + + +### Features + +* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) +* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) + + + + + +# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) + + +### Features + +* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) + + + + + +# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) + + +### Bug Fixes + +* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) + + +### Features + +* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) + + + + + +# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) + + +### Bug Fixes + +* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) + + + + + +# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) + + +### Bug Fixes + +* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) +* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) + + +### Features + +* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) + + + + + +# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) + + +### Bug Fixes + +* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) +* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) + + + + + +# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) + + +### Features + +* **clients:** update clients as of 07/08/2021 ([#2565](https://github.com/aws/aws-sdk-js-v3/issues/2565)) ([c9bd983](https://github.com/aws/aws-sdk-js-v3/commit/c9bd98328765c540b778f9085d0ec8870e5af6c9)) + + + + + +# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) + + +### Bug Fixes + +* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) + + + + + +# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) + + +### Bug Fixes + +* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) + + + + + +# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) + + +### Features + +* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) +* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) + + + + + +# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) + + +### Features + +* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) + + + + + +# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) + + +### Bug Fixes + +* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) + + + + + +# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) + + +### Bug Fixes + +* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) + + + + + +# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) + + +### Bug Fixes + +* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) + + +### Features + +* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) + + + + + +## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) + + +### Features + +* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) + + + + + +# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) + + +### Bug Fixes + +* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) + + +### Features + +* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) + + + + + +# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) + + +### Bug Fixes + +* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) + + + + + +# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) + + +### Features + +* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) + + + + + +# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) + + +### Bug Fixes + +* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) + + + + + +# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) + + +### Bug Fixes + +* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) + + + + + +# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) + + +### Bug Fixes + +* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) + + + + + +# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) + + +### Bug Fixes + +* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) + + + + + +# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) + + +### Features + +* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) +* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) + + + + + +# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) + + +### Bug Fixes + +* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) +* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) +* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) + + +### Features + +* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) + + + + + +# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) + + +### Bug Fixes + +* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) + + + + + +# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) + + +### Bug Fixes + +* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) +* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) +* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) +* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) + + +### Features + +* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) + + + + + +# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) + + +### Features + +* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) + + + + + +# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) + + +### Features + +* update clients as of 12/12/2020 ([#1771](https://github.com/aws/aws-sdk-js-v3/issues/1771)) ([f69ff44](https://github.com/aws/aws-sdk-js-v3/commit/f69ff440a79018ad69fcb26ad46e3db65b23ce71)) + + + + + +# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) + + +### Bug Fixes + +* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) + + +### Features + +* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) + + + + + +# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) + + +### Features + +* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) + + + + + +# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) + + +### Bug Fixes + +* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) + + + + + +# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) + + +### Features + +* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) + + + + + +# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) + + +### Bug Fixes + +* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) + + + + + +# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) + + +### Features + +* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) + + + + + +# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.9...@aws-sdk/aws-restxml@1.0.0-gamma.10) (2020-10-07) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.8...@aws-sdk/aws-restxml@1.0.0-gamma.9) (2020-09-29) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.7...@aws-sdk/aws-restxml@1.0.0-gamma.8) (2020-09-15) + + +### Bug Fixes + +* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) +* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) + + + + + +# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.6...@aws-sdk/aws-restxml@1.0.0-gamma.7) (2020-09-01) + + +### Features + +* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) + + + + + +# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.5...@aws-sdk/aws-restxml@1.0.0-gamma.6) (2020-08-25) + + +### Features + +* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) +* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) +* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) + + + + + +# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.4...@aws-sdk/aws-restxml@1.0.0-gamma.5) (2020-08-04) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.3...@aws-sdk/aws-restxml@1.0.0-gamma.4) (2020-07-21) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.2...@aws-sdk/aws-restxml@1.0.0-gamma.3) (2020-07-13) + +**Note:** Version bump only for package @aws-sdk/aws-restxml + + + + + +# 1.0.0-gamma.2 (2020-07-08) + + +### Features + +* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) + + + +# 1.0.0-gamma.2 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.1 (2020-05-26) + + + +# 1.0.0-gamma.1 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-gamma.0 (2020-05-21) + + +### Bug Fixes + +* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) + + +### Features + +* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) +* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) +* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) +* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) + + + +# 1.0.0-beta.4 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) + + + + + +# 1.0.0-beta.0 (2020-04-25) + + +### Bug Fixes + +* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) + + +### Features + +* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-restxml/LICENSE b/protocol_tests/aws-protocoltests-restxml/LICENSE new file mode 100644 index 000000000000..dd65ae06be7a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/protocol_tests/aws-protocoltests-restxml/README.md b/protocol_tests/aws-protocoltests-restxml/README.md new file mode 100644 index 000000000000..0556eb71cdf0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/README.md @@ -0,0 +1,203 @@ +# @aws-sdk/aws-protocoltests-restxml + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-restxml/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restxml) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-restxml.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restxml) + +## Description + +AWS SDK for JavaScript RestXmlProtocol Client for Node.js, Browser and React Native. + +A REST XML service that sends XML requests and responses. + +## Installing + +To install the this package, simply type add or install @aws-sdk/aws-protocoltests-restxml +using your favorite package manager: + +- `npm install @aws-sdk/aws-protocoltests-restxml` +- `yarn add @aws-sdk/aws-protocoltests-restxml` +- `pnpm add @aws-sdk/aws-protocoltests-restxml` + +## Getting Started + +### Import + +The AWS SDK is modulized by clients and commands. +To send a request, you only need to import the `RestXmlProtocolClient` and +the commands you need, for example `AllQueryStringTypesCommand`: + +```js +// ES5 example +const { RestXmlProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); +``` + +```ts +// ES6+ example +import { RestXmlProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restxml"; +``` + +### Usage + +To send a request, you: + +- Initiate client with configuration (e.g. credentials, region). +- Initiate command with input parameters. +- Call `send` operation on client with command object as input. +- If you are using a custom http handler, you may call `destroy()` to close open connections. + +```js +// a client can be shared by different commands. +const client = new RestXmlProtocolClient({ region: "REGION" }); + +const params = { + /** input parameters */ +}; +const command = new AllQueryStringTypesCommand(params); +``` + +#### Async/await + +We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) +operator to wait for the promise returned by send operation as follows: + +```js +// async/await. +try { + const data = await client.send(command); + // process data. +} catch (error) { + // error handling. +} finally { + // finally. +} +``` + +Async-await is clean, concise, intuitive, easy to debug and has better error handling +as compared to using Promise chains or callbacks. + +#### Promises + +You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) +to execute send operation. + +```js +client.send(command).then( + (data) => { + // process data. + }, + (error) => { + // error handling. + } +); +``` + +Promises can also be called using `.catch()` and `.finally()` as follows: + +```js +client + .send(command) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }) + .finally(() => { + // finally. + }); +``` + +#### Callbacks + +We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), +but they are supported by the send operation. + +```js +// callbacks. +client.send(command, (err, data) => { + // proccess err and data. +}); +``` + +#### v2 compatible style + +The client can also send requests using v2 compatible style. +However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post +on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) + +```ts +import * as AWS from "@aws-sdk/aws-protocoltests-restxml"; +const client = new AWS.RestXmlProtocol({ region: "REGION" }); + +// async/await. +try { + const data = await client.allQueryStringTypes(params); + // process data. +} catch (error) { + // error handling. +} + +// Promises. +client + .allQueryStringTypes(params) + .then((data) => { + // process data. + }) + .catch((error) => { + // error handling. + }); + +// callbacks. +client.allQueryStringTypes(params, (err, data) => { + // proccess err and data. +}); +``` + +### Troubleshooting + +When the service returns an exception, the error will include the exception information, +as well as response metadata (e.g. request id). + +```js +try { + const data = await client.send(command); + // process data. +} catch (error) { + const { requestId, cfId, extendedRequestId } = error.$metadata; + console.log({ requestId, cfId, extendedRequestId }); + /** + * The keys within exceptions are also parsed. + * You can access them by specifying exception names: + * if (error.name === 'SomeServiceException') { + * const value = error.specialKeyInException; + * } + */ +} +``` + +## Getting Help + +Please use these community resources for getting help. +We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. + +- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) + or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). +- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) + on AWS Developer Blog. +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. +- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). +- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). + +To test your universal JavaScript code in Node.js, browser and react-native environments, +visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). + +## Contributing + +This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-restxml` package is updated. +To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-restxml/package.json b/protocol_tests/aws-protocoltests-restxml/package.json new file mode 100644 index 000000000000..53a6f264238e --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/package.json @@ -0,0 +1,98 @@ +{ + "name": "@aws-sdk/aws-protocoltests-restxml", + "description": "@aws-sdk/aws-protocoltests-restxml client", + "version": "3.38.0", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/querystring-builder": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "@aws-sdk/xml-builder": "3.37.0", + "entities": "2.2.0", + "fast-xml-parser": "3.19.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-restxml", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-protocoltests-restxml" + } +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts new file mode 100644 index 000000000000..d429966268a9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts @@ -0,0 +1,1919 @@ +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +import { + AllQueryStringTypesCommand, + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "./commands/AllQueryStringTypesCommand"; +import { + BodyWithXmlNameCommand, + BodyWithXmlNameCommandInput, + BodyWithXmlNameCommandOutput, +} from "./commands/BodyWithXmlNameCommand"; +import { + ConstantAndVariableQueryStringCommand, + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "./commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommand, + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "./commands/ConstantQueryStringCommand"; +import { + EmptyInputAndEmptyOutputCommand, + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { + EndpointOperationCommand, + EndpointOperationCommandInput, + EndpointOperationCommandOutput, +} from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelHeaderOperationCommand, + EndpointWithHostLabelHeaderOperationCommandInput, + EndpointWithHostLabelHeaderOperationCommandOutput, +} from "./commands/EndpointWithHostLabelHeaderOperationCommand"; +import { + EndpointWithHostLabelOperationCommand, + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { + FlattenedXmlMapCommand, + FlattenedXmlMapCommandInput, + FlattenedXmlMapCommandOutput, +} from "./commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommand, + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommand, + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { + GreetingWithErrorsCommand, + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, +} from "./commands/GreetingWithErrorsCommand"; +import { + HttpPayloadTraitsCommand, + HttpPayloadTraitsCommandInput, + HttpPayloadTraitsCommandOutput, +} from "./commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommand, + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithMemberXmlNameCommand, + HttpPayloadWithMemberXmlNameCommandInput, + HttpPayloadWithMemberXmlNameCommandOutput, +} from "./commands/HttpPayloadWithMemberXmlNameCommand"; +import { + HttpPayloadWithStructureCommand, + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "./commands/HttpPayloadWithStructureCommand"; +import { + HttpPayloadWithXmlNameCommand, + HttpPayloadWithXmlNameCommandInput, + HttpPayloadWithXmlNameCommandOutput, +} from "./commands/HttpPayloadWithXmlNameCommand"; +import { + HttpPayloadWithXmlNamespaceAndPrefixCommand, + HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, +} from "./commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; +import { + HttpPayloadWithXmlNamespaceCommand, + HttpPayloadWithXmlNamespaceCommandInput, + HttpPayloadWithXmlNamespaceCommandOutput, +} from "./commands/HttpPayloadWithXmlNamespaceCommand"; +import { + HttpPrefixHeadersCommand, + HttpPrefixHeadersCommandInput, + HttpPrefixHeadersCommandOutput, +} from "./commands/HttpPrefixHeadersCommand"; +import { + HttpRequestWithFloatLabelsCommand, + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "./commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommand, + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommand, + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommand, + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "./commands/HttpRequestWithLabelsCommand"; +import { + HttpResponseCodeCommand, + HttpResponseCodeCommandInput, + HttpResponseCodeCommandOutput, +} from "./commands/HttpResponseCodeCommand"; +import { + IgnoreQueryParamsInResponseCommand, + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "./commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommand, + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "./commands/InputAndOutputWithHeadersCommand"; +import { + NestedXmlMapsCommand, + NestedXmlMapsCommandInput, + NestedXmlMapsCommandOutput, +} from "./commands/NestedXmlMapsCommand"; +import { + NoInputAndNoOutputCommand, + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, +} from "./commands/NoInputAndNoOutputCommand"; +import { + NoInputAndOutputCommand, + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, +} from "./commands/NoInputAndOutputCommand"; +import { + NullAndEmptyHeadersClientCommand, + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "./commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommand, + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "./commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommand, + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "./commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommand, + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommand, + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "./commands/QueryParamsAsStringListMapCommand"; +import { + QueryPrecedenceCommand, + QueryPrecedenceCommandInput, + QueryPrecedenceCommandOutput, +} from "./commands/QueryPrecedenceCommand"; +import { + RecursiveShapesCommand, + RecursiveShapesCommandInput, + RecursiveShapesCommandOutput, +} from "./commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommand, + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { + TimestampFormatHeadersCommand, + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "./commands/TimestampFormatHeadersCommand"; +import { + XmlAttributesCommand, + XmlAttributesCommandInput, + XmlAttributesCommandOutput, +} from "./commands/XmlAttributesCommand"; +import { + XmlAttributesOnPayloadCommand, + XmlAttributesOnPayloadCommandInput, + XmlAttributesOnPayloadCommandOutput, +} from "./commands/XmlAttributesOnPayloadCommand"; +import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { + XmlEmptyBlobsCommand, + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, +} from "./commands/XmlEmptyBlobsCommand"; +import { + XmlEmptyListsCommand, + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, +} from "./commands/XmlEmptyListsCommand"; +import { + XmlEmptyMapsCommand, + XmlEmptyMapsCommandInput, + XmlEmptyMapsCommandOutput, +} from "./commands/XmlEmptyMapsCommand"; +import { + XmlEmptyStringsCommand, + XmlEmptyStringsCommandInput, + XmlEmptyStringsCommandOutput, +} from "./commands/XmlEmptyStringsCommand"; +import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { XmlMapsCommand, XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; +import { + XmlMapsXmlNameCommand, + XmlMapsXmlNameCommandInput, + XmlMapsXmlNameCommandOutput, +} from "./commands/XmlMapsXmlNameCommand"; +import { + XmlNamespacesCommand, + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, +} from "./commands/XmlNamespacesCommand"; +import { + XmlTimestampsCommand, + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, +} from "./commands/XmlTimestampsCommand"; +import { XmlUnionsCommand, XmlUnionsCommandInput, XmlUnionsCommandOutput } from "./commands/XmlUnionsCommand"; +import { RestXmlProtocolClient } from "./RestXmlProtocolClient"; + +/** + * A REST XML service that sends XML requests and responses. + */ +export class RestXmlProtocol extends RestXmlProtocolClient { + /** + * This example uses all query string types. + */ + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): void; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): void; + public allQueryStringTypes( + args: AllQueryStringTypesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AllQueryStringTypesCommandOutput) => void), + cb?: (err: any, data?: AllQueryStringTypesCommandOutput) => void + ): Promise | void { + const command = new AllQueryStringTypesCommand(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 following example serializes a body that uses an XML name, + * changing the wrapper name. + */ + public bodyWithXmlName( + args: BodyWithXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public bodyWithXmlName( + args: BodyWithXmlNameCommandInput, + cb: (err: any, data?: BodyWithXmlNameCommandOutput) => void + ): void; + public bodyWithXmlName( + args: BodyWithXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: BodyWithXmlNameCommandOutput) => void + ): void; + public bodyWithXmlName( + args: BodyWithXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BodyWithXmlNameCommandOutput) => void), + cb?: (err: any, data?: BodyWithXmlNameCommandOutput) => void + ): Promise | void { + const command = new BodyWithXmlNameCommand(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 uses fixed query string params and variable query string params. + * The fixed query string parameters and variable parameters must both be + * serialized (implementations may need to merge them together). + */ + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): void; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): void; + public constantAndVariableQueryString( + args: ConstantAndVariableQueryStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void), + cb?: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void + ): Promise | void { + const command = new ConstantAndVariableQueryStringCommand(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 uses a constant query string parameters and a label. + * This simply tests that labels and query string parameters are + * compatible. The fixed query string parameter named "hello" should + * in no way conflict with the label, `{hello}`. + */ + public constantQueryString( + args: ConstantQueryStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public constantQueryString( + args: ConstantQueryStringCommandInput, + cb: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): void; + public constantQueryString( + args: ConstantQueryStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): void; + public constantQueryString( + args: ConstantQueryStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantQueryStringCommandOutput) => void), + cb?: (err: any, data?: ConstantQueryStringCommandOutput) => void + ): Promise | void { + const command = new ConstantQueryStringCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + */ + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): void; + public emptyInputAndEmptyOutput( + args: EmptyInputAndEmptyOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), + cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void + ): Promise | void { + const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( + args: EndpointOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointOperation( + args: EndpointOperationCommandInput, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointOperationCommandOutput) => void + ): void; + public endpointOperation( + args: EndpointOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointOperationCommand(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 endpointWithHostLabelHeaderOperation( + args: EndpointWithHostLabelHeaderOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelHeaderOperation( + args: EndpointWithHostLabelHeaderOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void + ): void; + public endpointWithHostLabelHeaderOperation( + args: EndpointWithHostLabelHeaderOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void + ): void; + public endpointWithHostLabelHeaderOperation( + args: EndpointWithHostLabelHeaderOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelHeaderOperationCommand(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 endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): void; + public endpointWithHostLabelOperation( + args: EndpointWithHostLabelOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), + cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void + ): Promise | void { + const command = new EndpointWithHostLabelOperationCommand(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); + } + } + + /** + * Flattened maps + */ + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): void; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): void; + public flattenedXmlMap( + args: FlattenedXmlMapCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapCommand(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); + } + } + + /** + * Flattened maps with @xmlName + */ + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlName( + args: FlattenedXmlMapWithXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapWithXmlNameCommand(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); + } + } + + /** + * Flattened maps with @xmlNamespace and @xmlName + */ + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): void; + public flattenedXmlMapWithXmlNamespace( + args: FlattenedXmlMapWithXmlNamespaceCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void), + cb?: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void + ): Promise | void { + const command = new FlattenedXmlMapWithXmlNamespaceCommand(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 has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * + * Implementations must be able to successfully take a response and + * properly (de)serialize successful and error responses based on the + * the presence of the + */ + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): void; + public greetingWithErrors( + args: GreetingWithErrorsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), + cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void + ): Promise | void { + const command = new GreetingWithErrorsCommand(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 examples serializes a blob shape in the payload. + * + * In this example, no XML document is synthesized because the payload is + * not a structure or a union type. + */ + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): void; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): void; + public httpPayloadTraits( + args: HttpPayloadTraitsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadTraitsCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadTraitsCommand(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 examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + */ + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): void; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): void; + public httpPayloadTraitsWithMediaType( + args: HttpPayloadTraitsWithMediaTypeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadTraitsWithMediaTypeCommand(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 following example serializes a payload that uses an XML name + * on the member, changing the wrapper name. + */ + public httpPayloadWithMemberXmlName( + args: HttpPayloadWithMemberXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithMemberXmlName( + args: HttpPayloadWithMemberXmlNameCommandInput, + cb: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void + ): void; + public httpPayloadWithMemberXmlName( + args: HttpPayloadWithMemberXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void + ): void; + public httpPayloadWithMemberXmlName( + args: HttpPayloadWithMemberXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithMemberXmlNameCommand(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 examples serializes a structure in the payload. + * + * Note that serializing a structure changes the wrapper element name + * to match the targeted structure. + */ + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): void; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): void; + public httpPayloadWithStructure( + args: HttpPayloadWithStructureCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithStructureCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithStructureCommand(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 following example serializes a payload that uses an XML name, + * changing the wrapper name. + */ + public httpPayloadWithXmlName( + args: HttpPayloadWithXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithXmlName( + args: HttpPayloadWithXmlNameCommandInput, + cb: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void + ): void; + public httpPayloadWithXmlName( + args: HttpPayloadWithXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void + ): void; + public httpPayloadWithXmlName( + args: HttpPayloadWithXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithXmlNameCommand(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 following example serializes a payload that uses an XML namespace. + */ + public httpPayloadWithXmlNamespace( + args: HttpPayloadWithXmlNamespaceCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithXmlNamespace( + args: HttpPayloadWithXmlNamespaceCommandInput, + cb: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void + ): void; + public httpPayloadWithXmlNamespace( + args: HttpPayloadWithXmlNamespaceCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void + ): void; + public httpPayloadWithXmlNamespace( + args: HttpPayloadWithXmlNamespaceCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithXmlNamespaceCommand(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 following example serializes a payload that uses an XML namespace. + */ + public httpPayloadWithXmlNamespaceAndPrefix( + args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPayloadWithXmlNamespaceAndPrefix( + args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + cb: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void + ): void; + public httpPayloadWithXmlNamespaceAndPrefix( + args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void + ): void; + public httpPayloadWithXmlNamespaceAndPrefix( + args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void), + cb?: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void + ): Promise | void { + const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(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 examples adds headers to the input of a request and response by prefix. + */ + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): void; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): void; + public httpPrefixHeaders( + args: HttpPrefixHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersCommandOutput) => void), + cb?: (err: any, data?: HttpPrefixHeadersCommandOutput) => void + ): Promise | void { + const command = new HttpPrefixHeadersCommand(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 httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): void; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): void; + public httpRequestWithFloatLabels( + args: HttpRequestWithFloatLabelsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithFloatLabelsCommand(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 httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): void; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): void; + public httpRequestWithGreedyLabelInPath( + args: HttpRequestWithGreedyLabelInPathCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithGreedyLabelInPathCommand(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 example tests how requests are serialized when there's no input + * payload but there are HTTP labels. + */ + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): void; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): void; + public httpRequestWithLabels( + args: HttpRequestWithLabelsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithLabelsCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithLabelsCommand(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 example tests how requests serialize different timestamp formats in the + * URI path. + */ + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): void; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): void; + public httpRequestWithLabelsAndTimestampFormat( + args: HttpRequestWithLabelsAndTimestampFormatCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void), + cb?: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void + ): Promise | void { + const command = new HttpRequestWithLabelsAndTimestampFormatCommand(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 httpResponseCode( + args: HttpResponseCodeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + cb: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): void; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): void; + public httpResponseCode( + args: HttpResponseCodeCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpResponseCodeCommandOutput) => void), + cb?: (err: any, data?: HttpResponseCodeCommandOutput) => void + ): Promise | void { + const command = new HttpResponseCodeCommand(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 query string bound request parameters are + * serialized in the body of responses if the structure is used in both + * the request and response. + */ + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): void; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): void; + public ignoreQueryParamsInResponse( + args: IgnoreQueryParamsInResponseCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void), + cb?: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void + ): Promise | void { + const command = new IgnoreQueryParamsInResponseCommand(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 example tests how requests and responses are serialized when there is + * no input or output payload but there are HTTP header bindings. + */ + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): void; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): void; + public inputAndOutputWithHeaders( + args: InputAndOutputWithHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: InputAndOutputWithHeadersCommandOutput) => void), + cb?: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void + ): Promise | void { + const command = new InputAndOutputWithHeadersCommand(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 nestedXmlMaps( + args: NestedXmlMapsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nestedXmlMaps( + args: NestedXmlMapsCommandInput, + cb: (err: any, data?: NestedXmlMapsCommandOutput) => void + ): void; + public nestedXmlMaps( + args: NestedXmlMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NestedXmlMapsCommandOutput) => void + ): void; + public nestedXmlMaps( + args: NestedXmlMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedXmlMapsCommandOutput) => void), + cb?: (err: any, data?: NestedXmlMapsCommandOutput) => void + ): Promise | void { + const command = new NestedXmlMapsCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + */ + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): void; + public noInputAndNoOutput( + args: NoInputAndNoOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + */ + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): void; + public noInputAndOutput( + args: NoInputAndOutputCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), + cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void + ): Promise | void { + const command = new NoInputAndOutputCommand(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); + } + } + + /** + * Null and empty headers are not sent over the wire. + */ + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): void; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): void; + public nullAndEmptyHeadersClient( + args: NullAndEmptyHeadersClientCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void), + cb?: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void + ): Promise | void { + const command = new NullAndEmptyHeadersClientCommand(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); + } + } + + /** + * Null and empty headers are not sent over the wire. + */ + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): void; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): void; + public nullAndEmptyHeadersServer( + args: NullAndEmptyHeadersServerCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void), + cb?: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void + ): Promise | void { + const command = new NullAndEmptyHeadersServerCommand(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); + } + } + + /** + * Omits null, but serializes empty string value. + */ + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): void; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): void; + public omitsNullSerializesEmptyString( + args: OmitsNullSerializesEmptyStringCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void), + cb?: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void + ): Promise | void { + const command = new OmitsNullSerializesEmptyStringCommand(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); + } + } + + /** + * Automatically adds idempotency tokens. + */ + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): void; + public queryIdempotencyTokenAutoFill( + args: QueryIdempotencyTokenAutoFillCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), + cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void + ): Promise | void { + const command = new QueryIdempotencyTokenAutoFillCommand(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 queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): void; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): void; + public queryParamsAsStringListMap( + args: QueryParamsAsStringListMapCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryParamsAsStringListMapCommandOutput) => void), + cb?: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void + ): Promise | void { + const command = new QueryParamsAsStringListMapCommand(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 queryPrecedence( + args: QueryPrecedenceCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + cb: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): void; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): void; + public queryPrecedence( + args: QueryPrecedenceCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryPrecedenceCommandOutput) => void), + cb?: (err: any, data?: QueryPrecedenceCommandOutput) => void + ): Promise | void { + const command = new QueryPrecedenceCommand(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); + } + } + + /** + * Recursive shapes + */ + public recursiveShapes( + args: RecursiveShapesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public recursiveShapes( + args: RecursiveShapesCommandInput, + cb: (err: any, data?: RecursiveShapesCommandOutput) => void + ): void; + public recursiveShapes( + args: RecursiveShapesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: RecursiveShapesCommandOutput) => void + ): void; + public recursiveShapes( + args: RecursiveShapesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveShapesCommandOutput) => void), + cb?: (err: any, data?: RecursiveShapesCommandOutput) => void + ): Promise | void { + const command = new RecursiveShapesCommand(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 simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): void; + public simpleScalarProperties( + args: SimpleScalarPropertiesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), + cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void + ): Promise | void { + const command = new SimpleScalarPropertiesCommand(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 example tests how timestamp request and response headers are serialized. + */ + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): void; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): void; + public timestampFormatHeaders( + args: TimestampFormatHeadersCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TimestampFormatHeadersCommandOutput) => void), + cb?: (err: any, data?: TimestampFormatHeadersCommandOutput) => void + ): Promise | void { + const command = new TimestampFormatHeadersCommand(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 an XML attributes on synthesized document. + */ + public xmlAttributes( + args: XmlAttributesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlAttributes( + args: XmlAttributesCommandInput, + cb: (err: any, data?: XmlAttributesCommandOutput) => void + ): void; + public xmlAttributes( + args: XmlAttributesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlAttributesCommandOutput) => void + ): void; + public xmlAttributes( + args: XmlAttributesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlAttributesCommandOutput) => void), + cb?: (err: any, data?: XmlAttributesCommandOutput) => void + ): Promise | void { + const command = new XmlAttributesCommand(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 an XML attributes on a document targeted by httpPayload. + */ + public xmlAttributesOnPayload( + args: XmlAttributesOnPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlAttributesOnPayload( + args: XmlAttributesOnPayloadCommandInput, + cb: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void + ): void; + public xmlAttributesOnPayload( + args: XmlAttributesOnPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void + ): void; + public xmlAttributesOnPayload( + args: XmlAttributesOnPayloadCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlAttributesOnPayloadCommandOutput) => void), + cb?: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void + ): Promise | void { + const command = new XmlAttributesOnPayloadCommand(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); + } + } + + /** + * Blobs are base64 encoded + */ + public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlBlobsCommandOutput) => void + ): void; + public xmlBlobs( + args: XmlBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlBlobsCommand(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); + } + } + + /** + * Blobs are base64 encoded + */ + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): void; + public xmlEmptyBlobs( + args: XmlEmptyBlobsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyBlobsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): void; + public xmlEmptyLists( + args: XmlEmptyListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyListsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyMaps(args: XmlEmptyMapsCommandInput, cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void): void; + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void + ): void; + public xmlEmptyMaps( + args: XmlEmptyMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyMapsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyMapsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyMapsCommand(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 xmlEmptyStrings( + args: XmlEmptyStringsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlEmptyStrings( + args: XmlEmptyStringsCommandInput, + cb: (err: any, data?: XmlEmptyStringsCommandOutput) => void + ): void; + public xmlEmptyStrings( + args: XmlEmptyStringsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEmptyStringsCommandOutput) => void + ): void; + public xmlEmptyStrings( + args: XmlEmptyStringsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyStringsCommandOutput) => void), + cb?: (err: any, data?: XmlEmptyStringsCommandOutput) => void + ): Promise | void { + const command = new XmlEmptyStringsCommand(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. + */ + public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; + public xmlEnums( + args: XmlEnumsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlEnumsCommandOutput) => void + ): void; + public xmlEnums( + args: XmlEnumsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), + cb?: (err: any, data?: XmlEnumsCommandOutput) => void + ): Promise | void { + const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Flattened XML lists with @xmlNamespace. + * 8. Lists of structures. + * 9. Flattened XML list of structures + */ + public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; + public xmlLists( + args: XmlListsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlListsCommandOutput) => void + ): void; + public xmlLists( + args: XmlListsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), + cb?: (err: any, data?: XmlListsCommandOutput) => void + ): Promise | void { + const command = new XmlListsCommand(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 example tests basic map serialization. + */ + public xmlMaps(args: XmlMapsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlMaps(args: XmlMapsCommandInput, cb: (err: any, data?: XmlMapsCommandOutput) => void): void; + public xmlMaps( + args: XmlMapsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlMapsCommandOutput) => void + ): void; + public xmlMaps( + args: XmlMapsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsCommandOutput) => void), + cb?: (err: any, data?: XmlMapsCommandOutput) => void + ): Promise | void { + const command = new XmlMapsCommand(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 xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): void; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): void; + public xmlMapsXmlName( + args: XmlMapsXmlNameCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsXmlNameCommandOutput) => void), + cb?: (err: any, data?: XmlMapsXmlNameCommandOutput) => void + ): Promise | void { + const command = new XmlMapsXmlNameCommand(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 xmlNamespaces( + args: XmlNamespacesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlNamespacesCommandOutput) => void + ): void; + public xmlNamespaces( + args: XmlNamespacesCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), + cb?: (err: any, data?: XmlNamespacesCommandOutput) => void + ): Promise | void { + const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + */ + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlTimestampsCommandOutput) => void + ): void; + public xmlTimestamps( + args: XmlTimestampsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), + cb?: (err: any, data?: XmlTimestampsCommandOutput) => void + ): Promise | void { + const command = new XmlTimestampsCommand(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 xmlUnions(args: XmlUnionsCommandInput, options?: __HttpHandlerOptions): Promise; + public xmlUnions(args: XmlUnionsCommandInput, cb: (err: any, data?: XmlUnionsCommandOutput) => void): void; + public xmlUnions( + args: XmlUnionsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: XmlUnionsCommandOutput) => void + ): void; + public xmlUnions( + args: XmlUnionsCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlUnionsCommandOutput) => void), + cb?: (err: any, data?: XmlUnionsCommandOutput) => void + ): Promise | void { + const command = new XmlUnionsCommand(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); + } + } +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts new file mode 100644 index 000000000000..55afbed456ac --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts @@ -0,0 +1,457 @@ +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + getHostHeaderPlugin, + HostHeaderInputConfig, + HostHeaderResolvedConfig, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; +import { + getUserAgentPlugin, + resolveUserAgentConfig, + UserAgentInputConfig, + UserAgentResolvedConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + Provider, + RegionInfoProvider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +import { + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "./commands/AllQueryStringTypesCommand"; +import { BodyWithXmlNameCommandInput, BodyWithXmlNameCommandOutput } from "./commands/BodyWithXmlNameCommand"; +import { + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "./commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "./commands/ConstantQueryStringCommand"; +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "./commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelHeaderOperationCommandInput, + EndpointWithHostLabelHeaderOperationCommandOutput, +} from "./commands/EndpointWithHostLabelHeaderOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "./commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "./commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; +import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "./commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithMemberXmlNameCommandInput, + HttpPayloadWithMemberXmlNameCommandOutput, +} from "./commands/HttpPayloadWithMemberXmlNameCommand"; +import { + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "./commands/HttpPayloadWithStructureCommand"; +import { + HttpPayloadWithXmlNameCommandInput, + HttpPayloadWithXmlNameCommandOutput, +} from "./commands/HttpPayloadWithXmlNameCommand"; +import { + HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, +} from "./commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; +import { + HttpPayloadWithXmlNamespaceCommandInput, + HttpPayloadWithXmlNamespaceCommandOutput, +} from "./commands/HttpPayloadWithXmlNamespaceCommand"; +import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "./commands/HttpPrefixHeadersCommand"; +import { + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "./commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "./commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "./commands/HttpResponseCodeCommand"; +import { + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "./commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "./commands/InputAndOutputWithHeadersCommand"; +import { NestedXmlMapsCommandInput, NestedXmlMapsCommandOutput } from "./commands/NestedXmlMapsCommand"; +import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; +import { + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "./commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "./commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "./commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "./commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "./commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "./commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "./commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "./commands/SimpleScalarPropertiesCommand"; +import { + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "./commands/TimestampFormatHeadersCommand"; +import { XmlAttributesCommandInput, XmlAttributesCommandOutput } from "./commands/XmlAttributesCommand"; +import { + XmlAttributesOnPayloadCommandInput, + XmlAttributesOnPayloadCommandOutput, +} from "./commands/XmlAttributesOnPayloadCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "./commands/XmlEmptyMapsCommand"; +import { XmlEmptyStringsCommandInput, XmlEmptyStringsCommandOutput } from "./commands/XmlEmptyStringsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; +import { XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; +import { XmlUnionsCommandInput, XmlUnionsCommandOutput } from "./commands/XmlUnionsCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; + +export type ServiceInputTypes = + | AllQueryStringTypesCommandInput + | BodyWithXmlNameCommandInput + | ConstantAndVariableQueryStringCommandInput + | ConstantQueryStringCommandInput + | EmptyInputAndEmptyOutputCommandInput + | EndpointOperationCommandInput + | EndpointWithHostLabelHeaderOperationCommandInput + | EndpointWithHostLabelOperationCommandInput + | FlattenedXmlMapCommandInput + | FlattenedXmlMapWithXmlNameCommandInput + | FlattenedXmlMapWithXmlNamespaceCommandInput + | GreetingWithErrorsCommandInput + | HttpPayloadTraitsCommandInput + | HttpPayloadTraitsWithMediaTypeCommandInput + | HttpPayloadWithMemberXmlNameCommandInput + | HttpPayloadWithStructureCommandInput + | HttpPayloadWithXmlNameCommandInput + | HttpPayloadWithXmlNamespaceAndPrefixCommandInput + | HttpPayloadWithXmlNamespaceCommandInput + | HttpPrefixHeadersCommandInput + | HttpRequestWithFloatLabelsCommandInput + | HttpRequestWithGreedyLabelInPathCommandInput + | HttpRequestWithLabelsAndTimestampFormatCommandInput + | HttpRequestWithLabelsCommandInput + | HttpResponseCodeCommandInput + | IgnoreQueryParamsInResponseCommandInput + | InputAndOutputWithHeadersCommandInput + | NestedXmlMapsCommandInput + | NoInputAndNoOutputCommandInput + | NoInputAndOutputCommandInput + | NullAndEmptyHeadersClientCommandInput + | NullAndEmptyHeadersServerCommandInput + | OmitsNullSerializesEmptyStringCommandInput + | QueryIdempotencyTokenAutoFillCommandInput + | QueryParamsAsStringListMapCommandInput + | QueryPrecedenceCommandInput + | RecursiveShapesCommandInput + | SimpleScalarPropertiesCommandInput + | TimestampFormatHeadersCommandInput + | XmlAttributesCommandInput + | XmlAttributesOnPayloadCommandInput + | XmlBlobsCommandInput + | XmlEmptyBlobsCommandInput + | XmlEmptyListsCommandInput + | XmlEmptyMapsCommandInput + | XmlEmptyStringsCommandInput + | XmlEnumsCommandInput + | XmlListsCommandInput + | XmlMapsCommandInput + | XmlMapsXmlNameCommandInput + | XmlNamespacesCommandInput + | XmlTimestampsCommandInput + | XmlUnionsCommandInput; + +export type ServiceOutputTypes = + | AllQueryStringTypesCommandOutput + | BodyWithXmlNameCommandOutput + | ConstantAndVariableQueryStringCommandOutput + | ConstantQueryStringCommandOutput + | EmptyInputAndEmptyOutputCommandOutput + | EndpointOperationCommandOutput + | EndpointWithHostLabelHeaderOperationCommandOutput + | EndpointWithHostLabelOperationCommandOutput + | FlattenedXmlMapCommandOutput + | FlattenedXmlMapWithXmlNameCommandOutput + | FlattenedXmlMapWithXmlNamespaceCommandOutput + | GreetingWithErrorsCommandOutput + | HttpPayloadTraitsCommandOutput + | HttpPayloadTraitsWithMediaTypeCommandOutput + | HttpPayloadWithMemberXmlNameCommandOutput + | HttpPayloadWithStructureCommandOutput + | HttpPayloadWithXmlNameCommandOutput + | HttpPayloadWithXmlNamespaceAndPrefixCommandOutput + | HttpPayloadWithXmlNamespaceCommandOutput + | HttpPrefixHeadersCommandOutput + | HttpRequestWithFloatLabelsCommandOutput + | HttpRequestWithGreedyLabelInPathCommandOutput + | HttpRequestWithLabelsAndTimestampFormatCommandOutput + | HttpRequestWithLabelsCommandOutput + | HttpResponseCodeCommandOutput + | IgnoreQueryParamsInResponseCommandOutput + | InputAndOutputWithHeadersCommandOutput + | NestedXmlMapsCommandOutput + | NoInputAndNoOutputCommandOutput + | NoInputAndOutputCommandOutput + | NullAndEmptyHeadersClientCommandOutput + | NullAndEmptyHeadersServerCommandOutput + | OmitsNullSerializesEmptyStringCommandOutput + | QueryIdempotencyTokenAutoFillCommandOutput + | QueryParamsAsStringListMapCommandOutput + | QueryPrecedenceCommandOutput + | RecursiveShapesCommandOutput + | SimpleScalarPropertiesCommandOutput + | TimestampFormatHeadersCommandOutput + | XmlAttributesCommandOutput + | XmlAttributesOnPayloadCommandOutput + | XmlBlobsCommandOutput + | XmlEmptyBlobsCommandOutput + | XmlEmptyListsCommandOutput + | XmlEmptyMapsCommandOutput + | XmlEmptyStringsCommandOutput + | XmlEnumsCommandOutput + | XmlListsCommandOutput + | XmlMapsCommandOutput + | XmlMapsXmlNameCommandOutput + | XmlNamespacesCommandOutput + | XmlTimestampsCommandOutput + | XmlUnionsCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * Unique service identifier. + * @internal + */ + serviceId?: string; + + /** + * Fetch related hostname, signing name or signing region with given region. + * @internal + */ + regionInfoProvider?: RegionInfoProvider; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type RestXmlProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of RestXmlProtocolClient class constructor that set the region, credentials and other options. + */ +export interface RestXmlProtocolClientConfig extends RestXmlProtocolClientConfigType {} + +type RestXmlProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of RestXmlProtocolClient class. This is resolved and normalized from the {@link RestXmlProtocolClientConfig | constructor configuration interface}. + */ +export interface RestXmlProtocolClientResolvedConfig extends RestXmlProtocolClientResolvedConfigType {} + +/** + * A REST XML service that sends XML requests and responses. + */ +export class RestXmlProtocolClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + RestXmlProtocolClientResolvedConfig +> { + /** + * The resolved configuration of RestXmlProtocolClient class. This is resolved and normalized from the {@link RestXmlProtocolClientConfig | constructor configuration interface}. + */ + readonly config: RestXmlProtocolClientResolvedConfig; + + constructor(configuration: RestXmlProtocolClientConfig) { + const _config_0 = __getRuntimeConfig(configuration); + const _config_1 = resolveRegionConfig(_config_0); + const _config_2 = resolveEndpointsConfig(_config_1); + const _config_3 = resolveRetryConfig(_config_2); + const _config_4 = resolveHostHeaderConfig(_config_3); + const _config_5 = resolveUserAgentConfig(_config_4); + super(_config_5); + this.config = _config_5; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts new file mode 100644 index 000000000000..6d6548e25bcc --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts @@ -0,0 +1,95 @@ +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 { AllQueryStringTypesInput } from "../models/models_0"; +import { + deserializeAws_restXmlAllQueryStringTypesCommand, + serializeAws_restXmlAllQueryStringTypesCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface AllQueryStringTypesCommandInput extends AllQueryStringTypesInput {} +export interface AllQueryStringTypesCommandOutput extends __MetadataBearer {} + +/** + * This example uses all query string types. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new AllQueryStringTypesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link AllQueryStringTypesCommandInput} for command's `input` shape. + * @see {@link AllQueryStringTypesCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class AllQueryStringTypesCommand extends $Command< + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: AllQueryStringTypesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "AllQueryStringTypesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: AllQueryStringTypesInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: AllQueryStringTypesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlAllQueryStringTypesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlAllQueryStringTypesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts new file mode 100644 index 000000000000..9facc20d3947 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts @@ -0,0 +1,96 @@ +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 { BodyWithXmlNameInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlBodyWithXmlNameCommand, + serializeAws_restXmlBodyWithXmlNameCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface BodyWithXmlNameCommandInput extends BodyWithXmlNameInputOutput {} +export interface BodyWithXmlNameCommandOutput extends BodyWithXmlNameInputOutput, __MetadataBearer {} + +/** + * The following example serializes a body that uses an XML name, + * changing the wrapper name. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, BodyWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, BodyWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new BodyWithXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link BodyWithXmlNameCommandInput} for command's `input` shape. + * @see {@link BodyWithXmlNameCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class BodyWithXmlNameCommand extends $Command< + BodyWithXmlNameCommandInput, + BodyWithXmlNameCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: BodyWithXmlNameCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "BodyWithXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: BodyWithXmlNameInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: BodyWithXmlNameInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: BodyWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlBodyWithXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlBodyWithXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts new file mode 100644 index 000000000000..df327c821d6d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts @@ -0,0 +1,103 @@ +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 { ConstantAndVariableQueryStringInput } from "../models/models_0"; +import { + deserializeAws_restXmlConstantAndVariableQueryStringCommand, + serializeAws_restXmlConstantAndVariableQueryStringCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface ConstantAndVariableQueryStringCommandInput extends ConstantAndVariableQueryStringInput {} +export interface ConstantAndVariableQueryStringCommandOutput extends __MetadataBearer {} + +/** + * This example uses fixed query string params and variable query string params. + * The fixed query string parameters and variable parameters must both be + * serialized (implementations may need to merge them together). + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, ConstantAndVariableQueryStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, ConstantAndVariableQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new ConstantAndVariableQueryStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link ConstantAndVariableQueryStringCommandInput} for command's `input` shape. + * @see {@link ConstantAndVariableQueryStringCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class ConstantAndVariableQueryStringCommand extends $Command< + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ConstantAndVariableQueryStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "ConstantAndVariableQueryStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: ConstantAndVariableQueryStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: ConstantAndVariableQueryStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlConstantAndVariableQueryStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlConstantAndVariableQueryStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts new file mode 100644 index 000000000000..a2e595abb7f3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts @@ -0,0 +1,98 @@ +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 { ConstantQueryStringInput } from "../models/models_0"; +import { + deserializeAws_restXmlConstantQueryStringCommand, + serializeAws_restXmlConstantQueryStringCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface ConstantQueryStringCommandInput extends ConstantQueryStringInput {} +export interface ConstantQueryStringCommandOutput extends __MetadataBearer {} + +/** + * This example uses a constant query string parameters and a label. + * This simply tests that labels and query string parameters are + * compatible. The fixed query string parameter named "hello" should + * in no way conflict with the label, `{hello}`. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, ConstantQueryStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, ConstantQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new ConstantQueryStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link ConstantQueryStringCommandInput} for command's `input` shape. + * @see {@link ConstantQueryStringCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class ConstantQueryStringCommand extends $Command< + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ConstantQueryStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "ConstantQueryStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: ConstantQueryStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: ConstantQueryStringCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlConstantQueryStringCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlConstantQueryStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts new file mode 100644 index 000000000000..a88f31af42b9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts @@ -0,0 +1,98 @@ +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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlEmptyInputAndEmptyOutputCommand, + serializeAws_restXmlEmptyInputAndEmptyOutputCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} +export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has an empty input + * and empty output structure that reuses the same shape. While this should + * be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new EmptyInputAndEmptyOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. + * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class EmptyInputAndEmptyOutputCommand extends $Command< + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "EmptyInputAndEmptyOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, + outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlEmptyInputAndEmptyOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlEmptyInputAndEmptyOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts new file mode 100644 index 000000000000..2baa16171c0c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.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_restXmlEndpointOperationCommand, + serializeAws_restXmlEndpointOperationCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface EndpointOperationCommandInput {} +export interface EndpointOperationCommandOutput extends __MetadataBearer {} + +export class EndpointOperationCommand extends $Command< + EndpointOperationCommandInput, + EndpointOperationCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "EndpointOperationCommand"; + 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlEndpointOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlEndpointOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts new file mode 100644 index 000000000000..f904462ebbaa --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.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 { HostLabelHeaderInput } from "../models/models_0"; +import { + deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand, + serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface EndpointWithHostLabelHeaderOperationCommandInput extends HostLabelHeaderInput {} +export interface EndpointWithHostLabelHeaderOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelHeaderOperationCommand extends $Command< + EndpointWithHostLabelHeaderOperationCommandInput, + EndpointWithHostLabelHeaderOperationCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelHeaderOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "EndpointWithHostLabelHeaderOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelHeaderInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelHeaderOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts new file mode 100644 index 000000000000..33486b179d2b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.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 { HostLabelInput } from "../models/models_0"; +import { + deserializeAws_restXmlEndpointWithHostLabelOperationCommand, + serializeAws_restXmlEndpointWithHostLabelOperationCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} +export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} + +export class EndpointWithHostLabelOperationCommand extends $Command< + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "EndpointWithHostLabelOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlEndpointWithHostLabelOperationCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlEndpointWithHostLabelOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts new file mode 100644 index 000000000000..00dd893f39f4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts @@ -0,0 +1,95 @@ +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 { FlattenedXmlMapInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlFlattenedXmlMapCommand, + serializeAws_restXmlFlattenedXmlMapCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface FlattenedXmlMapCommandInput extends FlattenedXmlMapInputOutput {} +export interface FlattenedXmlMapCommandOutput extends FlattenedXmlMapInputOutput, __MetadataBearer {} + +/** + * Flattened maps + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, FlattenedXmlMapCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, FlattenedXmlMapCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new FlattenedXmlMapCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapCommand extends $Command< + FlattenedXmlMapCommandInput, + FlattenedXmlMapCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "FlattenedXmlMapCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: FlattenedXmlMapInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: FlattenedXmlMapInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: FlattenedXmlMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlFlattenedXmlMapCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlFlattenedXmlMapCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts new file mode 100644 index 000000000000..7b6994a162f4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts @@ -0,0 +1,100 @@ +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 { FlattenedXmlMapWithXmlNameInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommand, + serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface FlattenedXmlMapWithXmlNameCommandInput extends FlattenedXmlMapWithXmlNameInputOutput {} +export interface FlattenedXmlMapWithXmlNameCommandOutput + extends FlattenedXmlMapWithXmlNameInputOutput, + __MetadataBearer {} + +/** + * Flattened maps with @xmlName + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, FlattenedXmlMapWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, FlattenedXmlMapWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new FlattenedXmlMapWithXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapWithXmlNameCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapWithXmlNameCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapWithXmlNameCommand extends $Command< + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapWithXmlNameCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "FlattenedXmlMapWithXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: FlattenedXmlMapWithXmlNameInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: FlattenedXmlMapWithXmlNameInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: FlattenedXmlMapWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts new file mode 100644 index 000000000000..01e5c7391648 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts @@ -0,0 +1,103 @@ +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 { FlattenedXmlMapWithXmlNamespaceOutput } from "../models/models_0"; +import { + deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand, + serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface FlattenedXmlMapWithXmlNamespaceCommandInput {} +export interface FlattenedXmlMapWithXmlNamespaceCommandOutput + extends FlattenedXmlMapWithXmlNamespaceOutput, + __MetadataBearer {} + +/** + * Flattened maps with @xmlNamespace and @xmlName + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new FlattenedXmlMapWithXmlNamespaceCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link FlattenedXmlMapWithXmlNamespaceCommandInput} for command's `input` shape. + * @see {@link FlattenedXmlMapWithXmlNamespaceCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class FlattenedXmlMapWithXmlNamespaceCommand extends $Command< + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: FlattenedXmlMapWithXmlNamespaceCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "FlattenedXmlMapWithXmlNamespaceCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: FlattenedXmlMapWithXmlNamespaceOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: FlattenedXmlMapWithXmlNamespaceCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts new file mode 100644 index 000000000000..993fb98921a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts @@ -0,0 +1,103 @@ +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 { GreetingWithErrorsOutput } from "../models/models_0"; +import { + deserializeAws_restXmlGreetingWithErrorsCommand, + serializeAws_restXmlGreetingWithErrorsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface GreetingWithErrorsCommandInput {} +export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} + +/** + * This operation has three possible return values: + * + * 1. A successful response in the form of GreetingWithErrorsOutput + * 2. An InvalidGreeting error. + * 3. A BadRequest error. + * + * Implementations must be able to successfully take a response and + * properly (de)serialize successful and error responses based on the + * the presence of the + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new GreetingWithErrorsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. + * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class GreetingWithErrorsCommand extends $Command< + GreetingWithErrorsCommandInput, + GreetingWithErrorsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GreetingWithErrorsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "GreetingWithErrorsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlGreetingWithErrorsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlGreetingWithErrorsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts new file mode 100644 index 000000000000..fc2e3f0af9d1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts @@ -0,0 +1,98 @@ +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 { HttpPayloadTraitsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadTraitsCommand, + serializeAws_restXmlHttpPayloadTraitsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadTraitsCommandInput extends HttpPayloadTraitsInputOutput {} +export interface HttpPayloadTraitsCommandOutput extends HttpPayloadTraitsInputOutput, __MetadataBearer {} + +/** + * This examples serializes a blob shape in the payload. + * + * In this example, no XML document is synthesized because the payload is + * not a structure or a union type. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadTraitsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadTraitsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadTraitsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadTraitsCommandInput} for command's `input` shape. + * @see {@link HttpPayloadTraitsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadTraitsCommand extends $Command< + HttpPayloadTraitsCommandInput, + HttpPayloadTraitsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadTraitsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadTraitsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadTraitsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpPayloadTraitsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts new file mode 100644 index 000000000000..65c7cc0e266d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts @@ -0,0 +1,104 @@ +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 { HttpPayloadTraitsWithMediaTypeInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand, + serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadTraitsWithMediaTypeCommandInput extends HttpPayloadTraitsWithMediaTypeInputOutput {} +export interface HttpPayloadTraitsWithMediaTypeCommandOutput + extends HttpPayloadTraitsWithMediaTypeInputOutput, + __MetadataBearer {} + +/** + * This examples uses a `@mediaType` trait on the payload to force a custom + * content-type to be serialized. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadTraitsWithMediaTypeCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadTraitsWithMediaTypeCommandInput} for command's `input` shape. + * @see {@link HttpPayloadTraitsWithMediaTypeCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadTraitsWithMediaTypeCommand extends $Command< + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadTraitsWithMediaTypeCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadTraitsWithMediaTypeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpPayloadTraitsWithMediaTypeCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts new file mode 100644 index 000000000000..3051395808a1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts @@ -0,0 +1,101 @@ +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 { HttpPayloadWithMemberXmlNameInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommand, + serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadWithMemberXmlNameCommandInput extends HttpPayloadWithMemberXmlNameInputOutput {} +export interface HttpPayloadWithMemberXmlNameCommandOutput + extends HttpPayloadWithMemberXmlNameInputOutput, + __MetadataBearer {} + +/** + * The following example serializes a payload that uses an XML name + * on the member, changing the wrapper name. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadWithMemberXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadWithMemberXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadWithMemberXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithMemberXmlNameCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithMemberXmlNameCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithMemberXmlNameCommand extends $Command< + HttpPayloadWithMemberXmlNameCommandInput, + HttpPayloadWithMemberXmlNameCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithMemberXmlNameCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadWithMemberXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithMemberXmlNameInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithMemberXmlNameInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadWithMemberXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts new file mode 100644 index 000000000000..cde30ef08c96 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts @@ -0,0 +1,98 @@ +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 { HttpPayloadWithStructureInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadWithStructureCommand, + serializeAws_restXmlHttpPayloadWithStructureCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadWithStructureCommandInput extends HttpPayloadWithStructureInputOutput {} +export interface HttpPayloadWithStructureCommandOutput extends HttpPayloadWithStructureInputOutput, __MetadataBearer {} + +/** + * This examples serializes a structure in the payload. + * + * Note that serializing a structure changes the wrapper element name + * to match the targeted structure. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadWithStructureCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadWithStructureCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadWithStructureCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithStructureCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithStructureCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithStructureCommand extends $Command< + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithStructureCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadWithStructureCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadWithStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadWithStructureCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpPayloadWithStructureCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts new file mode 100644 index 000000000000..e8dc0dacf60d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts @@ -0,0 +1,96 @@ +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 { HttpPayloadWithXmlNameInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadWithXmlNameCommand, + serializeAws_restXmlHttpPayloadWithXmlNameCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadWithXmlNameCommandInput extends HttpPayloadWithXmlNameInputOutput {} +export interface HttpPayloadWithXmlNameCommandOutput extends HttpPayloadWithXmlNameInputOutput, __MetadataBearer {} + +/** + * The following example serializes a payload that uses an XML name, + * changing the wrapper name. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadWithXmlNameCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithXmlNameCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithXmlNameCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithXmlNameCommand extends $Command< + HttpPayloadWithXmlNameCommandInput, + HttpPayloadWithXmlNameCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithXmlNameCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadWithXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithXmlNameInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithXmlNameInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadWithXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpPayloadWithXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts new file mode 100644 index 000000000000..c8e1443416c2 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts @@ -0,0 +1,104 @@ +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 { HttpPayloadWithXmlNamespaceAndPrefixInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand, + serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadWithXmlNamespaceAndPrefixCommandInput + extends HttpPayloadWithXmlNamespaceAndPrefixInputOutput {} +export interface HttpPayloadWithXmlNamespaceAndPrefixCommandOutput + extends HttpPayloadWithXmlNamespaceAndPrefixInputOutput, + __MetadataBearer {} + +/** + * The following example serializes a payload that uses an XML namespace. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceAndPrefixCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceAndPrefixCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithXmlNamespaceAndPrefixCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithXmlNamespaceAndPrefixCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithXmlNamespaceAndPrefixCommand extends $Command< + HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadWithXmlNamespaceAndPrefixCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithXmlNamespaceAndPrefixInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithXmlNamespaceAndPrefixInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts new file mode 100644 index 000000000000..03b5cd41022b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts @@ -0,0 +1,100 @@ +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 { HttpPayloadWithXmlNamespaceInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommand, + serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPayloadWithXmlNamespaceCommandInput extends HttpPayloadWithXmlNamespaceInputOutput {} +export interface HttpPayloadWithXmlNamespaceCommandOutput + extends HttpPayloadWithXmlNamespaceInputOutput, + __MetadataBearer {} + +/** + * The following example serializes a payload that uses an XML namespace. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPayloadWithXmlNamespaceCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPayloadWithXmlNamespaceCommandInput} for command's `input` shape. + * @see {@link HttpPayloadWithXmlNamespaceCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPayloadWithXmlNamespaceCommand extends $Command< + HttpPayloadWithXmlNamespaceCommandInput, + HttpPayloadWithXmlNamespaceCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPayloadWithXmlNamespaceCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPayloadWithXmlNamespaceCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPayloadWithXmlNamespaceInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPayloadWithXmlNamespaceInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPayloadWithXmlNamespaceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts new file mode 100644 index 000000000000..8ffc3656f1bb --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts @@ -0,0 +1,95 @@ +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 { HttpPrefixHeadersInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpPrefixHeadersCommand, + serializeAws_restXmlHttpPrefixHeadersCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpPrefixHeadersCommandInput extends HttpPrefixHeadersInputOutput {} +export interface HttpPrefixHeadersCommandOutput extends HttpPrefixHeadersInputOutput, __MetadataBearer {} + +/** + * This examples adds headers to the input of a request and response by prefix. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpPrefixHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpPrefixHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpPrefixHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpPrefixHeadersCommandInput} for command's `input` shape. + * @see {@link HttpPrefixHeadersCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpPrefixHeadersCommand extends $Command< + HttpPrefixHeadersCommandInput, + HttpPrefixHeadersCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpPrefixHeadersCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpPrefixHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpPrefixHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpPrefixHeadersCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpPrefixHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts new file mode 100644 index 000000000000..8678037cc69d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.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 { HttpRequestWithFloatLabelsInput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpRequestWithFloatLabelsCommand, + serializeAws_restXmlHttpRequestWithFloatLabelsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpRequestWithFloatLabelsCommandInput extends HttpRequestWithFloatLabelsInput {} +export interface HttpRequestWithFloatLabelsCommandOutput extends __MetadataBearer {} + +export class HttpRequestWithFloatLabelsCommand extends $Command< + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithFloatLabelsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpRequestWithFloatLabelsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithFloatLabelsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpRequestWithFloatLabelsCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpRequestWithFloatLabelsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts new file mode 100644 index 000000000000..bdd7138bcc5b --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.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 { HttpRequestWithGreedyLabelInPathInput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand, + serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpRequestWithGreedyLabelInPathCommandInput extends HttpRequestWithGreedyLabelInPathInput {} +export interface HttpRequestWithGreedyLabelInPathCommandOutput extends __MetadataBearer {} + +export class HttpRequestWithGreedyLabelInPathCommand extends $Command< + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithGreedyLabelInPathCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpRequestWithGreedyLabelInPathCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithGreedyLabelInPathInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpRequestWithGreedyLabelInPathCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts new file mode 100644 index 000000000000..1aabf293effb --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts @@ -0,0 +1,106 @@ +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 { HttpRequestWithLabelsAndTimestampFormatInput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand, + serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpRequestWithLabelsAndTimestampFormatCommandInput + extends HttpRequestWithLabelsAndTimestampFormatInput {} +export interface HttpRequestWithLabelsAndTimestampFormatCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests serialize different timestamp formats in the + * URI path. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpRequestWithLabelsAndTimestampFormatCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandInput} for command's `input` shape. + * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpRequestWithLabelsAndTimestampFormatCommand extends $Command< + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithLabelsAndTimestampFormatCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler< + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput + > { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpRequestWithLabelsAndTimestampFormatCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithLabelsAndTimestampFormatInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: HttpRequestWithLabelsAndTimestampFormatCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts new file mode 100644 index 000000000000..df4ae928ca33 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts @@ -0,0 +1,96 @@ +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 { HttpRequestWithLabelsInput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpRequestWithLabelsCommand, + serializeAws_restXmlHttpRequestWithLabelsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpRequestWithLabelsCommandInput extends HttpRequestWithLabelsInput {} +export interface HttpRequestWithLabelsCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests are serialized when there's no input + * payload but there are HTTP labels. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, HttpRequestWithLabelsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, HttpRequestWithLabelsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new HttpRequestWithLabelsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link HttpRequestWithLabelsCommandInput} for command's `input` shape. + * @see {@link HttpRequestWithLabelsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class HttpRequestWithLabelsCommand extends $Command< + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpRequestWithLabelsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpRequestWithLabelsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: HttpRequestWithLabelsInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpRequestWithLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpRequestWithLabelsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpRequestWithLabelsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts new file mode 100644 index 000000000000..27d3c5274503 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.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 { HttpResponseCodeOutput } from "../models/models_0"; +import { + deserializeAws_restXmlHttpResponseCodeCommand, + serializeAws_restXmlHttpResponseCodeCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface HttpResponseCodeCommandInput {} +export interface HttpResponseCodeCommandOutput extends HttpResponseCodeOutput, __MetadataBearer {} + +export class HttpResponseCodeCommand extends $Command< + HttpResponseCodeCommandInput, + HttpResponseCodeCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HttpResponseCodeCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "HttpResponseCodeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: HttpResponseCodeOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HttpResponseCodeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlHttpResponseCodeCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlHttpResponseCodeCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts new file mode 100644 index 000000000000..9cec947751e1 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts @@ -0,0 +1,100 @@ +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 { IgnoreQueryParamsInResponseOutput } from "../models/models_0"; +import { + deserializeAws_restXmlIgnoreQueryParamsInResponseCommand, + serializeAws_restXmlIgnoreQueryParamsInResponseCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface IgnoreQueryParamsInResponseCommandInput {} +export interface IgnoreQueryParamsInResponseCommandOutput extends IgnoreQueryParamsInResponseOutput, __MetadataBearer {} + +/** + * This example ensures that query string bound request parameters are + * serialized in the body of responses if the structure is used in both + * the request and response. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, IgnoreQueryParamsInResponseCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, IgnoreQueryParamsInResponseCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new IgnoreQueryParamsInResponseCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link IgnoreQueryParamsInResponseCommandInput} for command's `input` shape. + * @see {@link IgnoreQueryParamsInResponseCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class IgnoreQueryParamsInResponseCommand extends $Command< + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: IgnoreQueryParamsInResponseCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "IgnoreQueryParamsInResponseCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: IgnoreQueryParamsInResponseOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlIgnoreQueryParamsInResponseCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlIgnoreQueryParamsInResponseCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts new file mode 100644 index 000000000000..c9a9c5cfc84a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts @@ -0,0 +1,99 @@ +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 { InputAndOutputWithHeadersIO } from "../models/models_0"; +import { + deserializeAws_restXmlInputAndOutputWithHeadersCommand, + serializeAws_restXmlInputAndOutputWithHeadersCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface InputAndOutputWithHeadersCommandInput extends InputAndOutputWithHeadersIO {} +export interface InputAndOutputWithHeadersCommandOutput extends InputAndOutputWithHeadersIO, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there is + * no input or output payload but there are HTTP header bindings. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, InputAndOutputWithHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, InputAndOutputWithHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new InputAndOutputWithHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link InputAndOutputWithHeadersCommandInput} for command's `input` shape. + * @see {@link InputAndOutputWithHeadersCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class InputAndOutputWithHeadersCommand extends $Command< + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: InputAndOutputWithHeadersCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "InputAndOutputWithHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlInputAndOutputWithHeadersCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlInputAndOutputWithHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts new file mode 100644 index 000000000000..558a38628f51 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.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 { NestedXmlMapsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlNestedXmlMapsCommand, + serializeAws_restXmlNestedXmlMapsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface NestedXmlMapsCommandInput extends NestedXmlMapsInputOutput {} +export interface NestedXmlMapsCommandOutput extends NestedXmlMapsInputOutput, __MetadataBearer {} + +export class NestedXmlMapsCommand extends $Command< + NestedXmlMapsCommandInput, + NestedXmlMapsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NestedXmlMapsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "NestedXmlMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NestedXmlMapsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: NestedXmlMapsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NestedXmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlNestedXmlMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlNestedXmlMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts new file mode 100644 index 000000000000..1b2658cd1005 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts @@ -0,0 +1,96 @@ +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_restXmlNoInputAndNoOutputCommand, + serializeAws_restXmlNoInputAndNoOutputCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface NoInputAndNoOutputCommandInput {} +export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input or output. + * While this should be rare, code generators must support this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new NoInputAndNoOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndNoOutputCommand extends $Command< + NoInputAndNoOutputCommandInput, + NoInputAndNoOutputCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndNoOutputCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "NoInputAndNoOutputCommand"; + 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlNoInputAndNoOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlNoInputAndNoOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts new file mode 100644 index 000000000000..fbc91389dd2d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts @@ -0,0 +1,98 @@ +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 { NoInputAndOutputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlNoInputAndOutputCommand, + serializeAws_restXmlNoInputAndOutputCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface NoInputAndOutputCommandInput {} +export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} + +/** + * The example tests how requests and responses are serialized when there's + * no request or response payload because the operation has no input and the + * output is empty. While this should be rare, code generators must support + * this. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new NoInputAndOutputCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. + * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NoInputAndOutputCommand extends $Command< + NoInputAndOutputCommandInput, + NoInputAndOutputCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NoInputAndOutputCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "NoInputAndOutputCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlNoInputAndOutputCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlNoInputAndOutputCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts new file mode 100644 index 000000000000..cf0ecca40907 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts @@ -0,0 +1,98 @@ +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 { NullAndEmptyHeadersIO } from "../models/models_0"; +import { + deserializeAws_restXmlNullAndEmptyHeadersClientCommand, + serializeAws_restXmlNullAndEmptyHeadersClientCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface NullAndEmptyHeadersClientCommandInput extends NullAndEmptyHeadersIO {} +export interface NullAndEmptyHeadersClientCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} + +/** + * Null and empty headers are not sent over the wire. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, NullAndEmptyHeadersClientCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, NullAndEmptyHeadersClientCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new NullAndEmptyHeadersClientCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NullAndEmptyHeadersClientCommandInput} for command's `input` shape. + * @see {@link NullAndEmptyHeadersClientCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NullAndEmptyHeadersClientCommand extends $Command< + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NullAndEmptyHeadersClientCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "NullAndEmptyHeadersClientCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlNullAndEmptyHeadersClientCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlNullAndEmptyHeadersClientCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts new file mode 100644 index 000000000000..d6d4c5f716ba --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts @@ -0,0 +1,98 @@ +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 { NullAndEmptyHeadersIO } from "../models/models_0"; +import { + deserializeAws_restXmlNullAndEmptyHeadersServerCommand, + serializeAws_restXmlNullAndEmptyHeadersServerCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface NullAndEmptyHeadersServerCommandInput extends NullAndEmptyHeadersIO {} +export interface NullAndEmptyHeadersServerCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} + +/** + * Null and empty headers are not sent over the wire. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, NullAndEmptyHeadersServerCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, NullAndEmptyHeadersServerCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new NullAndEmptyHeadersServerCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link NullAndEmptyHeadersServerCommandInput} for command's `input` shape. + * @see {@link NullAndEmptyHeadersServerCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class NullAndEmptyHeadersServerCommand extends $Command< + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: NullAndEmptyHeadersServerCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "NullAndEmptyHeadersServerCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlNullAndEmptyHeadersServerCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlNullAndEmptyHeadersServerCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts new file mode 100644 index 000000000000..75fe14d3fd89 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts @@ -0,0 +1,101 @@ +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 { OmitsNullSerializesEmptyStringInput } from "../models/models_0"; +import { + deserializeAws_restXmlOmitsNullSerializesEmptyStringCommand, + serializeAws_restXmlOmitsNullSerializesEmptyStringCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface OmitsNullSerializesEmptyStringCommandInput extends OmitsNullSerializesEmptyStringInput {} +export interface OmitsNullSerializesEmptyStringCommandOutput extends __MetadataBearer {} + +/** + * Omits null, but serializes empty string value. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, OmitsNullSerializesEmptyStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, OmitsNullSerializesEmptyStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new OmitsNullSerializesEmptyStringCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link OmitsNullSerializesEmptyStringCommandInput} for command's `input` shape. + * @see {@link OmitsNullSerializesEmptyStringCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class OmitsNullSerializesEmptyStringCommand extends $Command< + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: OmitsNullSerializesEmptyStringCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "OmitsNullSerializesEmptyStringCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: OmitsNullSerializesEmptyStringInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: OmitsNullSerializesEmptyStringCommandInput, + context: __SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restXmlOmitsNullSerializesEmptyStringCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlOmitsNullSerializesEmptyStringCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts new file mode 100644 index 000000000000..1973f5aab88c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts @@ -0,0 +1,98 @@ +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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; +import { + deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommand, + serializeAws_restXmlQueryIdempotencyTokenAutoFillCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} +export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} + +/** + * Automatically adds idempotency tokens. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new QueryIdempotencyTokenAutoFillCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. + * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class QueryIdempotencyTokenAutoFillCommand extends $Command< + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "QueryIdempotencyTokenAutoFillCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlQueryIdempotencyTokenAutoFillCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts new file mode 100644 index 000000000000..a353051e0eab --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.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 { QueryParamsAsStringListMapInput } from "../models/models_0"; +import { + deserializeAws_restXmlQueryParamsAsStringListMapCommand, + serializeAws_restXmlQueryParamsAsStringListMapCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface QueryParamsAsStringListMapCommandInput extends QueryParamsAsStringListMapInput {} +export interface QueryParamsAsStringListMapCommandOutput extends __MetadataBearer {} + +export class QueryParamsAsStringListMapCommand extends $Command< + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryParamsAsStringListMapCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "QueryParamsAsStringListMapCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryParamsAsStringListMapInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlQueryParamsAsStringListMapCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_restXmlQueryParamsAsStringListMapCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts new file mode 100644 index 000000000000..6d3641e32dc8 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.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 { QueryPrecedenceInput } from "../models/models_0"; +import { + deserializeAws_restXmlQueryPrecedenceCommand, + serializeAws_restXmlQueryPrecedenceCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface QueryPrecedenceCommandInput extends QueryPrecedenceInput {} +export interface QueryPrecedenceCommandOutput extends __MetadataBearer {} + +export class QueryPrecedenceCommand extends $Command< + QueryPrecedenceCommandInput, + QueryPrecedenceCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: QueryPrecedenceCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "QueryPrecedenceCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: QueryPrecedenceInput.filterSensitiveLog, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: QueryPrecedenceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlQueryPrecedenceCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlQueryPrecedenceCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts new file mode 100644 index 000000000000..611155ccaa9d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts @@ -0,0 +1,95 @@ +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 { RecursiveShapesInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlRecursiveShapesCommand, + serializeAws_restXmlRecursiveShapesCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface RecursiveShapesCommandInput extends RecursiveShapesInputOutput {} +export interface RecursiveShapesCommandOutput extends RecursiveShapesInputOutput, __MetadataBearer {} + +/** + * Recursive shapes + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, RecursiveShapesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, RecursiveShapesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new RecursiveShapesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link RecursiveShapesCommandInput} for command's `input` shape. + * @see {@link RecursiveShapesCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class RecursiveShapesCommand extends $Command< + RecursiveShapesCommandInput, + RecursiveShapesCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: RecursiveShapesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "RecursiveShapesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: RecursiveShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlRecursiveShapesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlRecursiveShapesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts new file mode 100644 index 000000000000..608833f0a3b3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlSimpleScalarPropertiesCommand, + serializeAws_restXmlSimpleScalarPropertiesCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} +export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} + +export class SimpleScalarPropertiesCommand extends $Command< + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SimpleScalarPropertiesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "SimpleScalarPropertiesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlSimpleScalarPropertiesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlSimpleScalarPropertiesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts new file mode 100644 index 000000000000..8e075629fdd4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts @@ -0,0 +1,95 @@ +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 { TimestampFormatHeadersIO } from "../models/models_0"; +import { + deserializeAws_restXmlTimestampFormatHeadersCommand, + serializeAws_restXmlTimestampFormatHeadersCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface TimestampFormatHeadersCommandInput extends TimestampFormatHeadersIO {} +export interface TimestampFormatHeadersCommandOutput extends TimestampFormatHeadersIO, __MetadataBearer {} + +/** + * The example tests how timestamp request and response headers are serialized. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, TimestampFormatHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, TimestampFormatHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new TimestampFormatHeadersCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link TimestampFormatHeadersCommandInput} for command's `input` shape. + * @see {@link TimestampFormatHeadersCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class TimestampFormatHeadersCommand extends $Command< + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: TimestampFormatHeadersCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "TimestampFormatHeadersCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, + outputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: TimestampFormatHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlTimestampFormatHeadersCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlTimestampFormatHeadersCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts new file mode 100644 index 000000000000..f7c07eb32ebe --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts @@ -0,0 +1,95 @@ +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 { XmlAttributesInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlAttributesCommand, + serializeAws_restXmlXmlAttributesCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlAttributesCommandInput extends XmlAttributesInputOutput {} +export interface XmlAttributesCommandOutput extends XmlAttributesInputOutput, __MetadataBearer {} + +/** + * This example serializes an XML attributes on synthesized document. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlAttributesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlAttributesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlAttributesCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlAttributesCommandInput} for command's `input` shape. + * @see {@link XmlAttributesCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlAttributesCommand extends $Command< + XmlAttributesCommandInput, + XmlAttributesCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlAttributesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlAttributesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlAttributesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlAttributesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlAttributesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlAttributesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlAttributesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts new file mode 100644 index 000000000000..2da60886a09d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts @@ -0,0 +1,95 @@ +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 { XmlAttributesOnPayloadInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlAttributesOnPayloadCommand, + serializeAws_restXmlXmlAttributesOnPayloadCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlAttributesOnPayloadCommandInput extends XmlAttributesOnPayloadInputOutput {} +export interface XmlAttributesOnPayloadCommandOutput extends XmlAttributesOnPayloadInputOutput, __MetadataBearer {} + +/** + * This example serializes an XML attributes on a document targeted by httpPayload. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlAttributesOnPayloadCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlAttributesOnPayloadCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlAttributesOnPayloadCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlAttributesOnPayloadCommandInput} for command's `input` shape. + * @see {@link XmlAttributesOnPayloadCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlAttributesOnPayloadCommand extends $Command< + XmlAttributesOnPayloadCommandInput, + XmlAttributesOnPayloadCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlAttributesOnPayloadCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlAttributesOnPayloadCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlAttributesOnPayloadInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlAttributesOnPayloadInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlAttributesOnPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlAttributesOnPayloadCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlAttributesOnPayloadCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts new file mode 100644 index 000000000000..9e5ab80cff31 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlBlobsInputOutput } from "../models/models_0"; +import { deserializeAws_restXmlXmlBlobsCommand, serializeAws_restXmlXmlBlobsCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlBlobsCommandInput extends XmlBlobsInputOutput {} +export interface XmlBlobsCommandOutput extends XmlBlobsInputOutput, __MetadataBearer {} + +/** + * Blobs are base64 encoded + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlBlobsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlBlobsCommandInput} for command's `input` shape. + * @see {@link XmlBlobsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlBlobsCommand extends $Command< + XmlBlobsCommandInput, + XmlBlobsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlBlobsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts new file mode 100644 index 000000000000..4a07eeeb6df4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts @@ -0,0 +1,95 @@ +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 { XmlBlobsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlEmptyBlobsCommand, + serializeAws_restXmlXmlEmptyBlobsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlEmptyBlobsCommandInput extends XmlBlobsInputOutput {} +export interface XmlEmptyBlobsCommandOutput extends XmlBlobsInputOutput, __MetadataBearer {} + +/** + * Blobs are base64 encoded + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlEmptyBlobsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlEmptyBlobsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlEmptyBlobsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlEmptyBlobsCommandInput} for command's `input` shape. + * @see {@link XmlEmptyBlobsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlEmptyBlobsCommand extends $Command< + XmlEmptyBlobsCommandInput, + XmlEmptyBlobsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyBlobsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlEmptyBlobsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlEmptyBlobsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlEmptyBlobsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts new file mode 100644 index 000000000000..1198ed9ff3f3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.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 { XmlListsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlEmptyListsCommand, + serializeAws_restXmlXmlEmptyListsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlEmptyListsCommandInput extends XmlListsInputOutput {} +export interface XmlEmptyListsCommandOutput extends XmlListsInputOutput, __MetadataBearer {} + +export class XmlEmptyListsCommand extends $Command< + XmlEmptyListsCommandInput, + XmlEmptyListsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyListsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlEmptyListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlEmptyListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlEmptyListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts new file mode 100644 index 000000000000..0e5c07b7ca3e --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.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 { XmlMapsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlEmptyMapsCommand, + serializeAws_restXmlXmlEmptyMapsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlEmptyMapsCommandInput extends XmlMapsInputOutput {} +export interface XmlEmptyMapsCommandOutput extends XmlMapsInputOutput, __MetadataBearer {} + +export class XmlEmptyMapsCommand extends $Command< + XmlEmptyMapsCommandInput, + XmlEmptyMapsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyMapsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlEmptyMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlEmptyMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlEmptyMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts new file mode 100644 index 000000000000..7573d164a7b9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.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 { XmlEmptyStringsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlEmptyStringsCommand, + serializeAws_restXmlXmlEmptyStringsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlEmptyStringsCommandInput extends XmlEmptyStringsInputOutput {} +export interface XmlEmptyStringsCommandOutput extends XmlEmptyStringsInputOutput, __MetadataBearer {} + +export class XmlEmptyStringsCommand extends $Command< + XmlEmptyStringsCommandInput, + XmlEmptyStringsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEmptyStringsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlEmptyStringsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlEmptyStringsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlEmptyStringsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEmptyStringsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlEmptyStringsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlEmptyStringsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts new file mode 100644 index 000000000000..5149ed4a3ee4 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlEnumsInputOutput } from "../models/models_0"; +import { deserializeAws_restXmlXmlEnumsCommand, serializeAws_restXmlXmlEnumsCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlEnumsCommandInput extends XmlEnumsInputOutput {} +export interface XmlEnumsCommandOutput extends XmlEnumsInputOutput, __MetadataBearer {} + +/** + * This example serializes enums as top level properties, in lists, sets, and maps. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlEnumsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlEnumsCommandInput} for command's `input` shape. + * @see {@link XmlEnumsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlEnumsCommand extends $Command< + XmlEnumsCommandInput, + XmlEnumsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlEnumsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlEnumsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlEnumsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlEnumsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlEnumsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlEnumsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts new file mode 100644 index 000000000000..84f5a70b3c3f --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts @@ -0,0 +1,103 @@ +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 { XmlListsInputOutput } from "../models/models_0"; +import { deserializeAws_restXmlXmlListsCommand, serializeAws_restXmlXmlListsCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlListsCommandInput extends XmlListsInputOutput {} +export interface XmlListsCommandOutput extends XmlListsInputOutput, __MetadataBearer {} + +/** + * This test case serializes XML lists for the following cases for both + * input and output: + * + * 1. Normal XML lists. + * 2. Normal XML sets. + * 3. XML lists of lists. + * 4. XML lists with @xmlName on its members + * 5. Flattened XML lists. + * 6. Flattened XML lists with @xmlName. + * 7. Flattened XML lists with @xmlNamespace. + * 8. Lists of structures. + * 9. Flattened XML list of structures + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlListsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlListsCommandInput} for command's `input` shape. + * @see {@link XmlListsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlListsCommand extends $Command< + XmlListsCommandInput, + XmlListsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlListsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlListsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlListsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlListsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts new file mode 100644 index 000000000000..ef2bae358dc6 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts @@ -0,0 +1,92 @@ +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 { XmlMapsInputOutput } from "../models/models_0"; +import { deserializeAws_restXmlXmlMapsCommand, serializeAws_restXmlXmlMapsCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlMapsCommandInput extends XmlMapsInputOutput {} +export interface XmlMapsCommandOutput extends XmlMapsInputOutput, __MetadataBearer {} + +/** + * The example tests basic map serialization. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlMapsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlMapsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlMapsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlMapsCommandInput} for command's `input` shape. + * @see {@link XmlMapsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlMapsCommand extends $Command< + XmlMapsCommandInput, + XmlMapsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlMapsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlMapsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlMapsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlMapsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts new file mode 100644 index 000000000000..33887182f973 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.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 { XmlMapsXmlNameInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlMapsXmlNameCommand, + serializeAws_restXmlXmlMapsXmlNameCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlMapsXmlNameCommandInput extends XmlMapsXmlNameInputOutput {} +export interface XmlMapsXmlNameCommandOutput extends XmlMapsXmlNameInputOutput, __MetadataBearer {} + +export class XmlMapsXmlNameCommand extends $Command< + XmlMapsXmlNameCommandInput, + XmlMapsXmlNameCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlMapsXmlNameCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlMapsXmlNameCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlMapsXmlNameInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlMapsXmlNameInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlMapsXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlMapsXmlNameCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlMapsXmlNameCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts new file mode 100644 index 000000000000..30278ecbed6d --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.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 { XmlNamespacesInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlNamespacesCommand, + serializeAws_restXmlXmlNamespacesCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlNamespacesCommandInput extends XmlNamespacesInputOutput {} +export interface XmlNamespacesCommandOutput extends XmlNamespacesInputOutput, __MetadataBearer {} + +export class XmlNamespacesCommand extends $Command< + XmlNamespacesCommandInput, + XmlNamespacesCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlNamespacesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlNamespacesCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlNamespacesInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlNamespacesInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlNamespacesCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlNamespacesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts new file mode 100644 index 000000000000..54974057f855 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts @@ -0,0 +1,97 @@ +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 { XmlTimestampsInputOutput } from "../models/models_0"; +import { + deserializeAws_restXmlXmlTimestampsCommand, + serializeAws_restXmlXmlTimestampsCommand, +} from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlTimestampsCommandInput extends XmlTimestampsInputOutput {} +export interface XmlTimestampsCommandOutput extends XmlTimestampsInputOutput, __MetadataBearer {} + +/** + * This tests how timestamps are serialized, including using the + * default format of date-time and various @timestampFormat trait + * values. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const command = new XmlTimestampsCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link XmlTimestampsCommandInput} for command's `input` shape. + * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. + * + */ +export class XmlTimestampsCommand extends $Command< + XmlTimestampsCommandInput, + XmlTimestampsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlTimestampsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlTimestampsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlTimestampsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlTimestampsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlTimestampsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlTimestampsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts new file mode 100644 index 000000000000..47e192821e31 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts @@ -0,0 +1,75 @@ +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 { XmlUnionsInputOutput } from "../models/models_0"; +import { deserializeAws_restXmlXmlUnionsCommand, serializeAws_restXmlXmlUnionsCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +export interface XmlUnionsCommandInput extends XmlUnionsInputOutput {} +export interface XmlUnionsCommandOutput extends XmlUnionsInputOutput, __MetadataBearer {} + +export class XmlUnionsCommand extends $Command< + XmlUnionsCommandInput, + XmlUnionsCommandOutput, + RestXmlProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: XmlUnionsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestXmlProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestXmlProtocolClient"; + const commandName = "XmlUnionsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: XmlUnionsInputOutput.filterSensitiveLog, + outputFilterSensitiveLog: XmlUnionsInputOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: XmlUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restXmlXmlUnionsCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restXmlXmlUnionsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts new file mode 100644 index 000000000000..74d2ea6c9bb3 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts @@ -0,0 +1,53 @@ +export * from "./AllQueryStringTypesCommand"; +export * from "./BodyWithXmlNameCommand"; +export * from "./ConstantAndVariableQueryStringCommand"; +export * from "./ConstantQueryStringCommand"; +export * from "./EmptyInputAndEmptyOutputCommand"; +export * from "./EndpointOperationCommand"; +export * from "./EndpointWithHostLabelHeaderOperationCommand"; +export * from "./EndpointWithHostLabelOperationCommand"; +export * from "./FlattenedXmlMapCommand"; +export * from "./FlattenedXmlMapWithXmlNameCommand"; +export * from "./FlattenedXmlMapWithXmlNamespaceCommand"; +export * from "./GreetingWithErrorsCommand"; +export * from "./HttpPayloadTraitsCommand"; +export * from "./HttpPayloadTraitsWithMediaTypeCommand"; +export * from "./HttpPayloadWithMemberXmlNameCommand"; +export * from "./HttpPayloadWithStructureCommand"; +export * from "./HttpPayloadWithXmlNameCommand"; +export * from "./HttpPayloadWithXmlNamespaceAndPrefixCommand"; +export * from "./HttpPayloadWithXmlNamespaceCommand"; +export * from "./HttpPrefixHeadersCommand"; +export * from "./HttpRequestWithFloatLabelsCommand"; +export * from "./HttpRequestWithGreedyLabelInPathCommand"; +export * from "./HttpRequestWithLabelsAndTimestampFormatCommand"; +export * from "./HttpRequestWithLabelsCommand"; +export * from "./HttpResponseCodeCommand"; +export * from "./IgnoreQueryParamsInResponseCommand"; +export * from "./InputAndOutputWithHeadersCommand"; +export * from "./NestedXmlMapsCommand"; +export * from "./NoInputAndNoOutputCommand"; +export * from "./NoInputAndOutputCommand"; +export * from "./NullAndEmptyHeadersClientCommand"; +export * from "./NullAndEmptyHeadersServerCommand"; +export * from "./OmitsNullSerializesEmptyStringCommand"; +export * from "./QueryIdempotencyTokenAutoFillCommand"; +export * from "./QueryParamsAsStringListMapCommand"; +export * from "./QueryPrecedenceCommand"; +export * from "./RecursiveShapesCommand"; +export * from "./SimpleScalarPropertiesCommand"; +export * from "./TimestampFormatHeadersCommand"; +export * from "./XmlAttributesCommand"; +export * from "./XmlAttributesOnPayloadCommand"; +export * from "./XmlBlobsCommand"; +export * from "./XmlEmptyBlobsCommand"; +export * from "./XmlEmptyListsCommand"; +export * from "./XmlEmptyMapsCommand"; +export * from "./XmlEmptyStringsCommand"; +export * from "./XmlEnumsCommand"; +export * from "./XmlListsCommand"; +export * from "./XmlMapsCommand"; +export * from "./XmlMapsXmlNameCommand"; +export * from "./XmlNamespacesCommand"; +export * from "./XmlTimestampsCommand"; +export * from "./XmlUnionsCommand"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts b/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts new file mode 100644 index 000000000000..f06accf756de --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts @@ -0,0 +1,62 @@ +import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; +import { RegionInfoProvider } from "@aws-sdk/types"; + +const regionHash: RegionHash = {}; + +const partitionHash: PartitionHash = { + aws: { + regions: [ + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-northeast-3", + "ap-south-1", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-central-1", + "eu-north-1", + "eu-south-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "me-south-1", + "sa-east-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ], + regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + hostname: "restxml.{region}.amazonaws.com", + }, + "aws-cn": { + regions: ["cn-north-1", "cn-northwest-1"], + regionRegex: "^cn\\-\\w+\\-\\d+$", + hostname: "restxml.{region}.amazonaws.com.cn", + }, + "aws-iso": { + regions: ["us-iso-east-1", "us-iso-west-1"], + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + hostname: "restxml.{region}.c2s.ic.gov", + }, + "aws-iso-b": { + regions: ["us-isob-east-1"], + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + hostname: "restxml.{region}.sc2s.sgov.gov", + }, + "aws-us-gov": { + regions: ["us-gov-east-1", "us-gov-west-1"], + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + hostname: "restxml.{region}.amazonaws.com", + }, +}; + +export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => + getRegionInfo(region, { + ...options, + signingService: "restxml", + regionHash, + partitionHash, + }); diff --git a/protocol_tests/aws-protocoltests-restxml/src/index.ts b/protocol_tests/aws-protocoltests-restxml/src/index.ts new file mode 100644 index 000000000000..59ad9430b749 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/index.ts @@ -0,0 +1,4 @@ +export * from "./RestXmlProtocol"; +export * from "./RestXmlProtocolClient"; +export * from "./commands"; +export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/models/index.ts b/protocol_tests/aws-protocoltests-restxml/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts b/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts new file mode 100644 index 000000000000..288c93cb643a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts @@ -0,0 +1,1141 @@ +import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; + +export enum FooEnum { + BAR = "Bar", + BAZ = "Baz", + FOO = "Foo", + ONE = "1", + ZERO = "0", +} + +export interface AllQueryStringTypesInput { + queryString?: string; + queryStringList?: string[]; + queryStringSet?: string[]; + queryByte?: number; + queryShort?: number; + queryInteger?: number; + queryIntegerList?: number[]; + queryIntegerSet?: number[]; + queryLong?: number; + queryFloat?: number; + queryDouble?: number; + queryDoubleList?: number[]; + queryBoolean?: boolean; + queryBooleanList?: boolean[]; + queryTimestamp?: Date; + queryTimestampList?: Date[]; + queryEnum?: FooEnum | string; + queryEnumList?: (FooEnum | string)[]; + queryParamsMapOfStrings?: { [key: string]: string }; +} + +export namespace AllQueryStringTypesInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: AllQueryStringTypesInput): any => ({ + ...obj, + }); +} + +export interface PayloadWithXmlName { + name?: string; +} + +export namespace PayloadWithXmlName { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PayloadWithXmlName): any => ({ + ...obj, + }); +} + +export interface BodyWithXmlNameInputOutput { + nested?: PayloadWithXmlName; +} + +export namespace BodyWithXmlNameInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: BodyWithXmlNameInputOutput): any => ({ + ...obj, + }); +} + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when a request is invalid. + */ +export interface ComplexError extends __SmithyException, $MetadataBearer { + name: "ComplexError"; + $fault: "client"; + Header?: string; + TopLevel?: string; + Nested?: ComplexNestedErrorData; +} + +export namespace ComplexError { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexError): any => ({ + ...obj, + }); +} + +export interface ConstantAndVariableQueryStringInput { + baz?: string; + maybeSet?: string; +} + +export namespace ConstantAndVariableQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantAndVariableQueryStringInput): any => ({ + ...obj, + }); +} + +export interface ConstantQueryStringInput { + hello: string | undefined; +} + +export namespace ConstantQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantQueryStringInput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); +} + +export interface EmptyInputAndEmptyOutputOutput {} + +export namespace EmptyInputAndEmptyOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ + ...obj, + }); +} + +export interface HostLabelHeaderInput { + accountId: string | undefined; +} + +export namespace HostLabelHeaderInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelHeaderInput): any => ({ + ...obj, + }); +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); +} + +export interface FlattenedXmlMapInputOutput { + myMap?: { [key: string]: FooEnum | string }; +} + +export namespace FlattenedXmlMapInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapInputOutput): any => ({ + ...obj, + }); +} + +export interface FlattenedXmlMapWithXmlNameInputOutput { + myMap?: { [key: string]: string }; +} + +export namespace FlattenedXmlMapWithXmlNameInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNameInputOutput): any => ({ + ...obj, + }); +} + +export interface FlattenedXmlMapWithXmlNamespaceOutput { + myMap?: { [key: string]: string }; +} + +export namespace FlattenedXmlMapWithXmlNamespaceOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNamespaceOutput): any => ({ + ...obj, + }); +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export interface InvalidGreeting extends __SmithyException, $MetadataBearer { + name: "InvalidGreeting"; + $fault: "client"; + Message?: string; +} + +export namespace InvalidGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ + ...obj, + }); +} + +export interface HttpPayloadTraitsInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPayloadTraitsWithMediaTypeInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsWithMediaTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsWithMediaTypeInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithMemberXmlNameInputOutput { + nested?: PayloadWithXmlName; +} + +export namespace HttpPayloadWithMemberXmlNameInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithMemberXmlNameInputOutput): any => ({ + ...obj, + }); +} + +export interface NestedPayload { + greeting?: string; + name?: string; +} + +export namespace NestedPayload { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedPayload): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithStructureInputOutput { + nested?: NestedPayload; +} + +export namespace HttpPayloadWithStructureInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithStructureInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithXmlNameInputOutput { + nested?: PayloadWithXmlName; +} + +export namespace HttpPayloadWithXmlNameInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithXmlNameInputOutput): any => ({ + ...obj, + }); +} + +export interface PayloadWithXmlNamespace { + name?: string; +} + +export namespace PayloadWithXmlNamespace { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PayloadWithXmlNamespace): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithXmlNamespaceInputOutput { + nested?: PayloadWithXmlNamespace; +} + +export namespace HttpPayloadWithXmlNamespaceInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithXmlNamespaceInputOutput): any => ({ + ...obj, + }); +} + +export interface PayloadWithXmlNamespaceAndPrefix { + name?: string; +} + +export namespace PayloadWithXmlNamespaceAndPrefix { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PayloadWithXmlNamespaceAndPrefix): any => ({ + ...obj, + }); +} + +export interface HttpPayloadWithXmlNamespaceAndPrefixInputOutput { + nested?: PayloadWithXmlNamespaceAndPrefix; +} + +export namespace HttpPayloadWithXmlNamespaceAndPrefixInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithXmlNamespaceAndPrefixInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpPrefixHeadersInputOutput { + foo?: string; + fooMap?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersInputOutput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithFloatLabelsInput { + float: number | undefined; + double: number | undefined; +} + +export namespace HttpRequestWithFloatLabelsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithFloatLabelsInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithGreedyLabelInPathInput { + foo: string | undefined; + baz: string | undefined; +} + +export namespace HttpRequestWithGreedyLabelInPathInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithGreedyLabelInPathInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithLabelsInput { + string: string | undefined; + short: number | undefined; + integer: number | undefined; + long: number | undefined; + float: number | undefined; + double: number | undefined; + /** + * Serialized in the path as true or false. + */ + boolean: boolean | undefined; + + /** + * Note that this member has no format, so it's serialized as an RFC 3399 date-time. + */ + timestamp: Date | undefined; +} + +export namespace HttpRequestWithLabelsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithLabelsInput): any => ({ + ...obj, + }); +} + +export interface HttpRequestWithLabelsAndTimestampFormatInput { + memberEpochSeconds: Date | undefined; + memberHttpDate: Date | undefined; + memberDateTime: Date | undefined; + defaultFormat: Date | undefined; + targetEpochSeconds: Date | undefined; + targetHttpDate: Date | undefined; + targetDateTime: Date | undefined; +} + +export namespace HttpRequestWithLabelsAndTimestampFormatInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithLabelsAndTimestampFormatInput): any => ({ + ...obj, + }); +} + +export interface HttpResponseCodeOutput { + Status?: number; +} + +export namespace HttpResponseCodeOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpResponseCodeOutput): any => ({ + ...obj, + }); +} + +export interface IgnoreQueryParamsInResponseOutput { + baz?: string; +} + +export namespace IgnoreQueryParamsInResponseOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: IgnoreQueryParamsInResponseOutput): any => ({ + ...obj, + }); +} + +export interface InputAndOutputWithHeadersIO { + headerString?: string; + headerByte?: number; + headerShort?: number; + headerInteger?: number; + headerLong?: number; + headerFloat?: number; + headerDouble?: number; + headerTrueBool?: boolean; + headerFalseBool?: boolean; + headerStringList?: string[]; + headerStringSet?: string[]; + headerIntegerList?: number[]; + headerBooleanList?: boolean[]; + headerTimestampList?: Date[]; + headerEnum?: FooEnum | string; + headerEnumList?: (FooEnum | string)[]; +} + +export namespace InputAndOutputWithHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: InputAndOutputWithHeadersIO): any => ({ + ...obj, + }); +} + +export interface NestedXmlMapsInputOutput { + nestedMap?: { [key: string]: { [key: string]: FooEnum | string } }; + flatNestedMap?: { [key: string]: { [key: string]: FooEnum | string } }; +} + +export namespace NestedXmlMapsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedXmlMapsInputOutput): any => ({ + ...obj, + }); +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); +} + +export interface NullAndEmptyHeadersIO { + a?: string; + b?: string; + c?: string[]; +} + +export namespace NullAndEmptyHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NullAndEmptyHeadersIO): any => ({ + ...obj, + }); +} + +export interface OmitsNullSerializesEmptyStringInput { + nullValue?: string; + emptyString?: string; +} + +export namespace OmitsNullSerializesEmptyStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: OmitsNullSerializesEmptyStringInput): any => ({ + ...obj, + }); +} + +export interface QueryIdempotencyTokenAutoFillInput { + token?: string; +} + +export namespace QueryIdempotencyTokenAutoFillInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ + ...obj, + }); +} + +export interface QueryParamsAsStringListMapInput { + qux?: string; + foo?: { [key: string]: string[] }; +} + +export namespace QueryParamsAsStringListMapInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryParamsAsStringListMapInput): any => ({ + ...obj, + }); +} + +export interface QueryPrecedenceInput { + foo?: string; + baz?: { [key: string]: string }; +} + +export namespace QueryPrecedenceInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryPrecedenceInput): any => ({ + ...obj, + }); +} + +export interface SimpleScalarPropertiesInputOutput { + foo?: string; + stringValue?: string; + trueBooleanValue?: boolean; + falseBooleanValue?: boolean; + byteValue?: number; + shortValue?: number; + integerValue?: number; + longValue?: number; + floatValue?: number; + doubleValue?: number; +} + +export namespace SimpleScalarPropertiesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ + ...obj, + }); +} + +export interface TimestampFormatHeadersIO { + memberEpochSeconds?: Date; + memberHttpDate?: Date; + memberDateTime?: Date; + defaultFormat?: Date; + targetEpochSeconds?: Date; + targetHttpDate?: Date; + targetDateTime?: Date; +} + +export namespace TimestampFormatHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TimestampFormatHeadersIO): any => ({ + ...obj, + }); +} + +export interface XmlAttributesInputOutput { + foo?: string; + attr?: string; +} + +export namespace XmlAttributesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlAttributesInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlAttributesOnPayloadInputOutput { + payload?: XmlAttributesInputOutput; +} + +export namespace XmlAttributesOnPayloadInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlAttributesOnPayloadInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlBlobsInputOutput { + data?: Uint8Array; +} + +export namespace XmlBlobsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlBlobsInputOutput): any => ({ + ...obj, + }); +} + +export interface StructureListMember { + a?: string; + b?: string; +} + +export namespace StructureListMember { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructureListMember): any => ({ + ...obj, + }); +} + +export interface XmlListsInputOutput { + stringList?: string[]; + stringSet?: string[]; + integerList?: number[]; + booleanList?: boolean[]; + timestampList?: Date[]; + enumList?: (FooEnum | string)[]; + /** + * A list of lists of strings. + */ + nestedStringList?: string[][]; + + renamedListMembers?: string[]; + flattenedList?: string[]; + flattenedList2?: string[]; + flattenedListWithMemberNamespace?: string[]; + flattenedListWithNamespace?: string[]; + structureList?: StructureListMember[]; + flattenedStructureList?: StructureListMember[]; +} + +export namespace XmlListsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlListsInputOutput): any => ({ + ...obj, + }); +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); +} + +export interface XmlMapsInputOutput { + myMap?: { [key: string]: GreetingStruct }; +} + +export namespace XmlMapsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlMapsInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlEmptyStringsInputOutput { + emptyString?: string; +} + +export namespace XmlEmptyStringsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlEmptyStringsInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlEnumsInputOutput { + fooEnum1?: FooEnum | string; + fooEnum2?: FooEnum | string; + fooEnum3?: FooEnum | string; + fooEnumList?: (FooEnum | string)[]; + fooEnumSet?: (FooEnum | string)[]; + fooEnumMap?: { [key: string]: FooEnum | string }; +} + +export namespace XmlEnumsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlEnumsInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlMapsXmlNameInputOutput { + myMap?: { [key: string]: GreetingStruct }; +} + +export namespace XmlMapsXmlNameInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlMapsXmlNameInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlNamespaceNested { + foo?: string; + values?: string[]; +} + +export namespace XmlNamespaceNested { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ + ...obj, + }); +} + +export interface XmlNamespacesInputOutput { + nested?: XmlNamespaceNested; +} + +export namespace XmlNamespacesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNamespacesInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlTimestampsInputOutput { + normal?: Date; + dateTime?: Date; + epochSeconds?: Date; + httpDate?: Date; +} + +export namespace XmlTimestampsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlTimestampsInputOutput): any => ({ + ...obj, + }); +} + +export interface XmlNestedUnionStruct { + stringValue?: string; + booleanValue?: boolean; + byteValue?: number; + shortValue?: number; + integerValue?: number; + longValue?: number; + floatValue?: number; + doubleValue?: number; +} + +export namespace XmlNestedUnionStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlNestedUnionStruct): any => ({ + ...obj, + }); +} + +export type XmlUnionShape = + | XmlUnionShape.BooleanValueMember + | XmlUnionShape.ByteValueMember + | XmlUnionShape.DoubleValueMember + | XmlUnionShape.FloatValueMember + | XmlUnionShape.IntegerValueMember + | XmlUnionShape.LongValueMember + | XmlUnionShape.ShortValueMember + | XmlUnionShape.StringValueMember + | XmlUnionShape.StructValueMember + | XmlUnionShape.UnionValueMember + | XmlUnionShape.$UnknownMember; + +export namespace XmlUnionShape { + export interface StringValueMember { + stringValue: string; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface BooleanValueMember { + stringValue?: never; + booleanValue: boolean; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface ByteValueMember { + stringValue?: never; + booleanValue?: never; + byteValue: number; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface ShortValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue: number; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface IntegerValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue: number; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface LongValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue: number; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface FloatValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue: number; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface DoubleValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue: number; + unionValue?: never; + structValue?: never; + $unknown?: never; + } + + export interface UnionValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue: XmlUnionShape; + structValue?: never; + $unknown?: never; + } + + export interface StructValueMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue: XmlNestedUnionStruct; + $unknown?: never; + } + + export interface $UnknownMember { + stringValue?: never; + booleanValue?: never; + byteValue?: never; + shortValue?: never; + integerValue?: never; + longValue?: never; + floatValue?: never; + doubleValue?: never; + unionValue?: never; + structValue?: never; + $unknown: [string, any]; + } + + export interface Visitor { + stringValue: (value: string) => T; + booleanValue: (value: boolean) => T; + byteValue: (value: number) => T; + shortValue: (value: number) => T; + integerValue: (value: number) => T; + longValue: (value: number) => T; + floatValue: (value: number) => T; + doubleValue: (value: number) => T; + unionValue: (value: XmlUnionShape) => T; + structValue: (value: XmlNestedUnionStruct) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: XmlUnionShape, visitor: Visitor): T => { + if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); + if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); + if (value.byteValue !== undefined) return visitor.byteValue(value.byteValue); + if (value.shortValue !== undefined) return visitor.shortValue(value.shortValue); + if (value.integerValue !== undefined) return visitor.integerValue(value.integerValue); + if (value.longValue !== undefined) return visitor.longValue(value.longValue); + if (value.floatValue !== undefined) return visitor.floatValue(value.floatValue); + if (value.doubleValue !== undefined) return visitor.doubleValue(value.doubleValue); + if (value.unionValue !== undefined) return visitor.unionValue(value.unionValue); + if (value.structValue !== undefined) return visitor.structValue(value.structValue); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlUnionShape): any => { + if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; + if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; + if (obj.byteValue !== undefined) return { byteValue: obj.byteValue }; + if (obj.shortValue !== undefined) return { shortValue: obj.shortValue }; + if (obj.integerValue !== undefined) return { integerValue: obj.integerValue }; + if (obj.longValue !== undefined) return { longValue: obj.longValue }; + if (obj.floatValue !== undefined) return { floatValue: obj.floatValue }; + if (obj.doubleValue !== undefined) return { doubleValue: obj.doubleValue }; + if (obj.unionValue !== undefined) return { unionValue: XmlUnionShape.filterSensitiveLog(obj.unionValue) }; + if (obj.structValue !== undefined) return { structValue: XmlNestedUnionStruct.filterSensitiveLog(obj.structValue) }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; +} + +export interface RecursiveShapesInputOutputNested1 { + foo?: string; + nested?: RecursiveShapesInputOutputNested2; +} + +export namespace RecursiveShapesInputOutputNested1 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested1): any => ({ + ...obj, + }); +} + +export interface RecursiveShapesInputOutputNested2 { + bar?: string; + recursiveMember?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutputNested2 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested2): any => ({ + ...obj, + }); +} + +export interface XmlUnionsInputOutput { + unionValue?: XmlUnionShape; +} + +export namespace XmlUnionsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: XmlUnionsInputOutput): any => ({ + ...obj, + ...(obj.unionValue && { unionValue: XmlUnionShape.filterSensitiveLog(obj.unionValue) }), + }); +} + +export interface RecursiveShapesInputOutput { + nested?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutput): any => ({ + ...obj, + }); +} diff --git a/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts new file mode 100644 index 000000000000..b969d18f04e9 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts @@ -0,0 +1,6221 @@ +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse, + isValidHostname as __isValidHostname, +} from "@aws-sdk/protocol-http"; +import { + dateToUtcString as __dateToUtcString, + expectNonNull as __expectNonNull, + expectObject as __expectObject, + expectString as __expectString, + expectUnion as __expectUnion, + extendedEncodeURIComponent as __extendedEncodeURIComponent, + getArrayIfSingleItem as __getArrayIfSingleItem, + getValueFromTextNode as __getValueFromTextNode, + parseBoolean as __parseBoolean, + parseEpochTimestamp as __parseEpochTimestamp, + parseRfc3339DateTime as __parseRfc3339DateTime, + parseRfc7231DateTime as __parseRfc7231DateTime, + splitEvery as __splitEvery, + strictParseByte as __strictParseByte, + strictParseDouble as __strictParseDouble, + strictParseFloat as __strictParseFloat, + strictParseInt32 as __strictParseInt32, + strictParseLong as __strictParseLong, + strictParseShort as __strictParseShort, +} from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; +import { decodeHTML } from "entities"; +import { parse as xmlParse } from "fast-xml-parser"; +import { v4 as generateIdempotencyToken } from "uuid"; + +import { + AllQueryStringTypesCommandInput, + AllQueryStringTypesCommandOutput, +} from "../commands/AllQueryStringTypesCommand"; +import { BodyWithXmlNameCommandInput, BodyWithXmlNameCommandOutput } from "../commands/BodyWithXmlNameCommand"; +import { + ConstantAndVariableQueryStringCommandInput, + ConstantAndVariableQueryStringCommandOutput, +} from "../commands/ConstantAndVariableQueryStringCommand"; +import { + ConstantQueryStringCommandInput, + ConstantQueryStringCommandOutput, +} from "../commands/ConstantQueryStringCommand"; +import { + EmptyInputAndEmptyOutputCommandInput, + EmptyInputAndEmptyOutputCommandOutput, +} from "../commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; +import { + EndpointWithHostLabelHeaderOperationCommandInput, + EndpointWithHostLabelHeaderOperationCommandOutput, +} from "../commands/EndpointWithHostLabelHeaderOperationCommand"; +import { + EndpointWithHostLabelOperationCommandInput, + EndpointWithHostLabelOperationCommandOutput, +} from "../commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "../commands/FlattenedXmlMapCommand"; +import { + FlattenedXmlMapWithXmlNameCommandInput, + FlattenedXmlMapWithXmlNameCommandOutput, +} from "../commands/FlattenedXmlMapWithXmlNameCommand"; +import { + FlattenedXmlMapWithXmlNamespaceCommandInput, + FlattenedXmlMapWithXmlNamespaceCommandOutput, +} from "../commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand"; +import { + HttpPayloadTraitsWithMediaTypeCommandInput, + HttpPayloadTraitsWithMediaTypeCommandOutput, +} from "../commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { + HttpPayloadWithMemberXmlNameCommandInput, + HttpPayloadWithMemberXmlNameCommandOutput, +} from "../commands/HttpPayloadWithMemberXmlNameCommand"; +import { + HttpPayloadWithStructureCommandInput, + HttpPayloadWithStructureCommandOutput, +} from "../commands/HttpPayloadWithStructureCommand"; +import { + HttpPayloadWithXmlNameCommandInput, + HttpPayloadWithXmlNameCommandOutput, +} from "../commands/HttpPayloadWithXmlNameCommand"; +import { + HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, +} from "../commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; +import { + HttpPayloadWithXmlNamespaceCommandInput, + HttpPayloadWithXmlNamespaceCommandOutput, +} from "../commands/HttpPayloadWithXmlNamespaceCommand"; +import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "../commands/HttpPrefixHeadersCommand"; +import { + HttpRequestWithFloatLabelsCommandInput, + HttpRequestWithFloatLabelsCommandOutput, +} from "../commands/HttpRequestWithFloatLabelsCommand"; +import { + HttpRequestWithGreedyLabelInPathCommandInput, + HttpRequestWithGreedyLabelInPathCommandOutput, +} from "../commands/HttpRequestWithGreedyLabelInPathCommand"; +import { + HttpRequestWithLabelsAndTimestampFormatCommandInput, + HttpRequestWithLabelsAndTimestampFormatCommandOutput, +} from "../commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { + HttpRequestWithLabelsCommandInput, + HttpRequestWithLabelsCommandOutput, +} from "../commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "../commands/HttpResponseCodeCommand"; +import { + IgnoreQueryParamsInResponseCommandInput, + IgnoreQueryParamsInResponseCommandOutput, +} from "../commands/IgnoreQueryParamsInResponseCommand"; +import { + InputAndOutputWithHeadersCommandInput, + InputAndOutputWithHeadersCommandOutput, +} from "../commands/InputAndOutputWithHeadersCommand"; +import { NestedXmlMapsCommandInput, NestedXmlMapsCommandOutput } from "../commands/NestedXmlMapsCommand"; +import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; +import { + NullAndEmptyHeadersClientCommandInput, + NullAndEmptyHeadersClientCommandOutput, +} from "../commands/NullAndEmptyHeadersClientCommand"; +import { + NullAndEmptyHeadersServerCommandInput, + NullAndEmptyHeadersServerCommandOutput, +} from "../commands/NullAndEmptyHeadersServerCommand"; +import { + OmitsNullSerializesEmptyStringCommandInput, + OmitsNullSerializesEmptyStringCommandOutput, +} from "../commands/OmitsNullSerializesEmptyStringCommand"; +import { + QueryIdempotencyTokenAutoFillCommandInput, + QueryIdempotencyTokenAutoFillCommandOutput, +} from "../commands/QueryIdempotencyTokenAutoFillCommand"; +import { + QueryParamsAsStringListMapCommandInput, + QueryParamsAsStringListMapCommandOutput, +} from "../commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "../commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "../commands/RecursiveShapesCommand"; +import { + SimpleScalarPropertiesCommandInput, + SimpleScalarPropertiesCommandOutput, +} from "../commands/SimpleScalarPropertiesCommand"; +import { + TimestampFormatHeadersCommandInput, + TimestampFormatHeadersCommandOutput, +} from "../commands/TimestampFormatHeadersCommand"; +import { XmlAttributesCommandInput, XmlAttributesCommandOutput } from "../commands/XmlAttributesCommand"; +import { + XmlAttributesOnPayloadCommandInput, + XmlAttributesOnPayloadCommandOutput, +} from "../commands/XmlAttributesOnPayloadCommand"; +import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "../commands/XmlEmptyMapsCommand"; +import { XmlEmptyStringsCommandInput, XmlEmptyStringsCommandOutput } from "../commands/XmlEmptyStringsCommand"; +import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; +import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; +import { XmlMapsCommandInput, XmlMapsCommandOutput } from "../commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "../commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; +import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; +import { XmlUnionsCommandInput, XmlUnionsCommandOutput } from "../commands/XmlUnionsCommand"; +import { + ComplexError, + ComplexNestedErrorData, + FooEnum, + GreetingStruct, + InvalidGreeting, + NestedPayload, + PayloadWithXmlName, + PayloadWithXmlNamespace, + PayloadWithXmlNamespaceAndPrefix, + RecursiveShapesInputOutputNested1, + RecursiveShapesInputOutputNested2, + StructureListMember, + XmlAttributesInputOutput, + XmlNamespaceNested, + XmlNestedUnionStruct, + XmlUnionShape, +} from "../models/models_0"; + +export const serializeAws_restXmlAllQueryStringTypesCommand = async ( + input: AllQueryStringTypesCommandInput, + 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 || ""}` + "/AllQueryStringTypesInput"; + const query: any = { + ...(input.queryParamsMapOfStrings !== undefined && input.queryParamsMapOfStrings), + ...(input.queryString !== undefined && { String: input.queryString }), + ...(input.queryStringList !== undefined && { + StringList: (input.queryStringList || []).map((_entry) => _entry as any), + }), + ...(input.queryStringSet !== undefined && { + StringSet: (Array.from(input.queryStringSet.values()) || []).map((_entry) => _entry as any), + }), + ...(input.queryByte !== undefined && { Byte: input.queryByte.toString() }), + ...(input.queryShort !== undefined && { Short: input.queryShort.toString() }), + ...(input.queryInteger !== undefined && { Integer: input.queryInteger.toString() }), + ...(input.queryIntegerList !== undefined && { + IntegerList: (input.queryIntegerList || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryIntegerSet !== undefined && { + IntegerSet: (Array.from(input.queryIntegerSet.values()) || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryLong !== undefined && { Long: input.queryLong.toString() }), + ...(input.queryFloat !== undefined && { + Float: input.queryFloat % 1 == 0 ? input.queryFloat + ".0" : input.queryFloat.toString(), + }), + ...(input.queryDouble !== undefined && { + Double: input.queryDouble % 1 == 0 ? input.queryDouble + ".0" : input.queryDouble.toString(), + }), + ...(input.queryDoubleList !== undefined && { + DoubleList: (input.queryDoubleList || []).map( + (_entry) => (_entry % 1 == 0 ? _entry + ".0" : _entry.toString()) as any + ), + }), + ...(input.queryBoolean !== undefined && { Boolean: input.queryBoolean.toString() }), + ...(input.queryBooleanList !== undefined && { + BooleanList: (input.queryBooleanList || []).map((_entry) => _entry.toString() as any), + }), + ...(input.queryTimestamp !== undefined && { + Timestamp: (input.queryTimestamp.toISOString().split(".")[0] + "Z").toString(), + }), + ...(input.queryTimestampList !== undefined && { + TimestampList: (input.queryTimestampList || []).map( + (_entry) => (_entry.toISOString().split(".")[0] + "Z").toString() as any + ), + }), + ...(input.queryEnum !== undefined && { Enum: input.queryEnum }), + ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry as any) }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restXmlBodyWithXmlNameCommand = async ( + input: BodyWithXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BodyWithXmlName"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("Ahoy"); + if (input.nested !== undefined) { + const node = serializeAws_restXmlPayloadWithXmlName(input.nested, context).withName("nested"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlConstantAndVariableQueryStringCommand = async ( + input: ConstantAndVariableQueryStringCommandInput, + 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 || ""}` + "/ConstantAndVariableQueryString"; + const query: any = { + foo: "bar", + ...(input.baz !== undefined && { baz: input.baz }), + ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restXmlConstantQueryStringCommand = async ( + input: ConstantQueryStringCommandInput, + 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 || ""}` + "/ConstantQueryString/{hello}"; + if (input.hello !== undefined) { + const labelValue: string = input.hello; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: hello."); + } + resolvedPath = resolvedPath.replace("{hello}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: hello."); + } + const query: any = { + foo: "bar", + hello: "", + }; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + query, + body, + }); +}; + +export const serializeAws_restXmlEmptyInputAndEmptyOutputCommand = async ( + input: EmptyInputAndEmptyOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EmptyInputAndEmptyOutput"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlEndpointOperationCommand = async ( + input: EndpointOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointOperation"; + let body: any; + body = ""; + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return new __HttpRequest({ + protocol, + hostname: resolvedHostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand = async ( + input: EndpointWithHostLabelHeaderOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.accountId) && { "x-amz-account-id": input.accountId! }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelHeaderOperation"; + let body: any; + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "{accountId}." + resolvedHostname; + if (input.accountId === undefined) { + throw new Error("Empty value provided for input host prefix: accountId."); + } + resolvedHostname = resolvedHostname.replace("{accountId}", input.accountId!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return new __HttpRequest({ + protocol, + hostname: resolvedHostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlEndpointWithHostLabelOperationCommand = async ( + input: EndpointWithHostLabelOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelOperation"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("HostLabelInput"); + if (input.label !== undefined) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.label)).withName("label"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "foo.{label}." + resolvedHostname; + if (input.label === undefined) { + throw new Error("Empty value provided for input host prefix: label."); + } + resolvedHostname = resolvedHostname.replace("{label}", input.label!); + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + return new __HttpRequest({ + protocol, + hostname: resolvedHostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlFlattenedXmlMapCommand = async ( + input: FlattenedXmlMapCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMap"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("FlattenedXmlMapInputOutput"); + if (input.myMap !== undefined) { + const nodes = serializeAws_restXmlFooEnumMap(input.myMap, context); + nodes.map((node: any) => { + node = node.withName("myMap"); + bodyNode.addChildNode(node); + }); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand = async ( + input: FlattenedXmlMapWithXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlName"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("FlattenedXmlMapWithXmlNameInputOutput"); + if (input.myMap !== undefined) { + const nodes = serializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap(input.myMap, context); + nodes.map((node: any) => { + node = node.withName("KVP"); + bodyNode.addChildNode(node); + }); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand = async ( + input: FlattenedXmlMapWithXmlNamespaceCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlNamespace"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlGreetingWithErrorsCommand = async ( + input: GreetingWithErrorsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GreetingWithErrors"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadTraitsCommand = async ( + input: HttpPayloadTraitsCommandInput, + 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 || ""}` + "/HttpPayloadTraits"; + let body: any; + if (input.blob !== undefined) { + body = input.blob; + } + let contents: any; + if (input.blob !== undefined) { + contents = input.blob; + body = contents; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( + input: HttpPayloadTraitsWithMediaTypeCommandInput, + 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 || ""}` + "/HttpPayloadTraitsWithMediaType"; + let body: any; + if (input.blob !== undefined) { + body = input.blob; + } + let contents: any; + if (input.blob !== undefined) { + contents = input.blob; + body = contents; + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand = async ( + input: HttpPayloadWithMemberXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithMemberXmlName"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); + } + let contents: any; + if (input.nested !== undefined) { + contents = serializeAws_restXmlPayloadWithXmlName(input.nested, context); + contents = contents.withName("Hola"); + body = ''; + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadWithStructureCommand = async ( + input: HttpPayloadWithStructureCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restXmlNestedPayload(input.nested, context); + } + let contents: any; + if (input.nested !== undefined) { + contents = serializeAws_restXmlNestedPayload(input.nested, context); + body = ''; + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadWithXmlNameCommand = async ( + input: HttpPayloadWithXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlName"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); + } + let contents: any; + if (input.nested !== undefined) { + contents = serializeAws_restXmlPayloadWithXmlName(input.nested, context); + body = ''; + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand = async ( + input: HttpPayloadWithXmlNamespaceCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespace"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restXmlPayloadWithXmlNamespace(input.nested, context); + } + let contents: any; + if (input.nested !== undefined) { + contents = serializeAws_restXmlPayloadWithXmlNamespace(input.nested, context); + body = ''; + contents.addAttribute("xmlns", "http://foo.com"); + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = async ( + input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespaceAndPrefix"; + let body: any; + if (input.nested !== undefined) { + body = serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(input.nested, context); + } + let contents: any; + if (input.nested !== undefined) { + contents = serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(input.nested, context); + body = ''; + contents.addAttribute("xmlns:baz", "http://foo.com"); + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpPrefixHeadersCommand = async ( + input: HttpPrefixHeadersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + ...(input.fooMap !== undefined && + Object.keys(input.fooMap).reduce( + (acc: any, suffix: string) => ({ + ...acc, + [`x-foo-${suffix.toLowerCase()}`]: input.fooMap![suffix], + }), + {} + )), + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpRequestWithFloatLabelsCommand = async ( + input: HttpRequestWithFloatLabelsCommandInput, + 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 || ""}` + "/FloatHttpLabels/{float}/{double}"; + if (input.float !== undefined) { + const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: float."); + } + resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: float."); + } + if (input.double !== undefined) { + const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: double."); + } + resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: double."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand = async ( + input: HttpRequestWithGreedyLabelInPathCommandInput, + 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 || ""}` + + "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; + if (input.foo !== undefined) { + const labelValue: string = input.foo; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: foo."); + } + resolvedPath = resolvedPath.replace("{foo}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: foo."); + } + if (input.baz !== undefined) { + const labelValue: string = input.baz; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: baz."); + } + resolvedPath = resolvedPath.replace( + "{baz+}", + labelValue + .split("/") + .map((segment) => __extendedEncodeURIComponent(segment)) + .join("/") + ); + } else { + throw new Error("No value provided for input HTTP label: baz."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpRequestWithLabelsCommand = async ( + input: HttpRequestWithLabelsCommandInput, + 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 || ""}` + + "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; + if (input.string !== undefined) { + const labelValue: string = input.string; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: string."); + } + resolvedPath = resolvedPath.replace("{string}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: string."); + } + if (input.short !== undefined) { + const labelValue: string = input.short.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: short."); + } + resolvedPath = resolvedPath.replace("{short}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: short."); + } + if (input.integer !== undefined) { + const labelValue: string = input.integer.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: integer."); + } + resolvedPath = resolvedPath.replace("{integer}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: integer."); + } + if (input.long !== undefined) { + const labelValue: string = input.long.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: long."); + } + resolvedPath = resolvedPath.replace("{long}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: long."); + } + if (input.float !== undefined) { + const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: float."); + } + resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: float."); + } + if (input.double !== undefined) { + const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: double."); + } + resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: double."); + } + if (input.boolean !== undefined) { + const labelValue: string = input.boolean.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: boolean."); + } + resolvedPath = resolvedPath.replace("{boolean}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: boolean."); + } + 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: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand = async ( + input: HttpRequestWithLabelsAndTimestampFormatCommandInput, + 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 || ""}` + + "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; + if (input.memberEpochSeconds !== undefined) { + const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberEpochSeconds."); + } + resolvedPath = resolvedPath.replace("{memberEpochSeconds}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberEpochSeconds."); + } + if (input.memberHttpDate !== undefined) { + const labelValue: string = __dateToUtcString(input.memberHttpDate).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberHttpDate."); + } + resolvedPath = resolvedPath.replace("{memberHttpDate}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberHttpDate."); + } + if (input.memberDateTime !== undefined) { + const labelValue: string = (input.memberDateTime.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: memberDateTime."); + } + resolvedPath = resolvedPath.replace("{memberDateTime}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: memberDateTime."); + } + if (input.defaultFormat !== undefined) { + const labelValue: string = (input.defaultFormat.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: defaultFormat."); + } + resolvedPath = resolvedPath.replace("{defaultFormat}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: defaultFormat."); + } + if (input.targetEpochSeconds !== undefined) { + const labelValue: string = Math.round(input.targetEpochSeconds.getTime() / 1000).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetEpochSeconds."); + } + resolvedPath = resolvedPath.replace("{targetEpochSeconds}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetEpochSeconds."); + } + if (input.targetHttpDate !== undefined) { + const labelValue: string = __dateToUtcString(input.targetHttpDate).toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetHttpDate."); + } + resolvedPath = resolvedPath.replace("{targetHttpDate}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetHttpDate."); + } + if (input.targetDateTime !== undefined) { + const labelValue: string = (input.targetDateTime.toISOString().split(".")[0] + "Z").toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: targetDateTime."); + } + resolvedPath = resolvedPath.replace("{targetDateTime}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: targetDateTime."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlHttpResponseCodeCommand = async ( + input: HttpResponseCodeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpResponseCode"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlIgnoreQueryParamsInResponseCommand = async ( + input: IgnoreQueryParamsInResponseCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/IgnoreQueryParamsInResponse"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlInputAndOutputWithHeadersCommand = async ( + input: InputAndOutputWithHeadersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), + ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), + ...(isSerializableHeaderValue(input.headerShort) && { "x-short": input.headerShort!.toString() }), + ...(isSerializableHeaderValue(input.headerInteger) && { "x-integer": input.headerInteger!.toString() }), + ...(isSerializableHeaderValue(input.headerLong) && { "x-long": input.headerLong!.toString() }), + ...(isSerializableHeaderValue(input.headerFloat) && { + "x-float": input.headerFloat! % 1 == 0 ? input.headerFloat! + ".0" : input.headerFloat!.toString(), + }), + ...(isSerializableHeaderValue(input.headerDouble) && { + "x-double": input.headerDouble! % 1 == 0 ? input.headerDouble! + ".0" : input.headerDouble!.toString(), + }), + ...(isSerializableHeaderValue(input.headerTrueBool) && { "x-boolean1": input.headerTrueBool!.toString() }), + ...(isSerializableHeaderValue(input.headerFalseBool) && { "x-boolean2": input.headerFalseBool!.toString() }), + ...(isSerializableHeaderValue(input.headerStringList) && { + "x-stringlist": (input.headerStringList! || []).map((_entry) => _entry as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerStringSet) && { + "x-stringset": (Array.from(input.headerStringSet!.values()) || []).map((_entry) => _entry as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerIntegerList) && { + "x-integerlist": (input.headerIntegerList! || []).map((_entry) => _entry.toString() as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerBooleanList) && { + "x-booleanlist": (input.headerBooleanList! || []).map((_entry) => _entry.toString() as any).join(", "), + }), + ...(isSerializableHeaderValue(input.headerTimestampList) && { + "x-timestamplist": (input.headerTimestampList! || []) + .map((_entry) => __dateToUtcString(_entry).toString() as any) + .join(", "), + }), + ...(isSerializableHeaderValue(input.headerEnum) && { "x-enum": input.headerEnum! }), + ...(isSerializableHeaderValue(input.headerEnumList) && { + "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry as any).join(", "), + }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlNestedXmlMapsCommand = async ( + input: NestedXmlMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NestedXmlMaps"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("NestedXmlMapsInputOutput"); + if (input.flatNestedMap !== undefined) { + const nodes = serializeAws_restXmlNestedMap(input.flatNestedMap, context); + nodes.map((node: any) => { + node = node.withName("flatNestedMap"); + bodyNode.addChildNode(node); + }); + } + if (input.nestedMap !== undefined) { + const nodes = serializeAws_restXmlNestedMap(input.nestedMap, context); + const containerNode = new __XmlNode("nestedMap"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlNoInputAndNoOutputCommand = async ( + input: NoInputAndNoOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + 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_restXmlNoInputAndOutputCommand = async ( + input: NoInputAndOutputCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + 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_restXmlNullAndEmptyHeadersClientCommand = 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_restXmlNullAndEmptyHeadersServerCommand = 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_restXmlOmitsNullSerializesEmptyStringCommand = 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_restXmlQueryIdempotencyTokenAutoFillCommand = 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_restXmlQueryParamsAsStringListMapCommand = 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_restXmlQueryPrecedenceCommand = 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_restXmlRecursiveShapesCommand = async ( + input: RecursiveShapesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("RecursiveShapesInputOutput"); + if (input.nested !== undefined) { + const node = serializeAws_restXmlRecursiveShapesInputOutputNested1(input.nested, context).withName("nested"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlSimpleScalarPropertiesCommand = async ( + input: SimpleScalarPropertiesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("SimpleScalarPropertiesInputOutput"); + if (input.byteValue !== undefined) { + const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(input.byteValue))).withName("byteValue"); + bodyNode.addChildNode(node); + } + if (input.doubleValue !== undefined) { + const node = new __XmlNode("Double") + .addChildNode(new __XmlText(String(input.doubleValue))) + .withName("DoubleDribble"); + bodyNode.addChildNode(node); + } + if (input.falseBooleanValue !== undefined) { + const node = new __XmlNode("Boolean") + .addChildNode(new __XmlText(String(input.falseBooleanValue))) + .withName("falseBooleanValue"); + bodyNode.addChildNode(node); + } + if (input.floatValue !== undefined) { + const node = new __XmlNode("Float").addChildNode(new __XmlText(String(input.floatValue))).withName("floatValue"); + bodyNode.addChildNode(node); + } + if (input.integerValue !== undefined) { + const node = new __XmlNode("Integer") + .addChildNode(new __XmlText(String(input.integerValue))) + .withName("integerValue"); + bodyNode.addChildNode(node); + } + if (input.longValue !== undefined) { + const node = new __XmlNode("Long").addChildNode(new __XmlText(String(input.longValue))).withName("longValue"); + bodyNode.addChildNode(node); + } + if (input.shortValue !== undefined) { + const node = new __XmlNode("Short").addChildNode(new __XmlText(String(input.shortValue))).withName("shortValue"); + bodyNode.addChildNode(node); + } + if (input.stringValue !== undefined) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.stringValue)).withName("stringValue"); + bodyNode.addChildNode(node); + } + if (input.trueBooleanValue !== undefined) { + const node = new __XmlNode("Boolean") + .addChildNode(new __XmlText(String(input.trueBooleanValue))) + .withName("trueBooleanValue"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlTimestampFormatHeadersCommand = 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 serializeAws_restXmlXmlAttributesCommand = async ( + input: XmlAttributesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributes"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlAttributesInputOutput"); + if (input.attr !== undefined) { + bodyNode.addAttribute("test", input.attr); + } + if (input.foo !== undefined) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlAttributesOnPayloadCommand = async ( + input: XmlAttributesOnPayloadCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributesOnPayload"; + let body: any; + if (input.payload !== undefined) { + body = serializeAws_restXmlXmlAttributesInputOutput(input.payload, context); + } + let contents: any; + if (input.payload !== undefined) { + contents = serializeAws_restXmlXmlAttributesInputOutput(input.payload, context); + body = ''; + body += contents.toString(); + } + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlBlobsCommand = async ( + input: XmlBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlBlobs"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlBlobsInputOutput"); + if (input.data !== undefined) { + const node = new __XmlNode("Blob").addChildNode(new __XmlText(context.base64Encoder(input.data))).withName("data"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlEmptyBlobsCommand = async ( + input: XmlEmptyBlobsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyBlobs"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlBlobsInputOutput"); + if (input.data !== undefined) { + const node = new __XmlNode("Blob").addChildNode(new __XmlText(context.base64Encoder(input.data))).withName("data"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlEmptyListsCommand = async ( + input: XmlEmptyListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyLists"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlListsInputOutput"); + if (input.booleanList !== undefined) { + const nodes = serializeAws_restXmlBooleanList(input.booleanList, context); + const containerNode = new __XmlNode("booleanList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.enumList !== undefined) { + const nodes = serializeAws_restXmlFooEnumList(input.enumList, context); + const containerNode = new __XmlNode("enumList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.flattenedList !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList, context); + nodes.map((node: any) => { + node = node.withName("flattenedList"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedList2 !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList2, context); + nodes.map((node: any) => { + node = node.withName("customName"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedListWithMemberNamespace !== undefined) { + const nodes = serializeAws_restXmlListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); + nodes.map((node: any) => { + node = node.withName("flattenedListWithMemberNamespace"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedListWithNamespace !== undefined) { + const nodes = serializeAws_restXmlListWithNamespace(input.flattenedListWithNamespace, context); + nodes.map((node: any) => { + node = node.withName("flattenedListWithNamespace"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedStructureList !== undefined) { + const nodes = serializeAws_restXmlStructureList(input.flattenedStructureList, context); + nodes.map((node: any) => { + node = node.withName("flattenedStructureList"); + bodyNode.addChildNode(node); + }); + } + if (input.integerList !== undefined) { + const nodes = serializeAws_restXmlIntegerList(input.integerList, context); + const containerNode = new __XmlNode("integerList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.nestedStringList !== undefined) { + const nodes = serializeAws_restXmlNestedStringList(input.nestedStringList, context); + const containerNode = new __XmlNode("nestedStringList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.renamedListMembers !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.renamedListMembers, context); + const containerNode = new __XmlNode("renamed"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.stringList !== undefined) { + const nodes = serializeAws_restXmlStringList(input.stringList, context); + const containerNode = new __XmlNode("stringList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.stringSet !== undefined) { + const nodes = serializeAws_restXmlStringSet(input.stringSet, context); + const containerNode = new __XmlNode("stringSet"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.structureList !== undefined) { + const nodes = serializeAws_restXmlStructureList(input.structureList, context); + const containerNode = new __XmlNode("myStructureList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.timestampList !== undefined) { + const nodes = serializeAws_restXmlTimestampList(input.timestampList, context); + const containerNode = new __XmlNode("timestampList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlEmptyMapsCommand = async ( + input: XmlEmptyMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyMaps"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlMapsInputOutput"); + if (input.myMap !== undefined) { + const nodes = serializeAws_restXmlXmlMapsInputOutputMap(input.myMap, context); + const containerNode = new __XmlNode("myMap"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlEmptyStringsCommand = async ( + input: XmlEmptyStringsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyStrings"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlEmptyStringsInputOutput"); + if (input.emptyString !== undefined) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.emptyString)).withName("emptyString"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlEnumsCommand = async ( + input: XmlEnumsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEnums"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlEnumsInputOutput"); + if (input.fooEnum1 !== undefined) { + const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum1)).withName("fooEnum1"); + bodyNode.addChildNode(node); + } + if (input.fooEnum2 !== undefined) { + const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum2)).withName("fooEnum2"); + bodyNode.addChildNode(node); + } + if (input.fooEnum3 !== undefined) { + const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum3)).withName("fooEnum3"); + bodyNode.addChildNode(node); + } + if (input.fooEnumList !== undefined) { + const nodes = serializeAws_restXmlFooEnumList(input.fooEnumList, context); + const containerNode = new __XmlNode("fooEnumList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.fooEnumMap !== undefined) { + const nodes = serializeAws_restXmlFooEnumMap(input.fooEnumMap, context); + const containerNode = new __XmlNode("fooEnumMap"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.fooEnumSet !== undefined) { + const nodes = serializeAws_restXmlFooEnumSet(input.fooEnumSet, context); + const containerNode = new __XmlNode("fooEnumSet"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlListsCommand = async ( + input: XmlListsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlLists"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlListsInputOutput"); + if (input.booleanList !== undefined) { + const nodes = serializeAws_restXmlBooleanList(input.booleanList, context); + const containerNode = new __XmlNode("booleanList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.enumList !== undefined) { + const nodes = serializeAws_restXmlFooEnumList(input.enumList, context); + const containerNode = new __XmlNode("enumList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.flattenedList !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList, context); + nodes.map((node: any) => { + node = node.withName("flattenedList"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedList2 !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList2, context); + nodes.map((node: any) => { + node = node.withName("customName"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedListWithMemberNamespace !== undefined) { + const nodes = serializeAws_restXmlListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); + nodes.map((node: any) => { + node = node.withName("flattenedListWithMemberNamespace"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedListWithNamespace !== undefined) { + const nodes = serializeAws_restXmlListWithNamespace(input.flattenedListWithNamespace, context); + nodes.map((node: any) => { + node = node.withName("flattenedListWithNamespace"); + bodyNode.addChildNode(node); + }); + } + if (input.flattenedStructureList !== undefined) { + const nodes = serializeAws_restXmlStructureList(input.flattenedStructureList, context); + nodes.map((node: any) => { + node = node.withName("flattenedStructureList"); + bodyNode.addChildNode(node); + }); + } + if (input.integerList !== undefined) { + const nodes = serializeAws_restXmlIntegerList(input.integerList, context); + const containerNode = new __XmlNode("integerList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.nestedStringList !== undefined) { + const nodes = serializeAws_restXmlNestedStringList(input.nestedStringList, context); + const containerNode = new __XmlNode("nestedStringList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.renamedListMembers !== undefined) { + const nodes = serializeAws_restXmlRenamedListMembers(input.renamedListMembers, context); + const containerNode = new __XmlNode("renamed"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.stringList !== undefined) { + const nodes = serializeAws_restXmlStringList(input.stringList, context); + const containerNode = new __XmlNode("stringList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.stringSet !== undefined) { + const nodes = serializeAws_restXmlStringSet(input.stringSet, context); + const containerNode = new __XmlNode("stringSet"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.structureList !== undefined) { + const nodes = serializeAws_restXmlStructureList(input.structureList, context); + const containerNode = new __XmlNode("myStructureList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + if (input.timestampList !== undefined) { + const nodes = serializeAws_restXmlTimestampList(input.timestampList, context); + const containerNode = new __XmlNode("timestampList"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlMapsCommand = async ( + input: XmlMapsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMaps"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlMapsInputOutput"); + if (input.myMap !== undefined) { + const nodes = serializeAws_restXmlXmlMapsInputOutputMap(input.myMap, context); + const containerNode = new __XmlNode("myMap"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlMapsXmlNameCommand = async ( + input: XmlMapsXmlNameCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMapsXmlName"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlMapsXmlNameInputOutput"); + if (input.myMap !== undefined) { + const nodes = serializeAws_restXmlXmlMapsXmlNameInputOutputMap(input.myMap, context); + const containerNode = new __XmlNode("myMap"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlNamespacesCommand = async ( + input: XmlNamespacesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlNamespaces"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlNamespacesInputOutput"); + bodyNode.addAttribute("xmlns", "http://foo.com"); + if (input.nested !== undefined) { + const node = serializeAws_restXmlXmlNamespaceNested(input.nested, context).withName("nested"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlTimestampsCommand = async ( + input: XmlTimestampsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlTimestamps"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlTimestampsInputOutput"); + if (input.dateTime !== undefined) { + const node = new __XmlNode("Timestamp") + .addChildNode(new __XmlText((input.dateTime.toISOString().split(".")[0] + "Z").toString())) + .withName("dateTime"); + bodyNode.addChildNode(node); + } + if (input.epochSeconds !== undefined) { + const node = new __XmlNode("Timestamp") + .addChildNode(new __XmlText(Math.round(input.epochSeconds.getTime() / 1000).toString())) + .withName("epochSeconds"); + bodyNode.addChildNode(node); + } + if (input.httpDate !== undefined) { + const node = new __XmlNode("Timestamp") + .addChildNode(new __XmlText(__dateToUtcString(input.httpDate).toString())) + .withName("httpDate"); + bodyNode.addChildNode(node); + } + if (input.normal !== undefined) { + const node = new __XmlNode("Timestamp") + .addChildNode(new __XmlText(input.normal.toISOString().split(".")[0] + "Z")) + .withName("normal"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restXmlXmlUnionsCommand = async ( + input: XmlUnionsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/xml", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlUnions"; + let body: any; + body = ''; + const bodyNode = new __XmlNode("XmlUnionsInputOutput"); + if (input.unionValue !== undefined) { + const node = serializeAws_restXmlXmlUnionShape(input.unionValue, context).withName("unionValue"); + bodyNode.addChildNode(node); + } + body += bodyNode.toString(); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "PUT", + headers, + path: resolvedPath, + body, + }); +}; + +export const deserializeAws_restXmlAllQueryStringTypesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlAllQueryStringTypesCommandError(output, context); + } + const contents: AllQueryStringTypesCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlAllQueryStringTypesCommandError = 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 = loadRestXmlErrorCode(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_restXmlBodyWithXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlBodyWithXmlNameCommandError(output, context); + } + const contents: BodyWithXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["nested"] !== undefined) { + contents.nested = deserializeAws_restXmlPayloadWithXmlName(data["nested"], context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlBodyWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlConstantAndVariableQueryStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlConstantAndVariableQueryStringCommandError(output, context); + } + const contents: ConstantAndVariableQueryStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlConstantAndVariableQueryStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlConstantQueryStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlConstantQueryStringCommandError(output, context); + } + const contents: ConstantQueryStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlConstantQueryStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlEmptyInputAndEmptyOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlEmptyInputAndEmptyOutputCommandError(output, context); + } + const contents: EmptyInputAndEmptyOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlEmptyInputAndEmptyOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlEndpointOperationCommandError(output, context); + } + const contents: EndpointOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlEndpointOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointWithHostLabelHeaderOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommandError(output, context); + } + const contents: EndpointWithHostLabelHeaderOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointWithHostLabelOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlEndpointWithHostLabelOperationCommandError(output, context); + } + const contents: EndpointWithHostLabelOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlEndpointWithHostLabelOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlFlattenedXmlMapCommandError(output, context); + } + const contents: FlattenedXmlMapCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.myMap === "") { + contents.myMap = {}; + } + if (data["myMap"] !== undefined) { + contents.myMap = deserializeAws_restXmlFooEnumMap(__getArrayIfSingleItem(data["myMap"]), context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlFlattenedXmlMapCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapWithXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommandError(output, context); + } + const contents: FlattenedXmlMapWithXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.KVP === "") { + contents.myMap = {}; + } + if (data["KVP"] !== undefined) { + contents.myMap = deserializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap( + __getArrayIfSingleItem(data["KVP"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapWithXmlNamespaceCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommandError(output, context); + } + const contents: FlattenedXmlMapWithXmlNamespaceCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.KVP === "") { + contents.myMap = {}; + } + if (data["KVP"] !== undefined) { + contents.myMap = deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceOutputMap( + __getArrayIfSingleItem(data["KVP"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommandError = 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 = loadRestXmlErrorCode(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_restXmlGreetingWithErrorsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlGreetingWithErrorsCommandError(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_restXmlGreetingWithErrorsCommandError = 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 = loadRestXmlErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "ComplexError": + case "aws.protocoltests.restxml#ComplexError": + response = { + ...(await deserializeAws_restXmlComplexErrorResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + case "InvalidGreeting": + case "aws.protocoltests.restxml#InvalidGreeting": + response = { + ...(await deserializeAws_restXmlInvalidGreetingResponse(parsedOutput, context)), + name: errorCode, + $metadata: deserializeMetadata(output), + }; + break; + 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_restXmlHttpPayloadTraitsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadTraitsCommandError(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_restXmlHttpPayloadTraitsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommandError(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_restXmlHttpPayloadTraitsWithMediaTypeCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithMemberXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommandError(output, context); + } + const contents: HttpPayloadWithMemberXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.nested = deserializeAws_restXmlPayloadWithXmlName(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithStructureCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadWithStructureCommandError(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_restXmlNestedPayload(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpPayloadWithStructureCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadWithXmlNameCommandError(output, context); + } + const contents: HttpPayloadWithXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.nested = deserializeAws_restXmlPayloadWithXmlName(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpPayloadWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNamespaceCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommandError(output, context); + } + const contents: HttpPayloadWithXmlNamespaceCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.nested = deserializeAws_restXmlPayloadWithXmlNamespace(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommandError(output, context); + } + const contents: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.nested = deserializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPrefixHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpPrefixHeadersCommandError(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_restXmlHttpPrefixHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithFloatLabelsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpRequestWithFloatLabelsCommandError(output, context); + } + const contents: HttpRequestWithFloatLabelsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpRequestWithFloatLabelsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithGreedyLabelInPathCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommandError(output, context); + } + const contents: HttpRequestWithGreedyLabelInPathCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithLabelsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpRequestWithLabelsCommandError(output, context); + } + const contents: HttpRequestWithLabelsCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpRequestWithLabelsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithLabelsAndTimestampFormatCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommandError(output, context); + } + const contents: HttpRequestWithLabelsAndTimestampFormatCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpResponseCodeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlHttpResponseCodeCommandError(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_restXmlHttpResponseCodeCommandError = 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 = loadRestXmlErrorCode(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_restXmlIgnoreQueryParamsInResponseCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlIgnoreQueryParamsInResponseCommandError(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) { + contents.baz = __expectString(data["baz"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlIgnoreQueryParamsInResponseCommandError = 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 = loadRestXmlErrorCode(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_restXmlInputAndOutputWithHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlInputAndOutputWithHeadersCommandError(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_restXmlInputAndOutputWithHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlNestedXmlMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlNestedXmlMapsCommandError(output, context); + } + const contents: NestedXmlMapsCommandOutput = { + $metadata: deserializeMetadata(output), + flatNestedMap: undefined, + nestedMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.flatNestedMap === "") { + contents.flatNestedMap = {}; + } + if (data["flatNestedMap"] !== undefined) { + contents.flatNestedMap = deserializeAws_restXmlNestedMap(__getArrayIfSingleItem(data["flatNestedMap"]), context); + } + if (data.nestedMap === "") { + contents.nestedMap = {}; + } + if (data["nestedMap"] !== undefined && data["nestedMap"]["entry"] !== undefined) { + contents.nestedMap = deserializeAws_restXmlNestedMap(__getArrayIfSingleItem(data["nestedMap"]["entry"]), context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlNestedXmlMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlNoInputAndNoOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlNoInputAndNoOutputCommandError(output, context); + } + const contents: NoInputAndNoOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlNoInputAndNoOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlNoInputAndOutputCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlNoInputAndOutputCommandError(output, context); + } + const contents: NoInputAndOutputCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlNoInputAndOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlNullAndEmptyHeadersClientCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlNullAndEmptyHeadersClientCommandError(output, context); + } + const contents: NullAndEmptyHeadersClientCommandOutput = { + $metadata: deserializeMetadata(output), + a: undefined, + b: undefined, + c: undefined, + }; + if (output.headers["x-a"] !== undefined) { + contents.a = output.headers["x-a"]; + } + if (output.headers["x-b"] !== undefined) { + contents.b = output.headers["x-b"]; + } + if (output.headers["x-c"] !== undefined) { + contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlNullAndEmptyHeadersClientCommandError = 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 = loadRestXmlErrorCode(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_restXmlNullAndEmptyHeadersServerCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlNullAndEmptyHeadersServerCommandError(output, context); + } + const contents: NullAndEmptyHeadersServerCommandOutput = { + $metadata: deserializeMetadata(output), + a: undefined, + b: undefined, + c: undefined, + }; + if (output.headers["x-a"] !== undefined) { + contents.a = output.headers["x-a"]; + } + if (output.headers["x-b"] !== undefined) { + contents.b = output.headers["x-b"]; + } + if (output.headers["x-c"] !== undefined) { + contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlNullAndEmptyHeadersServerCommandError = 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 = loadRestXmlErrorCode(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_restXmlOmitsNullSerializesEmptyStringCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlOmitsNullSerializesEmptyStringCommandError(output, context); + } + const contents: OmitsNullSerializesEmptyStringCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlOmitsNullSerializesEmptyStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryIdempotencyTokenAutoFillCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommandError(output, context); + } + const contents: QueryIdempotencyTokenAutoFillCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryParamsAsStringListMapCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlQueryParamsAsStringListMapCommandError(output, context); + } + const contents: QueryParamsAsStringListMapCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlQueryParamsAsStringListMapCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryPrecedenceCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlQueryPrecedenceCommandError(output, context); + } + const contents: QueryPrecedenceCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlQueryPrecedenceCommandError = 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 = loadRestXmlErrorCode(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_restXmlRecursiveShapesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlRecursiveShapesCommandError(output, context); + } + const contents: RecursiveShapesCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["nested"] !== undefined) { + contents.nested = deserializeAws_restXmlRecursiveShapesInputOutputNested1(data["nested"], context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlRecursiveShapesCommandError = 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 = loadRestXmlErrorCode(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_restXmlSimpleScalarPropertiesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlSimpleScalarPropertiesCommandError(output, context); + } + const contents: SimpleScalarPropertiesCommandOutput = { + $metadata: deserializeMetadata(output), + byteValue: undefined, + doubleValue: undefined, + falseBooleanValue: undefined, + floatValue: undefined, + foo: undefined, + integerValue: undefined, + longValue: undefined, + shortValue: undefined, + stringValue: undefined, + trueBooleanValue: undefined, + }; + if (output.headers["x-foo"] !== undefined) { + contents.foo = output.headers["x-foo"]; + } + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["byteValue"] !== undefined) { + contents.byteValue = __strictParseByte(data["byteValue"]) as number; + } + if (data["DoubleDribble"] !== undefined) { + contents.doubleValue = __strictParseFloat(data["DoubleDribble"]) as number; + } + if (data["falseBooleanValue"] !== undefined) { + contents.falseBooleanValue = __parseBoolean(data["falseBooleanValue"]); + } + if (data["floatValue"] !== undefined) { + contents.floatValue = __strictParseFloat(data["floatValue"]) as number; + } + if (data["integerValue"] !== undefined) { + contents.integerValue = __strictParseInt32(data["integerValue"]) as number; + } + if (data["longValue"] !== undefined) { + contents.longValue = __strictParseLong(data["longValue"]) as number; + } + if (data["shortValue"] !== undefined) { + contents.shortValue = __strictParseShort(data["shortValue"]) as number; + } + if (data["stringValue"] !== undefined) { + contents.stringValue = __expectString(data["stringValue"]); + } + if (data["trueBooleanValue"] !== undefined) { + contents.trueBooleanValue = __parseBoolean(data["trueBooleanValue"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlSimpleScalarPropertiesCommandError = 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 = loadRestXmlErrorCode(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_restXmlTimestampFormatHeadersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlTimestampFormatHeadersCommandError(output, context); + } + const contents: TimestampFormatHeadersCommandOutput = { + $metadata: deserializeMetadata(output), + defaultFormat: undefined, + memberDateTime: undefined, + memberEpochSeconds: undefined, + memberHttpDate: undefined, + targetDateTime: undefined, + targetEpochSeconds: undefined, + targetHttpDate: undefined, + }; + if (output.headers["x-memberepochseconds"] !== undefined) { + contents.memberEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-memberepochseconds"])); + } + if (output.headers["x-memberhttpdate"] !== undefined) { + contents.memberHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-memberhttpdate"])); + } + if (output.headers["x-memberdatetime"] !== undefined) { + contents.memberDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-memberdatetime"])); + } + if (output.headers["x-defaultformat"] !== undefined) { + contents.defaultFormat = __expectNonNull(__parseRfc7231DateTime(output.headers["x-defaultformat"])); + } + if (output.headers["x-targetepochseconds"] !== undefined) { + contents.targetEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-targetepochseconds"])); + } + if (output.headers["x-targethttpdate"] !== undefined) { + contents.targetHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-targethttpdate"])); + } + if (output.headers["x-targetdatetime"] !== undefined) { + contents.targetDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-targetdatetime"])); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlTimestampFormatHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlAttributesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlAttributesCommandError(output, context); + } + const contents: XmlAttributesCommandOutput = { + $metadata: deserializeMetadata(output), + attr: undefined, + foo: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["test"] !== undefined) { + contents.attr = __expectString(data["test"]); + } + if (data["foo"] !== undefined) { + contents.foo = __expectString(data["foo"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlAttributesCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlAttributesOnPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlAttributesOnPayloadCommandError(output, context); + } + const contents: XmlAttributesOnPayloadCommandOutput = { + $metadata: deserializeMetadata(output), + payload: undefined, + }; + const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); + contents.payload = deserializeAws_restXmlXmlAttributesInputOutput(data, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlAttributesOnPayloadCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlBlobsCommandError(output, context); + } + const contents: XmlBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + data: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["data"] !== undefined) { + contents.data = context.base64Decoder(data["data"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlBlobsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyBlobsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlEmptyBlobsCommandError(output, context); + } + const contents: XmlEmptyBlobsCommandOutput = { + $metadata: deserializeMetadata(output), + data: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["data"] !== undefined) { + contents.data = context.base64Decoder(data["data"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlEmptyBlobsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlEmptyListsCommandError(output, context); + } + const contents: XmlEmptyListsCommandOutput = { + $metadata: deserializeMetadata(output), + booleanList: undefined, + enumList: undefined, + flattenedList: undefined, + flattenedList2: undefined, + flattenedListWithMemberNamespace: undefined, + flattenedListWithNamespace: undefined, + flattenedStructureList: undefined, + integerList: undefined, + nestedStringList: undefined, + renamedListMembers: 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 === "") { + contents.booleanList = []; + } + if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { + contents.booleanList = deserializeAws_restXmlBooleanList( + __getArrayIfSingleItem(data["booleanList"]["member"]), + context + ); + } + if (data.enumList === "") { + contents.enumList = []; + } + if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { + contents.enumList = deserializeAws_restXmlFooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); + } + if (data.flattenedList === "") { + contents.flattenedList = []; + } + if (data["flattenedList"] !== undefined) { + contents.flattenedList = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["flattenedList"]), + context + ); + } + if (data.customName === "") { + contents.flattenedList2 = []; + } + if (data["customName"] !== undefined) { + contents.flattenedList2 = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["customName"]), + context + ); + } + if (data.flattenedListWithMemberNamespace === "") { + contents.flattenedListWithMemberNamespace = []; + } + if (data["flattenedListWithMemberNamespace"] !== undefined) { + contents.flattenedListWithMemberNamespace = deserializeAws_restXmlListWithMemberNamespace( + __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), + context + ); + } + if (data.flattenedListWithNamespace === "") { + contents.flattenedListWithNamespace = []; + } + if (data["flattenedListWithNamespace"] !== undefined) { + contents.flattenedListWithNamespace = deserializeAws_restXmlListWithNamespace( + __getArrayIfSingleItem(data["flattenedListWithNamespace"]), + context + ); + } + if (data.flattenedStructureList === "") { + contents.flattenedStructureList = []; + } + if (data["flattenedStructureList"] !== undefined) { + contents.flattenedStructureList = deserializeAws_restXmlStructureList( + __getArrayIfSingleItem(data["flattenedStructureList"]), + context + ); + } + if (data.integerList === "") { + contents.integerList = []; + } + if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { + contents.integerList = deserializeAws_restXmlIntegerList( + __getArrayIfSingleItem(data["integerList"]["member"]), + context + ); + } + if (data.nestedStringList === "") { + contents.nestedStringList = []; + } + if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { + contents.nestedStringList = deserializeAws_restXmlNestedStringList( + __getArrayIfSingleItem(data["nestedStringList"]["member"]), + context + ); + } + if (data.renamed === "") { + contents.renamedListMembers = []; + } + if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { + contents.renamedListMembers = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["renamed"]["item"]), + context + ); + } + if (data.stringList === "") { + contents.stringList = []; + } + if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { + contents.stringList = deserializeAws_restXmlStringList( + __getArrayIfSingleItem(data["stringList"]["member"]), + context + ); + } + if (data.stringSet === "") { + contents.stringSet = []; + } + if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { + contents.stringSet = deserializeAws_restXmlStringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); + } + if (data.myStructureList === "") { + contents.structureList = []; + } + if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { + contents.structureList = deserializeAws_restXmlStructureList( + __getArrayIfSingleItem(data["myStructureList"]["item"]), + context + ); + } + if (data.timestampList === "") { + contents.timestampList = []; + } + if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { + contents.timestampList = deserializeAws_restXmlTimestampList( + __getArrayIfSingleItem(data["timestampList"]["member"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlEmptyListsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlEmptyMapsCommandError(output, context); + } + const contents: XmlEmptyMapsCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.myMap === "") { + contents.myMap = {}; + } + if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { + contents.myMap = deserializeAws_restXmlXmlMapsInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlEmptyMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyStringsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlEmptyStringsCommandError(output, context); + } + const contents: XmlEmptyStringsCommandOutput = { + $metadata: deserializeMetadata(output), + emptyString: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["emptyString"] !== undefined) { + contents.emptyString = __expectString(data["emptyString"]); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlEmptyStringsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEnumsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlEnumsCommandError(output, context); + } + const contents: XmlEnumsCommandOutput = { + $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) { + contents.fooEnum1 = __expectString(data["fooEnum1"]); + } + if (data["fooEnum2"] !== undefined) { + contents.fooEnum2 = __expectString(data["fooEnum2"]); + } + if (data["fooEnum3"] !== undefined) { + contents.fooEnum3 = __expectString(data["fooEnum3"]); + } + if (data.fooEnumList === "") { + contents.fooEnumList = []; + } + if (data["fooEnumList"] !== undefined && data["fooEnumList"]["member"] !== undefined) { + contents.fooEnumList = deserializeAws_restXmlFooEnumList( + __getArrayIfSingleItem(data["fooEnumList"]["member"]), + context + ); + } + if (data.fooEnumMap === "") { + contents.fooEnumMap = {}; + } + if (data["fooEnumMap"] !== undefined && data["fooEnumMap"]["entry"] !== undefined) { + contents.fooEnumMap = deserializeAws_restXmlFooEnumMap( + __getArrayIfSingleItem(data["fooEnumMap"]["entry"]), + context + ); + } + if (data.fooEnumSet === "") { + contents.fooEnumSet = []; + } + if (data["fooEnumSet"] !== undefined && data["fooEnumSet"]["member"] !== undefined) { + contents.fooEnumSet = deserializeAws_restXmlFooEnumSet( + __getArrayIfSingleItem(data["fooEnumSet"]["member"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlEnumsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlListsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlListsCommandError(output, context); + } + const contents: XmlListsCommandOutput = { + $metadata: deserializeMetadata(output), + booleanList: undefined, + enumList: undefined, + flattenedList: undefined, + flattenedList2: undefined, + flattenedListWithMemberNamespace: undefined, + flattenedListWithNamespace: undefined, + flattenedStructureList: undefined, + integerList: undefined, + nestedStringList: undefined, + renamedListMembers: 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 === "") { + contents.booleanList = []; + } + if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { + contents.booleanList = deserializeAws_restXmlBooleanList( + __getArrayIfSingleItem(data["booleanList"]["member"]), + context + ); + } + if (data.enumList === "") { + contents.enumList = []; + } + if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { + contents.enumList = deserializeAws_restXmlFooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); + } + if (data.flattenedList === "") { + contents.flattenedList = []; + } + if (data["flattenedList"] !== undefined) { + contents.flattenedList = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["flattenedList"]), + context + ); + } + if (data.customName === "") { + contents.flattenedList2 = []; + } + if (data["customName"] !== undefined) { + contents.flattenedList2 = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["customName"]), + context + ); + } + if (data.flattenedListWithMemberNamespace === "") { + contents.flattenedListWithMemberNamespace = []; + } + if (data["flattenedListWithMemberNamespace"] !== undefined) { + contents.flattenedListWithMemberNamespace = deserializeAws_restXmlListWithMemberNamespace( + __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), + context + ); + } + if (data.flattenedListWithNamespace === "") { + contents.flattenedListWithNamespace = []; + } + if (data["flattenedListWithNamespace"] !== undefined) { + contents.flattenedListWithNamespace = deserializeAws_restXmlListWithNamespace( + __getArrayIfSingleItem(data["flattenedListWithNamespace"]), + context + ); + } + if (data.flattenedStructureList === "") { + contents.flattenedStructureList = []; + } + if (data["flattenedStructureList"] !== undefined) { + contents.flattenedStructureList = deserializeAws_restXmlStructureList( + __getArrayIfSingleItem(data["flattenedStructureList"]), + context + ); + } + if (data.integerList === "") { + contents.integerList = []; + } + if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { + contents.integerList = deserializeAws_restXmlIntegerList( + __getArrayIfSingleItem(data["integerList"]["member"]), + context + ); + } + if (data.nestedStringList === "") { + contents.nestedStringList = []; + } + if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { + contents.nestedStringList = deserializeAws_restXmlNestedStringList( + __getArrayIfSingleItem(data["nestedStringList"]["member"]), + context + ); + } + if (data.renamed === "") { + contents.renamedListMembers = []; + } + if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { + contents.renamedListMembers = deserializeAws_restXmlRenamedListMembers( + __getArrayIfSingleItem(data["renamed"]["item"]), + context + ); + } + if (data.stringList === "") { + contents.stringList = []; + } + if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { + contents.stringList = deserializeAws_restXmlStringList( + __getArrayIfSingleItem(data["stringList"]["member"]), + context + ); + } + if (data.stringSet === "") { + contents.stringSet = []; + } + if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { + contents.stringSet = deserializeAws_restXmlStringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); + } + if (data.myStructureList === "") { + contents.structureList = []; + } + if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { + contents.structureList = deserializeAws_restXmlStructureList( + __getArrayIfSingleItem(data["myStructureList"]["item"]), + context + ); + } + if (data.timestampList === "") { + contents.timestampList = []; + } + if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { + contents.timestampList = deserializeAws_restXmlTimestampList( + __getArrayIfSingleItem(data["timestampList"]["member"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlListsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlMapsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlMapsCommandError(output, context); + } + const contents: XmlMapsCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.myMap === "") { + contents.myMap = {}; + } + if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { + contents.myMap = deserializeAws_restXmlXmlMapsInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlMapsXmlNameCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlMapsXmlNameCommandError(output, context); + } + const contents: XmlMapsXmlNameCommandOutput = { + $metadata: deserializeMetadata(output), + myMap: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.myMap === "") { + contents.myMap = {}; + } + if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { + contents.myMap = deserializeAws_restXmlXmlMapsXmlNameInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]), + context + ); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlMapsXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlNamespacesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlNamespacesCommandError(output, context); + } + const contents: XmlNamespacesCommandOutput = { + $metadata: deserializeMetadata(output), + nested: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["nested"] !== undefined) { + contents.nested = deserializeAws_restXmlXmlNamespaceNested(data["nested"], context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlNamespacesCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlTimestampsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlTimestampsCommandError(output, context); + } + const contents: XmlTimestampsCommandOutput = { + $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) { + contents.dateTime = __expectNonNull(__parseRfc3339DateTime(data["dateTime"])); + } + if (data["epochSeconds"] !== undefined) { + contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(data["epochSeconds"])); + } + if (data["httpDate"] !== undefined) { + contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data["httpDate"])); + } + if (data["normal"] !== undefined) { + contents.normal = __expectNonNull(__parseRfc3339DateTime(data["normal"])); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlTimestampsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlUnionsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restXmlXmlUnionsCommandError(output, context); + } + const contents: XmlUnionsCommandOutput = { + $metadata: deserializeMetadata(output), + unionValue: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data["unionValue"] !== undefined) { + contents.unionValue = deserializeAws_restXmlXmlUnionShape(__expectUnion(data["unionValue"]), context); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restXmlXmlUnionsCommandError = 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 = loadRestXmlErrorCode(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)); +}; + +const deserializeAws_restXmlComplexErrorResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: ComplexError = { + name: "ComplexError", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + Header: undefined, + Nested: undefined, + TopLevel: undefined, + }; + if (parsedOutput.headers["x-header"] !== undefined) { + contents.Header = parsedOutput.headers["x-header"]; + } + const data: any = parsedOutput.body.Error; + if (data["Nested"] !== undefined) { + contents.Nested = deserializeAws_restXmlComplexNestedErrorData(data["Nested"], context); + } + if (data["TopLevel"] !== undefined) { + contents.TopLevel = __expectString(data["TopLevel"]); + } + return contents; +}; + +const deserializeAws_restXmlInvalidGreetingResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: InvalidGreeting = { + name: "InvalidGreeting", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + Message: undefined, + }; + const data: any = parsedOutput.body.Error; + if (data["Message"] !== undefined) { + contents.Message = __expectString(data["Message"]); + } + return contents; +}; + +const serializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap = ( + input: { [key: string]: string }, + context: __SerdeContext +): any => { + return Object.keys(input) + .filter((key) => input[key] != null) + .map((key) => { + const entryNode = new __XmlNode("entry"); + const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("K"); + entryNode.addChildNode(keyNode); + let node; + node = new __XmlNode("String").addChildNode(new __XmlText(input[key])); + entryNode.addChildNode(node.withName("V")); + return entryNode; + }); +}; + +const serializeAws_restXmlListWithMemberNamespace = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + node.addAttribute("xmlns", "https://xml-member.example.com"); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlListWithNamespace = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlNestedMap = ( + input: { [key: string]: { [key: string]: FooEnum | string } }, + context: __SerdeContext +): any => { + return Object.keys(input) + .filter((key) => input[key] != null) + .map((key) => { + const entryNode = new __XmlNode("entry"); + const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); + entryNode.addChildNode(keyNode); + let node; + node = serializeAws_restXmlFooEnumMap(input[key], context); + entryNode.addChildNode( + node.reduce((acc: __XmlNode, workingNode: any) => { + return acc.addChildNode(workingNode); + }, new __XmlNode("value")) + ); + return entryNode; + }); +}; + +const serializeAws_restXmlNestedPayload = (input: NestedPayload, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("NestedPayload"); + if (input.greeting !== undefined && input.greeting !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.greeting)).withName("greeting"); + bodyNode.addChildNode(node); + } + if (input.name !== undefined && input.name !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlPayloadWithXmlName = (input: PayloadWithXmlName, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("Hello"); + if (input.name !== undefined && input.name !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlPayloadWithXmlNamespace = (input: PayloadWithXmlNamespace, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("PayloadWithXmlNamespace"); + if (input.name !== undefined && input.name !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix = ( + input: PayloadWithXmlNamespaceAndPrefix, + context: __SerdeContext +): any => { + const bodyNode = new __XmlNode("PayloadWithXmlNamespaceAndPrefix"); + if (input.name !== undefined && input.name !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlRecursiveShapesInputOutputNested1 = ( + input: RecursiveShapesInputOutputNested1, + context: __SerdeContext +): any => { + const bodyNode = new __XmlNode("RecursiveShapesInputOutputNested1"); + if (input.foo !== undefined && input.foo !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); + bodyNode.addChildNode(node); + } + if (input.nested !== undefined && input.nested !== null) { + const node = serializeAws_restXmlRecursiveShapesInputOutputNested2(input.nested, context).withName("nested"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlRecursiveShapesInputOutputNested2 = ( + input: RecursiveShapesInputOutputNested2, + context: __SerdeContext +): any => { + const bodyNode = new __XmlNode("RecursiveShapesInputOutputNested2"); + if (input.bar !== undefined && input.bar !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.bar)).withName("bar"); + bodyNode.addChildNode(node); + } + if (input.recursiveMember !== undefined && input.recursiveMember !== null) { + const node = serializeAws_restXmlRecursiveShapesInputOutputNested1(input.recursiveMember, context).withName( + "recursiveMember" + ); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlRenamedListMembers = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + return node.withName("item"); + }); +}; + +const serializeAws_restXmlStructureList = (input: StructureListMember[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = serializeAws_restXmlStructureListMember(entry, context); + return node.withName("item"); + }); +}; + +const serializeAws_restXmlStructureListMember = (input: StructureListMember, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("StructureListMember"); + if (input.a !== undefined && input.a !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.a)).withName("value"); + bodyNode.addChildNode(node); + } + if (input.b !== undefined && input.b !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.b)).withName("other"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlXmlAttributesInputOutput = ( + input: XmlAttributesInputOutput, + context: __SerdeContext +): any => { + const bodyNode = new __XmlNode("XmlAttributesInputOutput"); + if (input.foo !== undefined && input.foo !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); + bodyNode.addChildNode(node); + } + if (input.attr !== undefined && input.attr !== null) { + bodyNode.addAttribute("test", input.attr); + } + return bodyNode; +}; + +const serializeAws_restXmlXmlMapsInputOutputMap = ( + input: { [key: string]: GreetingStruct }, + context: __SerdeContext +): any => { + return Object.keys(input) + .filter((key) => input[key] != null) + .map((key) => { + const entryNode = new __XmlNode("entry"); + const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); + entryNode.addChildNode(keyNode); + let node; + node = serializeAws_restXmlGreetingStruct(input[key], context); + entryNode.addChildNode(node.withName("value")); + return entryNode; + }); +}; + +const serializeAws_restXmlXmlMapsXmlNameInputOutputMap = ( + input: { [key: string]: GreetingStruct }, + context: __SerdeContext +): any => { + return Object.keys(input) + .filter((key) => input[key] != null) + .map((key) => { + const entryNode = new __XmlNode("entry"); + const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("Attribute"); + entryNode.addChildNode(keyNode); + let node; + node = serializeAws_restXmlGreetingStruct(input[key], context); + entryNode.addChildNode(node.withName("Setting")); + return entryNode; + }); +}; + +const serializeAws_restXmlXmlNamespacedList = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + node.addAttribute("xmlns", "http://bux.com"); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlXmlNamespaceNested = (input: XmlNamespaceNested, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("XmlNamespaceNested"); + if (input.foo !== undefined && input.foo !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); + node.addAttribute("xmlns:baz", "http://baz.com"); + bodyNode.addChildNode(node); + } + if (input.values !== undefined && input.values !== null) { + const nodes = serializeAws_restXmlXmlNamespacedList(input.values, context); + const containerNode = new __XmlNode("values"); + containerNode.addAttribute("xmlns", "http://qux.com"); + nodes.map((node: any) => { + containerNode.addChildNode(node); + }); + bodyNode.addChildNode(containerNode); + } + return bodyNode; +}; + +const serializeAws_restXmlXmlNestedUnionStruct = (input: XmlNestedUnionStruct, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("XmlNestedUnionStruct"); + if (input.stringValue !== undefined && input.stringValue !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.stringValue)).withName("stringValue"); + bodyNode.addChildNode(node); + } + if (input.booleanValue !== undefined && input.booleanValue !== null) { + const node = new __XmlNode("Boolean") + .addChildNode(new __XmlText(String(input.booleanValue))) + .withName("booleanValue"); + bodyNode.addChildNode(node); + } + if (input.byteValue !== undefined && input.byteValue !== null) { + const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(input.byteValue))).withName("byteValue"); + bodyNode.addChildNode(node); + } + if (input.shortValue !== undefined && input.shortValue !== null) { + const node = new __XmlNode("Short").addChildNode(new __XmlText(String(input.shortValue))).withName("shortValue"); + bodyNode.addChildNode(node); + } + if (input.integerValue !== undefined && input.integerValue !== null) { + const node = new __XmlNode("Integer") + .addChildNode(new __XmlText(String(input.integerValue))) + .withName("integerValue"); + bodyNode.addChildNode(node); + } + if (input.longValue !== undefined && input.longValue !== null) { + const node = new __XmlNode("Long").addChildNode(new __XmlText(String(input.longValue))).withName("longValue"); + bodyNode.addChildNode(node); + } + if (input.floatValue !== undefined && input.floatValue !== null) { + const node = new __XmlNode("Float").addChildNode(new __XmlText(String(input.floatValue))).withName("floatValue"); + bodyNode.addChildNode(node); + } + if (input.doubleValue !== undefined && input.doubleValue !== null) { + const node = new __XmlNode("Double").addChildNode(new __XmlText(String(input.doubleValue))).withName("doubleValue"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlXmlUnionShape = (input: XmlUnionShape, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("XmlUnionShape"); + XmlUnionShape.visit(input, { + stringValue: (value) => { + const node = new __XmlNode("String").addChildNode(new __XmlText(value)).withName("stringValue"); + bodyNode.addChildNode(node); + }, + booleanValue: (value) => { + const node = new __XmlNode("Boolean").addChildNode(new __XmlText(String(value))).withName("booleanValue"); + bodyNode.addChildNode(node); + }, + byteValue: (value) => { + const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(value))).withName("byteValue"); + bodyNode.addChildNode(node); + }, + shortValue: (value) => { + const node = new __XmlNode("Short").addChildNode(new __XmlText(String(value))).withName("shortValue"); + bodyNode.addChildNode(node); + }, + integerValue: (value) => { + const node = new __XmlNode("Integer").addChildNode(new __XmlText(String(value))).withName("integerValue"); + bodyNode.addChildNode(node); + }, + longValue: (value) => { + const node = new __XmlNode("Long").addChildNode(new __XmlText(String(value))).withName("longValue"); + bodyNode.addChildNode(node); + }, + floatValue: (value) => { + const node = new __XmlNode("Float").addChildNode(new __XmlText(String(value))).withName("floatValue"); + bodyNode.addChildNode(node); + }, + doubleValue: (value) => { + const node = new __XmlNode("Double").addChildNode(new __XmlText(String(value))).withName("doubleValue"); + bodyNode.addChildNode(node); + }, + unionValue: (value) => { + const node = serializeAws_restXmlXmlUnionShape(value, context).withName("unionValue"); + bodyNode.addChildNode(node); + }, + structValue: (value) => { + const node = serializeAws_restXmlXmlNestedUnionStruct(value, context).withName("structValue"); + bodyNode.addChildNode(node); + }, + _: (name: string, value: any) => { + if (!(value instanceof __XmlNode || value instanceof __XmlText)) { + throw new Error("Unable to serialize unknown union members in XML."); + } + bodyNode.addChildNode(new __XmlNode(name).addChildNode(value)); + }, + }); + return bodyNode; +}; + +const serializeAws_restXmlBooleanList = (input: boolean[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("PrimitiveBoolean").addChildNode(new __XmlText(String(entry))); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlFooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(entry)); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlFooEnumMap = (input: { [key: string]: FooEnum | string }, context: __SerdeContext): any => { + return Object.keys(input) + .filter((key) => input[key] != null) + .map((key) => { + const entryNode = new __XmlNode("entry"); + const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); + entryNode.addChildNode(keyNode); + let node; + node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input[key])); + entryNode.addChildNode(node.withName("value")); + return entryNode; + }); +}; + +const serializeAws_restXmlFooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(entry)); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlGreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { + const bodyNode = new __XmlNode("GreetingStruct"); + if (input.hi !== undefined && input.hi !== null) { + const node = new __XmlNode("String").addChildNode(new __XmlText(input.hi)).withName("hi"); + bodyNode.addChildNode(node); + } + return bodyNode; +}; + +const serializeAws_restXmlIntegerList = (input: number[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("Integer").addChildNode(new __XmlText(String(entry))); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlNestedStringList = (input: string[][], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = serializeAws_restXmlStringList(entry, context); + return node.reduce((acc: __XmlNode, workingNode: any) => { + return acc.addChildNode(workingNode); + }, new __XmlNode("member")); + }); +}; + +const serializeAws_restXmlStringList = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlStringSet = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); + return node.withName("member"); + }); +}; + +const serializeAws_restXmlTimestampList = (input: Date[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + const node = new __XmlNode("Timestamp").addChildNode(new __XmlText(entry.toISOString().split(".")[0] + "Z")); + return node.withName("member"); + }); +}; + +const deserializeAws_restXmlComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { + const contents: any = { + Foo: undefined, + }; + if (output["Foo"] !== undefined) { + contents.Foo = __expectString(output["Foo"]); + } + return contents; +}; + +const deserializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["V"] === null) { + return acc; + } + return { + ...acc, + [pair["K"]]: __expectString(pair["V"]) as any, + }; + }, {}); +}; + +const deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["V"] === null) { + return acc; + } + return { + ...acc, + [pair["K"]]: __expectString(pair["V"]) as any, + }; + }, {}); +}; + +const deserializeAws_restXmlListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlListWithNamespace = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlNestedMap = ( + output: any, + context: __SerdeContext +): { [key: string]: { [key: string]: FooEnum | string } } => { + return output.reduce((acc: any, pair: any) => { + if (__getArrayIfSingleItem(pair["value"]["entry"]) === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: deserializeAws_restXmlFooEnumMap(__getArrayIfSingleItem(pair["value"]["entry"]), context), + }; + }, {}); +}; + +const deserializeAws_restXmlNestedPayload = (output: any, context: __SerdeContext): NestedPayload => { + const contents: any = { + greeting: undefined, + name: undefined, + }; + if (output["greeting"] !== undefined) { + contents.greeting = __expectString(output["greeting"]); + } + if (output["name"] !== undefined) { + contents.name = __expectString(output["name"]); + } + return contents; +}; + +const deserializeAws_restXmlPayloadWithXmlName = (output: any, context: __SerdeContext): PayloadWithXmlName => { + const contents: any = { + name: undefined, + }; + if (output["name"] !== undefined) { + contents.name = __expectString(output["name"]); + } + return contents; +}; + +const deserializeAws_restXmlPayloadWithXmlNamespace = ( + output: any, + context: __SerdeContext +): PayloadWithXmlNamespace => { + const contents: any = { + name: undefined, + }; + if (output["name"] !== undefined) { + contents.name = __expectString(output["name"]); + } + return contents; +}; + +const deserializeAws_restXmlPayloadWithXmlNamespaceAndPrefix = ( + output: any, + context: __SerdeContext +): PayloadWithXmlNamespaceAndPrefix => { + const contents: any = { + name: undefined, + }; + if (output["name"] !== undefined) { + contents.name = __expectString(output["name"]); + } + return contents; +}; + +const deserializeAws_restXmlRecursiveShapesInputOutputNested1 = ( + output: any, + context: __SerdeContext +): RecursiveShapesInputOutputNested1 => { + const contents: any = { + foo: undefined, + nested: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output["nested"] !== undefined) { + contents.nested = deserializeAws_restXmlRecursiveShapesInputOutputNested2(output["nested"], context); + } + return contents; +}; + +const deserializeAws_restXmlRecursiveShapesInputOutputNested2 = ( + output: any, + context: __SerdeContext +): RecursiveShapesInputOutputNested2 => { + const contents: any = { + bar: undefined, + recursiveMember: undefined, + }; + if (output["bar"] !== undefined) { + contents.bar = __expectString(output["bar"]); + } + if (output["recursiveMember"] !== undefined) { + contents.recursiveMember = deserializeAws_restXmlRecursiveShapesInputOutputNested1( + output["recursiveMember"], + context + ); + } + return contents; +}; + +const deserializeAws_restXmlRenamedListMembers = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlStructureList = (output: any, context: __SerdeContext): StructureListMember[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_restXmlStructureListMember(entry, context); + }); +}; + +const deserializeAws_restXmlStructureListMember = (output: any, context: __SerdeContext): StructureListMember => { + const contents: any = { + a: undefined, + b: undefined, + }; + if (output["value"] !== undefined) { + contents.a = __expectString(output["value"]); + } + if (output["other"] !== undefined) { + contents.b = __expectString(output["other"]); + } + return contents; +}; + +const deserializeAws_restXmlXmlAttributesInputOutput = ( + output: any, + context: __SerdeContext +): XmlAttributesInputOutput => { + const contents: any = { + foo: undefined, + attr: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output["test"] !== undefined) { + contents.attr = __expectString(output["test"]); + } + return contents; +}; + +const deserializeAws_restXmlXmlMapsInputOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return output.reduce((acc: any, pair: any) => { + if (pair["value"] === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: deserializeAws_restXmlGreetingStruct(pair["value"], context), + }; + }, {}); +}; + +const deserializeAws_restXmlXmlMapsXmlNameInputOutputMap = ( + output: any, + context: __SerdeContext +): { [key: string]: GreetingStruct } => { + return output.reduce((acc: any, pair: any) => { + if (pair["Setting"] === null) { + return acc; + } + return { + ...acc, + [pair["Attribute"]]: deserializeAws_restXmlGreetingStruct(pair["Setting"], context), + }; + }, {}); +}; + +const deserializeAws_restXmlXmlNamespacedList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlXmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { + const contents: any = { + foo: undefined, + values: undefined, + }; + if (output["foo"] !== undefined) { + contents.foo = __expectString(output["foo"]); + } + if (output.values === "") { + contents.values = []; + } + if (output["values"] !== undefined && output["values"]["member"] !== undefined) { + contents.values = deserializeAws_restXmlXmlNamespacedList( + __getArrayIfSingleItem(output["values"]["member"]), + context + ); + } + return contents; +}; + +const deserializeAws_restXmlXmlNestedUnionStruct = (output: any, context: __SerdeContext): XmlNestedUnionStruct => { + const contents: any = { + stringValue: undefined, + booleanValue: undefined, + byteValue: undefined, + shortValue: undefined, + integerValue: undefined, + longValue: undefined, + floatValue: undefined, + doubleValue: undefined, + }; + if (output["stringValue"] !== undefined) { + contents.stringValue = __expectString(output["stringValue"]); + } + if (output["booleanValue"] !== undefined) { + contents.booleanValue = __parseBoolean(output["booleanValue"]); + } + if (output["byteValue"] !== undefined) { + contents.byteValue = __strictParseByte(output["byteValue"]) as number; + } + if (output["shortValue"] !== undefined) { + contents.shortValue = __strictParseShort(output["shortValue"]) as number; + } + if (output["integerValue"] !== undefined) { + contents.integerValue = __strictParseInt32(output["integerValue"]) as number; + } + if (output["longValue"] !== undefined) { + contents.longValue = __strictParseLong(output["longValue"]) as number; + } + if (output["floatValue"] !== undefined) { + contents.floatValue = __strictParseFloat(output["floatValue"]) as number; + } + if (output["doubleValue"] !== undefined) { + contents.doubleValue = __strictParseFloat(output["doubleValue"]) as number; + } + return contents; +}; + +const deserializeAws_restXmlXmlUnionShape = (output: any, context: __SerdeContext): XmlUnionShape => { + if (output["stringValue"] !== undefined) { + return { + stringValue: __expectString(output["stringValue"]) as any, + }; + } + if (output["booleanValue"] !== undefined) { + return { + booleanValue: __parseBoolean(output["booleanValue"]), + }; + } + if (output["byteValue"] !== undefined) { + return { + byteValue: __strictParseByte(output["byteValue"]) as number, + }; + } + if (output["shortValue"] !== undefined) { + return { + shortValue: __strictParseShort(output["shortValue"]) as number, + }; + } + if (output["integerValue"] !== undefined) { + return { + integerValue: __strictParseInt32(output["integerValue"]) as number, + }; + } + if (output["longValue"] !== undefined) { + return { + longValue: __strictParseLong(output["longValue"]) as number, + }; + } + if (output["floatValue"] !== undefined) { + return { + floatValue: __strictParseFloat(output["floatValue"]) as number, + }; + } + if (output["doubleValue"] !== undefined) { + return { + doubleValue: __strictParseFloat(output["doubleValue"]) as number, + }; + } + if (output["unionValue"] !== undefined) { + return { + unionValue: deserializeAws_restXmlXmlUnionShape(__expectUnion(output["unionValue"]), context), + }; + } + if (output["structValue"] !== undefined) { + return { + structValue: deserializeAws_restXmlXmlNestedUnionStruct(output["structValue"], context), + }; + } + return { $unknown: Object.entries(output)[0] }; +}; + +const deserializeAws_restXmlBooleanList = (output: any, context: __SerdeContext): boolean[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __parseBoolean(entry); + }); +}; + +const deserializeAws_restXmlFooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlFooEnumMap = ( + output: any, + context: __SerdeContext +): { [key: string]: FooEnum | string } => { + return output.reduce((acc: any, pair: any) => { + if (pair["value"] === null) { + return acc; + } + return { + ...acc, + [pair["key"]]: __expectString(pair["value"]) as any, + }; + }, {}); +}; + +const deserializeAws_restXmlFooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlGreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { + const contents: any = { + hi: undefined, + }; + if (output["hi"] !== undefined) { + contents.hi = __expectString(output["hi"]); + } + return contents; +}; + +const deserializeAws_restXmlIntegerList = (output: any, context: __SerdeContext): number[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __strictParseInt32(entry) as number; + }); +}; + +const deserializeAws_restXmlNestedStringList = (output: any, context: __SerdeContext): string[][] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_restXmlStringList(__getArrayIfSingleItem(entry["member"]), context); + }); +}; + +const deserializeAws_restXmlStringList = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlStringSet = (output: any, context: __SerdeContext): string[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); +}; + +const deserializeAws_restXmlTimestampList = (output: any, context: __SerdeContext): Date[] => { + return (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectNonNull(__parseRfc3339DateTime(entry)); + }); +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const isSerializableHeaderValue = (value: any): boolean => + value !== undefined && + value !== null && + value !== "" && + (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && + (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + const parsedObj = xmlParse(encoded, { + attributeNamePrefix: "", + ignoreAttributes: false, + parseNodeValue: false, + trimValues: false, + tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + }); + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return __getValueFromTextNode(parsedObjToReturn); + } + return {}; + }); + +const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string => { + if (data.Error.Code !== undefined) { + return data.Error.Code; + } + if (output.statusCode == 404) { + return "NotFound"; + } + return ""; +}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..c57b26caa429 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts @@ -0,0 +1,37 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..e9c95d1f87ba --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts @@ -0,0 +1,17 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; + +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..e40141e9507e --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts @@ -0,0 +1,17 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; + +import { defaultRegionInfoProvider } from "./endpoints"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => ({ + apiVersion: "2019-12-16", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config?.serviceId ?? "Rest Xml Protocol", + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts new file mode 100644 index 000000000000..5b405c2b22a5 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts @@ -0,0 +1,40 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts b/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts new file mode 100644 index 000000000000..2e3316feba2a --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts @@ -0,0 +1,6778 @@ +import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; +import { buildQueryString } from "@aws-sdk/querystring-builder"; +import { Encoder as __Encoder } from "@aws-sdk/types"; +import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; +import { decodeHTML } from "entities"; +import { parse as xmlParse } from "fast-xml-parser"; +import { Readable } from "stream"; + +import { AllQueryStringTypesCommand } from "../../src/commands/AllQueryStringTypesCommand"; +import { BodyWithXmlNameCommand } from "../../src/commands/BodyWithXmlNameCommand"; +import { ConstantAndVariableQueryStringCommand } from "../../src/commands/ConstantAndVariableQueryStringCommand"; +import { ConstantQueryStringCommand } from "../../src/commands/ConstantQueryStringCommand"; +import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; +import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; +import { EndpointWithHostLabelHeaderOperationCommand } from "../../src/commands/EndpointWithHostLabelHeaderOperationCommand"; +import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; +import { FlattenedXmlMapCommand } from "../../src/commands/FlattenedXmlMapCommand"; +import { FlattenedXmlMapWithXmlNameCommand } from "../../src/commands/FlattenedXmlMapWithXmlNameCommand"; +import { FlattenedXmlMapWithXmlNamespaceCommand } from "../../src/commands/FlattenedXmlMapWithXmlNamespaceCommand"; +import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; +import { HttpPayloadTraitsCommand } from "../../src/commands/HttpPayloadTraitsCommand"; +import { HttpPayloadTraitsWithMediaTypeCommand } from "../../src/commands/HttpPayloadTraitsWithMediaTypeCommand"; +import { HttpPayloadWithMemberXmlNameCommand } from "../../src/commands/HttpPayloadWithMemberXmlNameCommand"; +import { HttpPayloadWithStructureCommand } from "../../src/commands/HttpPayloadWithStructureCommand"; +import { HttpPayloadWithXmlNameCommand } from "../../src/commands/HttpPayloadWithXmlNameCommand"; +import { HttpPayloadWithXmlNamespaceAndPrefixCommand } from "../../src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; +import { HttpPayloadWithXmlNamespaceCommand } from "../../src/commands/HttpPayloadWithXmlNamespaceCommand"; +import { HttpPrefixHeadersCommand } from "../../src/commands/HttpPrefixHeadersCommand"; +import { HttpRequestWithFloatLabelsCommand } from "../../src/commands/HttpRequestWithFloatLabelsCommand"; +import { HttpRequestWithGreedyLabelInPathCommand } from "../../src/commands/HttpRequestWithGreedyLabelInPathCommand"; +import { HttpRequestWithLabelsAndTimestampFormatCommand } from "../../src/commands/HttpRequestWithLabelsAndTimestampFormatCommand"; +import { HttpRequestWithLabelsCommand } from "../../src/commands/HttpRequestWithLabelsCommand"; +import { HttpResponseCodeCommand } from "../../src/commands/HttpResponseCodeCommand"; +import { IgnoreQueryParamsInResponseCommand } from "../../src/commands/IgnoreQueryParamsInResponseCommand"; +import { InputAndOutputWithHeadersCommand } from "../../src/commands/InputAndOutputWithHeadersCommand"; +import { NestedXmlMapsCommand } from "../../src/commands/NestedXmlMapsCommand"; +import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; +import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; +import { NullAndEmptyHeadersClientCommand } from "../../src/commands/NullAndEmptyHeadersClientCommand"; +import { OmitsNullSerializesEmptyStringCommand } from "../../src/commands/OmitsNullSerializesEmptyStringCommand"; +import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; +import { QueryParamsAsStringListMapCommand } from "../../src/commands/QueryParamsAsStringListMapCommand"; +import { QueryPrecedenceCommand } from "../../src/commands/QueryPrecedenceCommand"; +import { RecursiveShapesCommand } from "../../src/commands/RecursiveShapesCommand"; +import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; +import { TimestampFormatHeadersCommand } from "../../src/commands/TimestampFormatHeadersCommand"; +import { XmlAttributesCommand } from "../../src/commands/XmlAttributesCommand"; +import { XmlAttributesOnPayloadCommand } from "../../src/commands/XmlAttributesOnPayloadCommand"; +import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; +import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; +import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; +import { XmlEmptyMapsCommand } from "../../src/commands/XmlEmptyMapsCommand"; +import { XmlEmptyStringsCommand } from "../../src/commands/XmlEmptyStringsCommand"; +import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; +import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; +import { XmlMapsCommand } from "../../src/commands/XmlMapsCommand"; +import { XmlMapsXmlNameCommand } from "../../src/commands/XmlMapsXmlNameCommand"; +import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; +import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; +import { XmlUnionsCommand } from "../../src/commands/XmlUnionsCommand"; +import { ComplexError, InvalidGreeting } from "../../src/models/models_0"; +import { RestXmlProtocolClient } from "../../src/RestXmlProtocolClient"; + +/** + * Throws an expected exception that contains the serialized request. + */ +class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { + constructor(readonly request: HttpRequest) { + super(); + } +} + +/** + * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a + * request. The thrown exception contains the serialized request. + */ +class RequestSerializationTestHandler implements HttpHandler { + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); + } +} + +/** + * Returns a resolved Promise of the specified response contents. + */ +class ResponseDeserializationTestHandler implements HttpHandler { + isSuccess: boolean; + code: number; + headers: HeaderBag; + body: String; + + constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { + this.isSuccess = isSuccess; + this.code = code; + if (headers === undefined) { + this.headers = {}; + } else { + this.headers = headers; + } + if (body === undefined) { + body = ""; + } + this.body = body; + } + + handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { + return Promise.resolve({ + response: { + statusCode: this.code, + headers: this.headers, + body: Readable.from([this.body]), + }, + }); + } +} + +interface comparableParts { + [key: string]: string; +} + +/** + * Generates a standard map of un-equal values given input parts. + */ +const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { + const unequalParts: any = {}; + Object.keys(expectedParts).forEach((key) => { + if (generatedParts[key] === undefined) { + unequalParts[key] = { exp: expectedParts[key], gen: undefined }; + } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { + unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; + } + }); + + Object.keys(generatedParts).forEach((key) => { + if (expectedParts[key] === undefined) { + unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; + } + }); + + if (Object.keys(unequalParts).length !== 0) { + return unequalParts; + } + return undefined; +}; + +/** + * Compares all types for equivalent contents, doing nested + * equality checks based on non-`$metadata` + * properties that have defined values. + */ +const equivalentContents = (expected: any, generated: any): boolean => { + const localExpected = expected; + + // Short circuit on equality. + if (localExpected == generated) { + return true; + } + + // If a test fails with an issue in the below 6 lines, it's likely + // due to an issue in the nestedness or existence of the property + // being compared. + delete localExpected["$metadata"]; + delete generated["$metadata"]; + Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); + Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); + + const expectedProperties = Object.getOwnPropertyNames(localExpected); + const generatedProperties = Object.getOwnPropertyNames(generated); + + // Short circuit on different property counts. + if (expectedProperties.length != generatedProperties.length) { + return false; + } + + // Compare properties directly. + for (let index = 0; index < expectedProperties.length; index++) { + const propertyName = expectedProperties[index]; + if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { + return false; + } + } + + return true; +}; + +const clientParams = { + region: "us-west-2", + credentials: { accessKeyId: "key", secretAccessKey: "secret" }, +}; + +/** + * Serializes query string parameters with all supported types + */ +it("AllQueryStringTypes:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryString: "Hello there", + + queryStringList: ["a", "b", "c"], + + queryStringSet: ["a", "b", "c"], + + queryByte: 1, + + queryShort: 2, + + queryInteger: 3, + + queryIntegerList: [ + 1, + + 2, + + 3, + ], + + queryIntegerSet: [ + 1, + + 2, + + 3, + ], + + queryLong: 4, + + queryFloat: 1.1, + + queryDouble: 1.1, + + queryDoubleList: [ + 1.1, + + 2.1, + + 3.1, + ], + + queryBoolean: true, + + queryBooleanList: [true, false, true], + + queryTimestamp: new Date(1000), + + queryTimestampList: [new Date(1000), new Date(2000), new Date(3000)], + + queryEnum: "Foo", + + queryEnumList: ["Foo", "Baz", "Bar"], + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("String=Hello%20there"); + expect(queryString).toContain("StringList=a"); + expect(queryString).toContain("StringList=b"); + expect(queryString).toContain("StringList=c"); + expect(queryString).toContain("StringSet=a"); + expect(queryString).toContain("StringSet=b"); + expect(queryString).toContain("StringSet=c"); + expect(queryString).toContain("Byte=1"); + expect(queryString).toContain("Short=2"); + expect(queryString).toContain("Integer=3"); + expect(queryString).toContain("IntegerList=1"); + expect(queryString).toContain("IntegerList=2"); + expect(queryString).toContain("IntegerList=3"); + expect(queryString).toContain("IntegerSet=1"); + expect(queryString).toContain("IntegerSet=2"); + expect(queryString).toContain("IntegerSet=3"); + expect(queryString).toContain("Long=4"); + expect(queryString).toContain("Float=1.1"); + expect(queryString).toContain("Double=1.1"); + expect(queryString).toContain("DoubleList=1.1"); + expect(queryString).toContain("DoubleList=2.1"); + expect(queryString).toContain("DoubleList=3.1"); + expect(queryString).toContain("Boolean=true"); + expect(queryString).toContain("BooleanList=true"); + expect(queryString).toContain("BooleanList=false"); + expect(queryString).toContain("BooleanList=true"); + expect(queryString).toContain("Timestamp=1970-01-01T00%3A00%3A01Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A01Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A02Z"); + expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A03Z"); + expect(queryString).toContain("Enum=Foo"); + expect(queryString).toContain("EnumList=Foo"); + expect(queryString).toContain("EnumList=Baz"); + expect(queryString).toContain("EnumList=Bar"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Handles query string maps + */ +it("RestXmlQueryStringMap:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryParamsMapOfStrings: { + QueryParamsStringKeyA: "Foo", + + QueryParamsStringKeyB: "Bar", + } as any, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("QueryParamsStringKeyA=Foo"); + expect(queryString).toContain("QueryParamsStringKeyB=Bar"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling NaN float query values. + */ +it("RestXmlSupportsNaNFloatQueryValues:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: NaN, + + queryDouble: NaN, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=NaN"); + expect(queryString).toContain("Double=NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float query values. + */ +it("RestXmlSupportsInfinityFloatQueryValues:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: Infinity, + + queryDouble: Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=Infinity"); + expect(queryString).toContain("Double=Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float query values. + */ +it("RestXmlSupportsNegativeInfinityFloatQueryValues:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new AllQueryStringTypesCommand({ + queryFloat: -Infinity, + + queryDouble: -Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/AllQueryStringTypesInput"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Float=-Infinity"); + expect(queryString).toContain("Double=-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes a payload using a wrapper name based on the xmlName + */ +it("BodyWithXmlName:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new BodyWithXmlNameCommand({ + nested: { + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/BodyWithXmlName"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Phreddy`; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a payload using a wrapper name based on the xmlName + */ +it("BodyWithXmlName:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + `Phreddy` + ), + }); + + const params: any = {}; + const command = new BodyWithXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Mixes constant and variable query string parameters + */ +it("ConstantAndVariableQueryStringMissingOneValue:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantAndVariableQueryStringCommand({ + baz: "bam", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantAndVariableQueryString"); + + expect(r.query["maybeSet"]).toBeUndefined(); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("baz=bam"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Mixes constant and variable query string parameters + */ +it("ConstantAndVariableQueryStringAllValues:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantAndVariableQueryStringCommand({ + baz: "bam", + + maybeSet: "yes", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantAndVariableQueryString"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("baz=bam"); + expect(queryString).toContain("maybeSet=yes"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Includes constant query string parameters + */ +it("ConstantQueryString:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new ConstantQueryStringCommand({ + hello: "hi", + } as any); + 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("GET"); + expect(r.path).toBe("/ConstantQueryString/hi"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("foo=bar"); + expect(queryString).toContain("hello"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Empty input serializes no payload + */ +it("EmptyInputAndEmptyOutput:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EmptyInputAndEmptyOutputCommand({} as any); + 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("/EmptyInputAndEmptyOutput"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Empty output serializes no payload + */ +it("EmptyInputAndEmptyOutput:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new EmptyInputAndEmptyOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait. + */ +it("RestXmlEndpointTrait:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointOperationCommand({}); + 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("/EndpointOperation"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. The label must also + * be serialized in into any other location it is bound to, such + * as the body or in this case an http header. + */ +it("RestXmlEndpointTraitWithHostLabelAndHttpBinding:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelHeaderOperationCommand({ + accountId: "bar", + } as any); + 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("/EndpointWithHostLabelHeaderOperation"); + + expect(r.headers["x-amz-account-id"]).toBeDefined(); + expect(r.headers["x-amz-account-id"]).toBe("bar"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Operations can prepend to the given host if they define the + * endpoint trait, and can use the host label trait to define + * further customization based on user input. + */ +it("RestXmlEndpointTraitWithHostLabel:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + endpoint: "https://example.com", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new EndpointWithHostLabelOperationCommand({ + label: "bar", + } as any); + 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("/EndpointWithHostLabelOperation"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened XML maps in requests + */ +it("FlattenedXmlMap:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new FlattenedXmlMapCommand({ + myMap: { + foo: "Foo", + + baz: "Baz", + } as any, + } as any); + 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("/FlattenedXmlMap"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + foo + Foo + + + baz + Baz + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened XML maps in responses + */ +it("FlattenedXmlMap:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + foo + Foo + + + baz + Baz + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: "Foo", + + baz: "Baz", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes flattened XML maps in requests that have xmlName on members + */ +it("FlattenedXmlMapWithXmlName:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new FlattenedXmlMapWithXmlNameCommand({ + myMap: { + a: "A", + + b: "B", + } as any, + } as any); + 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("/FlattenedXmlMapWithXmlName"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + a + A + + + b + B + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes flattened XML maps in responses that have xmlName on members + */ +it("FlattenedXmlMapWithXmlName:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + a + A + + + b + B + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapWithXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + a: "A", + + b: "B", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes flattened XML maps in responses that have xmlNamespace and xmlName on members + */ +it("RestXmlFlattenedXmlMapWithXmlNamespace:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + a + A + + + b + B + + ` + ), + }); + + const params: any = {}; + const command = new FlattenedXmlMapWithXmlNamespaceCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + a: "A", + + b: "B", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that operations with errors successfully know how to deserialize the successful response + */ +it("GreetingWithErrors:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-greeting": "Hello", + }, + `` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + greeting: "Hello", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Parses simple XML errors + */ +it("InvalidGreetingError:Error:GreetingWithErrors", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "content-type": "application/xml", + }, + ` + + Sender + InvalidGreeting + Hi + setting + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +it("ComplexError:Error:GreetingWithErrors", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 400, + { + "x-header": "Header", + "content-type": "application/xml", + }, + ` + + Sender + ComplexError + Hi + Top level + + bar + + + foo-id + + ` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "ComplexError") { + console.log(err); + fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(400); + const paramsToValidate: any = [ + { + Header: "Header", + + TopLevel: "Top level", + + Nested: { + Foo: "bar", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("HttpPayloadTraitsWithBlob:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/HttpPayloadTraits"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("HttpPayloadTraitsWithNoBlobBody:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsCommand({ + foo: "Foo", + } as any); + 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("/HttpPayloadTraits"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes a blob in the HTTP payload + */ +it("HttpPayloadTraitsWithBlob:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes an empty blob in the HTTP payload + */ +it("HttpPayloadTraitsWithNoBlobBody:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("HttpPayloadTraitsWithMediaTypeWithBlob:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadTraitsWithMediaTypeCommand({ + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + } as any); + 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("/HttpPayloadTraitsWithMediaType"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `blobby blob blob`; + const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a blob in the HTTP payload with a content-type + */ +it("HttpPayloadTraitsWithMediaTypeWithBlob:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "text/plain", + }, + `blobby blob blob` + ), + }); + + const params: any = {}; + const command = new HttpPayloadTraitsWithMediaTypeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload using a wrapper name based on member xmlName + */ +it("HttpPayloadWithMemberXmlName:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithMemberXmlNameCommand({ + nested: { + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithMemberXmlName"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Phreddy`; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload using a wrapper name based on member xmlName + */ +it("HttpPayloadWithMemberXmlName:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + `Phreddy` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithMemberXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload + */ +it("HttpPayloadWithStructure:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithStructureCommand({ + nested: { + greeting: "hello", + + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithStructure"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + hello + Phreddy + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload + */ +it("HttpPayloadWithStructure:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + hello + Phreddy + + ` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithStructureCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + greeting: "hello", + + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload using a wrapper name based on xmlName + */ +it("HttpPayloadWithXmlName:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithXmlNameCommand({ + nested: { + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithXmlName"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `Phreddy`; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload using a wrapper name based on xmlName + */ +it("HttpPayloadWithXmlName:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + `Phreddy` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload using a wrapper with an XML namespace + */ +it("HttpPayloadWithXmlNamespace:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithXmlNamespaceCommand({ + nested: { + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithXmlNamespace"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + Phreddy + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload using a wrapper with an XML namespace + */ +it("HttpPayloadWithXmlNamespace:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + Phreddy + ` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithXmlNamespaceCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes a structure in the payload using a wrapper with an XML namespace + */ +it("HttpPayloadWithXmlNamespaceAndPrefix:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand({ + nested: { + name: "Phreddy", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/HttpPayloadWithXmlNamespaceAndPrefix"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + Phreddy + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes a structure in the payload using a wrapper with an XML namespace + */ +it("HttpPayloadWithXmlNamespaceAndPrefix:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + Phreddy + ` + ), + }); + + const params: any = {}; + const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + name: "Phreddy", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Adds headers by prefix + */ +it("HttpPrefixHeadersArePresent:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPrefixHeadersCommand({ + foo: "Foo", + + fooMap: { + Abc: "Abc value", + + Def: "Def value", + } as any, + } as any); + 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("GET"); + expect(r.path).toBe("/HttpPrefixHeaders"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + expect(r.headers["x-foo-abc"]).toBeDefined(); + expect(r.headers["x-foo-abc"]).toBe("Abc value"); + expect(r.headers["x-foo-def"]).toBeDefined(); + expect(r.headers["x-foo-def"]).toBe("Def value"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * No prefix headers are serialized because the value is empty + */ +it("HttpPrefixHeadersAreNotPresent:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpPrefixHeadersCommand({ + foo: "Foo", + + fooMap: {} as any, + } as any); + 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("GET"); + expect(r.path).toBe("/HttpPrefixHeaders"); + + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Adds headers by prefix + */ +it("HttpPrefixHeadersArePresent:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "x-foo-abc": "Abc value", + "x-foo-def": "Def value", + }, + `` + ), + }); + + const params: any = {}; + const command = new HttpPrefixHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + fooMap: { + abc: "Abc value", + + def: "Def value", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * No prefix headers are serialized because the value is empty + */ +it("HttpPrefixHeadersAreNotPresent:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new HttpPrefixHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + fooMap: {}, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float label values. + */ +it("RestXmlSupportsNaNFloatLabels:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: NaN, + + double: NaN, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/NaN/NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float label values. + */ +it("RestXmlSupportsInfinityFloatLabels:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: Infinity, + + double: Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/Infinity/Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float label values. + */ +it("RestXmlSupportsNegativeInfinityFloatLabels:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithFloatLabelsCommand({ + float: -Infinity, + + double: -Infinity, + } as any); + 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("GET"); + expect(r.path).toBe("/FloatHttpLabels/-Infinity/-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes greedy labels and normal labels + */ +it("HttpRequestWithGreedyLabelInPath:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithGreedyLabelInPathCommand({ + foo: "hello", + + baz: "there/guy", + } as any); + 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("GET"); + expect(r.path).toBe("/HttpRequestWithGreedyLabelInPath/foo/hello/baz/there/guy"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Sends a GET request that uses URI label bindings + */ +it("InputWithHeadersAndAllParams:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithLabelsCommand({ + string: "string", + + short: 1, + + integer: 2, + + long: 3, + + float: 4.1, + + double: 5.1, + + boolean: true, + + timestamp: new Date(1576540098000), + } as any); + 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("GET"); + expect(r.path).toBe("/HttpRequestWithLabels/string/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes different timestamp formats in URI labels + */ +it("HttpRequestWithLabelsAndTimestampFormat:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HttpRequestWithLabelsAndTimestampFormatCommand({ + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + } as any); + 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("GET"); + expect(r.path).toBe( + "/HttpRequestWithLabelsAndTimestampFormat/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z/2019-12-16T23%3A48%3A18Z/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z" + ); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Binds the http response code to an output structure. + */ +it("RestXmlHttpResponseCode:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 201, + { + "content-type": "application/xml", + }, + `` + ), + }); + + const params: any = {}; + const command = new HttpResponseCodeCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(201); + const paramsToValidate: any = [ + { + Status: 201, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Query parameters must be ignored when serializing the output of an operation + */ +it("IgnoreQueryParamsInResponse:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + `bam` + ), + }); + + const params: any = {}; + const command = new IgnoreQueryParamsInResponseCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + baz: "bam", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests requests with string header bindings + */ +it("InputAndOutputWithStringHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerString: "Hello", + + headerStringList: ["a", "b", "c"], + + headerStringSet: ["a", "b", "c"], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-string"]).toBeDefined(); + expect(r.headers["x-string"]).toBe("Hello"); + expect(r.headers["x-stringlist"]).toBeDefined(); + expect(r.headers["x-stringlist"]).toBe("a, b, c"); + expect(r.headers["x-stringset"]).toBeDefined(); + expect(r.headers["x-stringset"]).toBe("a, b, c"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with numeric header bindings + */ +it("InputAndOutputWithNumericHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerByte: 1, + + headerShort: 123, + + headerInteger: 123, + + headerLong: 123, + + headerFloat: 1.1, + + headerDouble: 1.1, + + headerIntegerList: [ + 1, + + 2, + + 3, + ], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-byte"]).toBeDefined(); + expect(r.headers["x-byte"]).toBe("1"); + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("1.1"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("1.1"); + expect(r.headers["x-integer"]).toBeDefined(); + expect(r.headers["x-integer"]).toBe("123"); + expect(r.headers["x-integerlist"]).toBeDefined(); + expect(r.headers["x-integerlist"]).toBe("1, 2, 3"); + expect(r.headers["x-long"]).toBeDefined(); + expect(r.headers["x-long"]).toBe("123"); + expect(r.headers["x-short"]).toBeDefined(); + expect(r.headers["x-short"]).toBe("123"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with boolean header bindings + */ +it("InputAndOutputWithBooleanHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerTrueBool: true, + + headerFalseBool: false, + + headerBooleanList: [true, false, true], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-boolean1"]).toBeDefined(); + expect(r.headers["x-boolean1"]).toBe("true"); + expect(r.headers["x-boolean2"]).toBeDefined(); + expect(r.headers["x-boolean2"]).toBe("false"); + expect(r.headers["x-booleanlist"]).toBeDefined(); + expect(r.headers["x-booleanlist"]).toBe("true, false, true"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with timestamp header bindings + */ +it("InputAndOutputWithTimestampHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-timestamplist"]).toBeDefined(); + expect(r.headers["x-timestamplist"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests requests with enum header bindings + */ +it("InputAndOutputWithEnumHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerEnum: "Foo", + + headerEnumList: ["Foo", "Bar", "Baz"], + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-enum"]).toBeDefined(); + expect(r.headers["x-enum"]).toBe("Foo"); + expect(r.headers["x-enumlist"]).toBeDefined(); + expect(r.headers["x-enumlist"]).toBe("Foo, Bar, Baz"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling NaN float header values. + */ +it("RestXmlSupportsNaNFloatHeaderInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: NaN, + + headerDouble: NaN, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("NaN"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("NaN"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling Infinity float header values. + */ +it("RestXmlSupportsInfinityFloatHeaderInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: Infinity, + + headerDouble: Infinity, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("Infinity"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Supports handling -Infinity float header values. + */ +it("RestXmlSupportsNegativeInfinityFloatHeaderInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new InputAndOutputWithHeadersCommand({ + headerFloat: -Infinity, + + headerDouble: -Infinity, + } as any); + 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("/InputAndOutputWithHeaders"); + + expect(r.headers["x-double"]).toBeDefined(); + expect(r.headers["x-double"]).toBe("-Infinity"); + expect(r.headers["x-float"]).toBeDefined(); + expect(r.headers["x-float"]).toBe("-Infinity"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests responses with string header bindings + */ +it("InputAndOutputWithStringHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-stringlist": "a, b, c", + "x-stringset": "a, b, c", + "x-string": "Hello", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerString: "Hello", + + headerStringList: ["a", "b", "c"], + + headerStringSet: ["a", "b", "c"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with numeric header bindings + */ +it("InputAndOutputWithNumericHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-float": "1.1", + "x-byte": "1", + "x-long": "123", + "x-integer": "123", + "x-integerlist": "1, 2, 3", + "x-double": "1.1", + "x-short": "123", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerByte: 1, + + headerShort: 123, + + headerInteger: 123, + + headerLong: 123, + + headerFloat: 1.1, + + headerDouble: 1.1, + + headerIntegerList: [ + 1, + + 2, + + 3, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with boolean header bindings + */ +it("InputAndOutputWithBooleanHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-booleanlist": "true, false, true", + "x-boolean1": "true", + "x-boolean2": "false", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerTrueBool: true, + + headerFalseBool: false, + + headerBooleanList: [true, false, true], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with timestamp header bindings + */ +it("InputAndOutputWithTimestampHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-timestamplist": "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with enum header bindings + */ +it("InputAndOutputWithEnumHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-enumlist": "Foo, Bar, Baz", + "x-enum": "Foo", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerEnum: "Foo", + + headerEnumList: ["Foo", "Bar", "Baz"], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float header values. + */ +it("RestXmlSupportsNaNFloatHeaderOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-float": "NaN", + "x-double": "NaN", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: NaN, + + headerDouble: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float header values. + */ +it("RestXmlSupportsInfinityFloatHeaderOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-float": "Infinity", + "x-double": "Infinity", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: Infinity, + + headerDouble: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float header values. + */ +it("RestXmlSupportsNegativeInfinityFloatHeaderOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-float": "-Infinity", + "x-double": "-Infinity", + }, + `` + ), + }); + + const params: any = {}; + const command = new InputAndOutputWithHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + headerFloat: -Infinity, + + headerDouble: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests requests with nested maps. + */ +it("NestedXmlMapRequest:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NestedXmlMapsCommand({ + nestedMap: { + foo: { + bar: "Bar", + } as any, + } as any, + } as any); + 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("/NestedXmlMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + foo + + + bar + Bar + + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests requests with nested flat maps. Since maps can only be + * flattened when they're structure members, only the outer map is flat. + */ +it("FlatNestedXmlMapRequest:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NestedXmlMapsCommand({ + flatNestedMap: { + foo: { + bar: "Bar", + } as any, + } as any, + } as any); + 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("/NestedXmlMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + foo + + + bar + Bar + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests responses with nested maps. + */ +it("NestedXmlMapResponse:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + foo + + + bar + Bar + + + + + ` + ), + }); + + const params: any = {}; + const command = new NestedXmlMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nestedMap: { + foo: { + bar: "Bar", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests responses with nested flat maps. Since maps can only be + * flattened when they're structure members, only the outer map is flat. + */ +it("FlatNestedXmlMapResponse:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + foo + + + bar + Bar + + + + ` + ), + }); + + const params: any = {}; + const command = new NestedXmlMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + flatNestedMap: { + foo: { + bar: "Bar", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * No input serializes no payload + */ +it("NoInputAndNoOutput:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndNoOutputCommand({}); + 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("/NoInputAndNoOutput"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * No output serializes no payload + */ +it("NoInputAndNoOutput:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new NoInputAndNoOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * No input serializes no payload + */ +it("NoInputAndOutput:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NoInputAndOutputCommand({}); + 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("/NoInputAndOutputOutput"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Empty output serializes no payload + */ +it("NoInputAndOutput:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new NoInputAndOutputCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); +}); + +/** + * Do not send null values, empty strings, or empty lists over the wire in headers + */ +it("NullAndEmptyHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new NullAndEmptyHeadersClientCommand({ + a: null, + + b: "", + + c: [], + } as any); + 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("GET"); + expect(r.path).toBe("/NullAndEmptyHeadersClient"); + + expect(r.headers["x-a"]).toBeUndefined(); + expect(r.headers["x-b"]).toBeUndefined(); + expect(r.headers["x-c"]).toBeUndefined(); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Omits null query values + */ +it("RestXmlOmitsNullQuery:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OmitsNullSerializesEmptyStringCommand({ + nullValue: null, + } as any); + 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("GET"); + expect(r.path).toBe("/OmitsNullSerializesEmptyString"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes empty query strings + */ +it("RestXmlSerializesEmptyString:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new OmitsNullSerializesEmptyStringCommand({ + emptyString: "", + } as any); + 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("GET"); + expect(r.path).toBe("/OmitsNullSerializesEmptyString"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("Empty="); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Automatically adds idempotency token when not set + */ +it("QueryIdempotencyTokenAutoFill:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/QueryIdempotencyTokenAutoFill"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Uses the given idempotency token as-is + */ +it("QueryIdempotencyTokenAutoFillIsSet:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryIdempotencyTokenAutoFillCommand({ + token: "00000000-0000-4000-8000-000000000000", + } as any); + 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("/QueryIdempotencyTokenAutoFill"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serialize query params from map of list strings + */ +it("RestXmlQueryParamsStringListMap:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryParamsAsStringListMapCommand({ + qux: "named", + + foo: { + baz: ["bar", "qux"], + } as any, + } as any); + 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("/StringListMap"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("corge=named"); + expect(queryString).toContain("baz=bar"); + expect(queryString).toContain("baz=qux"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Prefer named query parameters when serializing + */ +it("RestXmlQueryPrecedence:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new QueryPrecedenceCommand({ + foo: "named", + + baz: { + bar: "fromMap", + + qux: "alsoFromMap", + } as any, + } as any); + 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("/Precedence"); + + const queryString = buildQueryString(r.query); + expect(queryString).toContain("bar=named"); + expect(queryString).toContain("qux=alsoFromMap"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Serializes recursive structures + */ +it("RecursiveShapes:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new RecursiveShapesCommand({ + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + } as any, + } as any, + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/RecursiveShapes"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + Foo1 + + Bar1 + + Foo2 + + Bar2 + + + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes recursive structures + */ +it("RecursiveShapes:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + Foo1 + + Bar1 + + Foo2 + + Bar2 + + + + + + ` + ), + }); + + const params: any = {}; + const command = new RecursiveShapesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo1", + + nested: { + bar: "Bar1", + + recursiveMember: { + foo: "Foo2", + + nested: { + bar: "Bar2", + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("SimpleScalarProperties:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + foo: "Foo", + + stringValue: "string", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + string + true + false + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes string with escaping + */ +it("SimpleScalarPropertiesWithEscapedCharacter:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + foo: "Foo", + + stringValue: "", + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + <string> + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes string containing white space + */ +it("SimpleScalarPropertiesWithWhiteSpace:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + foo: "Foo", + + stringValue: " string with white space ", + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + string with white space + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes string containing exclusively whitespace + */ +it("SimpleScalarPropertiesPureWhiteSpace:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + foo: "Foo", + + stringValue: " ", + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + expect(r.headers["x-foo"]).toBeDefined(); + expect(r.headers["x-foo"]).toBe("Foo"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling NaN float values. + */ +it("RestXmlSupportsNaNFloatInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: NaN, + + doubleValue: NaN, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + NaN + NaN + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling Infinity float values. + */ +it("RestXmlSupportsInfinityFloatInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: Infinity, + + doubleValue: Infinity, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + Infinity + Infinity + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Supports handling -Infinity float values. + */ +it("RestXmlSupportsNegativeInfinityFloatInputs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new SimpleScalarPropertiesCommand({ + floatValue: -Infinity, + + doubleValue: -Infinity, + } as any); + 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("PUT"); + expect(r.path).toBe("/SimpleScalarProperties"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + -Infinity + -Infinity + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("SimpleScalarProperties:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + string + true + false + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: "string", + + trueBooleanValue: true, + + falseBooleanValue: false, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes string with escaping. + * + * This validates the three escape types: literal, decimal and hexadecimal. It also validates that unescaping properly + * handles the case where unescaping an & produces a newly formed escape sequence (this should not be re-unescaped). + * + * Servers may produce different output, this test is designed different unescapes clients must handle + * + */ +it("SimpleScalarPropertiesComplexEscapes:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + escaped data: &lt; + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: "escaped data: <\r\n", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes string with escaping + */ +it("SimpleScalarPropertiesWithEscapedCharacter:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + <string> + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: "", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties with xml preamble, comments and CDATA + */ +it("SimpleScalarPropertiesWithXMLPreamble:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + + + string + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: "string", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes string containing white space + */ +it("SimpleScalarPropertiesWithWhiteSpace:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + + string with white space + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: " string with white space ", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes string containing white space + */ +it("SimpleScalarPropertiesPureWhiteSpace:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-foo": "Foo", + "content-type": "application/xml", + }, + ` + + + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "Foo", + + stringValue: " ", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling NaN float values. + */ +it("RestXmlSupportsNaNFloatOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + NaN + NaN + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: NaN, + + doubleValue: NaN, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling Infinity float values. + */ +it("RestXmlSupportsInfinityFloatOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + Infinity + Infinity + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: Infinity, + + doubleValue: Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Supports handling -Infinity float values. + */ +it("RestXmlSupportsNegativeInfinityFloatOutputs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + -Infinity + -Infinity + + ` + ), + }); + + const params: any = {}; + const command = new SimpleScalarPropertiesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + floatValue: -Infinity, + + doubleValue: -Infinity, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests how timestamp request headers are serialized + */ +it("TimestampFormatHeaders:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new TimestampFormatHeadersCommand({ + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + } as any); + 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("/TimestampFormatHeaders"); + + expect(r.headers["x-defaultformat"]).toBeDefined(); + expect(r.headers["x-defaultformat"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + expect(r.headers["x-memberdatetime"]).toBeDefined(); + expect(r.headers["x-memberdatetime"]).toBe("2019-12-16T23:48:18Z"); + expect(r.headers["x-memberepochseconds"]).toBeDefined(); + expect(r.headers["x-memberepochseconds"]).toBe("1576540098"); + expect(r.headers["x-memberhttpdate"]).toBeDefined(); + expect(r.headers["x-memberhttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + expect(r.headers["x-targetdatetime"]).toBeDefined(); + expect(r.headers["x-targetdatetime"]).toBe("2019-12-16T23:48:18Z"); + expect(r.headers["x-targetepochseconds"]).toBeDefined(); + expect(r.headers["x-targetepochseconds"]).toBe("1576540098"); + expect(r.headers["x-targethttpdate"]).toBeDefined(); + expect(r.headers["x-targethttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); + + expect(r.body).toBeFalsy(); + } +}); + +/** + * Tests how timestamp response headers are serialized + */ +it("TimestampFormatHeaders:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "x-targetepochseconds": "1576540098", + "x-memberdatetime": "2019-12-16T23:48:18Z", + "x-defaultformat": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-memberepochseconds": "1576540098", + "x-targethttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-memberhttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", + "x-targetdatetime": "2019-12-16T23:48:18Z", + }, + `` + ), + }); + + const params: any = {}; + const command = new TimestampFormatHeadersCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + memberEpochSeconds: new Date(1576540098000), + + memberHttpDate: new Date(1576540098000), + + memberDateTime: new Date(1576540098000), + + defaultFormat: new Date(1576540098000), + + targetEpochSeconds: new Date(1576540098000), + + targetHttpDate: new Date(1576540098000), + + targetDateTime: new Date(1576540098000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML attributes on the synthesized document + */ +it("XmlAttributes:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlAttributesCommand({ + foo: "hi", + + attr: "test", + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlAttributes"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + hi + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes XML attributes with escaped characters on the synthesized document + */ +it("XmlAttributesWithEscaping:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlAttributesCommand({ + foo: "hi", + + attr: "", + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlAttributes"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + hi + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("XmlAttributes:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + hi + + ` + ), + }); + + const params: any = {}; + const command = new XmlAttributesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + foo: "hi", + + attr: "test", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML attributes on the synthesized document + */ +it("XmlAttributesOnPayload:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlAttributesOnPayloadCommand({ + payload: { + foo: "hi", + + attr: "test", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlAttributesOnPayload"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + hi + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("XmlAttributesOnPayload:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + hi + + ` + ), + }); + + const params: any = {}; + const command = new XmlAttributesOnPayloadCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + payload: { + foo: "hi", + + attr: "test", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Blobs are base64 encoded + */ +it("XmlBlobs:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlBlobsCommand({ + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + } as any); + 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("/XmlBlobs"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + dmFsdWU= + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Blobs are base64 encoded + */ +it("XmlBlobs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + dmFsdWU= + + ` + ), + }); + + const params: any = {}; + const command = new XmlBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("value", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty blobs are deserialized as empty string + */ +it("XmlEmptyBlobs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty self closed blobs are deserialized as empty string + */ +it("XmlEmptySelfClosedBlobs:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyBlobsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + data: Uint8Array.from("", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes Empty XML lists + */ +it("XmlEmptyLists:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlEmptyListsCommand({ + stringList: [], + + stringSet: [], + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlEmptyLists"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes Empty XML lists + */ +it("XmlEmptyLists:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: [], + + stringSet: [], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes Empty XML maps + */ +it("XmlEmptyMaps:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlEmptyMapsCommand({ + myMap: {} as any, + } as any); + 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("/XmlEmptyMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes Empty XML maps + */ +it("XmlEmptyMaps:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: {}, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Deserializes Empty Self-closed XML maps + */ +it("XmlEmptySelfClosedMaps:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: {}, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes xml empty strings + */ +it("XmlEmptyStrings:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlEmptyStringsCommand({ + emptyString: "", + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlEmptyStrings"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Deserializes xml empty strings + */ +it("XmlEmptyStrings:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyStringsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + emptyString: "", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Empty self closed string are deserialized as empty string + */ +it("XmlEmptySelfClosedStrings:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEmptyStringsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + emptyString: "", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes simple scalar properties + */ +it("XmlEnums:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlEnumsCommand({ + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlEnums"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + Foo + 0 + 1 + + Foo + 0 + + + Foo + 0 + + + + hi + Foo + + + zero + 0 + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes simple scalar properties + */ +it("XmlEnums:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + Foo + 0 + 1 + + Foo + 0 + + + Foo + 0 + + + + hi + Foo + + + zero + 0 + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlEnumsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + fooEnum1: "Foo", + + fooEnum2: "0", + + fooEnum3: "1", + + fooEnumList: ["Foo", "0"], + + fooEnumSet: ["Foo", "0"], + + fooEnumMap: { + hi: "Foo", + + zero: "0", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests for XML list serialization + */ +it("XmlLists:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlListsCommand({ + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + renamedListMembers: ["foo", "bar"], + + flattenedList: ["hi", "bye"], + + flattenedList2: ["yep", "nope"], + + structureList: [ + { + a: "1", + + b: "2", + } as any, + + { + a: "3", + + b: "4", + } as any, + ], + + flattenedStructureList: [ + { + a: "5", + + b: "6", + } as any, + + { + a: "7", + + b: "8", + } as any, + ], + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlLists"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + foo + bar + + + foo + bar + + + 1 + 2 + + + true + false + + + 2014-04-29T18:30:38Z + 2014-04-29T18:30:38Z + + + Foo + 0 + + + + foo + bar + + + baz + qux + + + + foo + bar + + hi + bye + yep + nope + + + 1 + 2 + + + 3 + 4 + + + + 5 + 6 + + + 7 + 8 + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests for XML list serialization + */ +it("XmlLists:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + foo + bar + + + foo + bar + + + 1 + 2 + + + true + false + + + 2014-04-29T18:30:38Z + 2014-04-29T18:30:38Z + + + Foo + 0 + + + + foo + bar + + + baz + qux + + + + foo + bar + + hi + bye + yep + nope + a + b + a + b + + + 1 + 2 + + + 3 + 4 + + + + 5 + 6 + + + 7 + 8 + + + ` + ), + }); + + const params: any = {}; + const command = new XmlListsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + stringList: ["foo", "bar"], + + stringSet: ["foo", "bar"], + + integerList: [ + 1, + + 2, + ], + + booleanList: [true, false], + + timestampList: [new Date(1398796238000), new Date(1398796238000)], + + enumList: ["Foo", "0"], + + nestedStringList: [ + ["foo", "bar"], + + ["baz", "qux"], + ], + + renamedListMembers: ["foo", "bar"], + + flattenedList: ["hi", "bye"], + + flattenedList2: ["yep", "nope"], + + flattenedListWithMemberNamespace: ["a", "b"], + + flattenedListWithNamespace: ["a", "b"], + + structureList: [ + { + a: "1", + + b: "2", + }, + + { + a: "3", + + b: "4", + }, + ], + + flattenedStructureList: [ + { + a: "5", + + b: "6", + }, + + { + a: "7", + + b: "8", + }, + ], + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests for XML map serialization + */ +it("XmlMaps:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlMapsCommand({ + myMap: { + foo: { + hi: "there", + } as any, + + baz: { + hi: "bye", + } as any, + } as any, + } as any); + 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("/XmlMaps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + foo + + there + + + + baz + + bye + + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests for XML map serialization + */ +it("XmlMaps:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + foo + + there + + + + baz + + bye + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlMapsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML maps that have xmlName on members + */ +it("XmlMapsXmlName:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlMapsXmlNameCommand({ + myMap: { + foo: { + hi: "there", + } as any, + + baz: { + hi: "bye", + } as any, + } as any, + } as any); + 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("/XmlMapsXmlName"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + foo + + there + + + + baz + + bye + + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes XML lists + */ +it("XmlMapsXmlName:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + foo + + there + + + + baz + + bye + + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlMapsXmlNameCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + myMap: { + foo: { + hi: "there", + }, + + baz: { + hi: "bye", + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes XML namespaces + */ +it("XmlNamespaces:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlNamespacesCommand({ + nested: { + foo: "Foo", + + values: ["Bar", "Baz"], + } as any, + } as any); + 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("/XmlNamespaces"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + Foo + + Bar + Baz + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes XML namespaces + */ +it("XmlNamespaces:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + Foo + + Bar + Baz + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlNamespacesCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + nested: { + foo: "Foo", + + values: ["Bar", "Baz"], + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests how normal timestamps are serialized + */ +it("XmlTimestamps:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlTimestampsCommand({ + normal: new Date(1398796238000), + } as any); + 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("/XmlTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + 2014-04-29T18:30:38Z + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("XmlTimestampsWithDateTimeFormat:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlTimestampsCommand({ + dateTime: new Date(1398796238000), + } as any); + 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("/XmlTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + 2014-04-29T18:30:38Z + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("XmlTimestampsWithEpochSecondsFormat:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlTimestampsCommand({ + epochSeconds: new Date(1398796238000), + } as any); + 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("/XmlTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + 1398796238 + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("XmlTimestampsWithHttpDateFormat:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlTimestampsCommand({ + httpDate: new Date(1398796238000), + } as any); + 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("/XmlTimestamps"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + Tue, 29 Apr 2014 18:30:38 GMT + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests how normal timestamps are serialized + */ +it("XmlTimestamps:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + 2014-04-29T18:30:38Z + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + normal: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of date-time works like normal timestamps + */ +it("XmlTimestampsWithDateTimeFormat:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + 2014-04-29T18:30:38Z + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + dateTime: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of epoch-seconds works + */ +it("XmlTimestampsWithEpochSecondsFormat:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + 1398796238 + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + epochSeconds: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Ensures that the timestampFormat of http-date works + */ +it("XmlTimestampsWithHttpDateFormat:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + Tue, 29 Apr 2014 18:30:38 GMT + + ` + ), + }); + + const params: any = {}; + const command = new XmlTimestampsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + httpDate: new Date(1398796238000), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes union struct member + */ +it("XmlUnionsWithStructMember:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlUnionsCommand({ + unionValue: { + structValue: { + stringValue: "string", + + booleanValue: true, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + string + true + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * serialize union string member + */ +it("XmlUnionsWithStringMember:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlUnionsCommand({ + unionValue: { + stringValue: "some string", + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + some string + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes union boolean member + */ +it("XmlUnionsWithBooleanMember:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlUnionsCommand({ + unionValue: { + booleanValue: true, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + true + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes union union member + */ +it("XmlUnionsWithUnionMember:Request", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new XmlUnionsCommand({ + unionValue: { + unionValue: { + booleanValue: true, + } as any, + } as any, + } as any); + 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("PUT"); + expect(r.path).toBe("/XmlUnions"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/xml"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = ` + + + true + + + + `; + const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Serializes union struct member + */ +it("XmlUnionsWithStructMember:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + string + true + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + unionValue: { + structValue: { + stringValue: "string", + + booleanValue: true, + + byteValue: 1, + + shortValue: 2, + + integerValue: 3, + + longValue: 4, + + floatValue: 5.5, + + doubleValue: 6.5, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes union string member + */ +it("XmlUnionsWithStringMember:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + some string + + + ` + ), + }); + + const params: any = {}; + const command = new XmlUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + unionValue: { + stringValue: "some string", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes union boolean member + */ +it("XmlUnionsWithBooleanMember:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + true + + + ` + ), + }); + + const params: any = {}; + const command = new XmlUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + unionValue: { + booleanValue: true, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Serializes union union member + */ +it("XmlUnionsWithUnionMember:Response", async () => { + const client = new RestXmlProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/xml", + }, + ` + + + true + + + + ` + ), + }); + + const params: any = {}; + const command = new XmlUnionsCommand(params); + + let r: any; + try { + r = await client.send(command); + } catch (err) { + fail("Expected a valid response to be returned, got err."); + return; + } + expect(r["$metadata"].httpStatusCode).toBe(200); + const paramsToValidate: any = [ + { + unionValue: { + unionValue: { + booleanValue: true, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * 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); +}; + +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentXmlBodies = (expectedBody: string, generatedBody: string): Object => { + const parseConfig = { + attributeNamePrefix: "", + ignoreAttributes: false, + parseNodeValue: false, + trimValues: false, + tagValueProcessor: (val: any, tagName: any) => (val.trim() === "" ? "" : decodeHTML(val)), + }; + + const parseXmlBody = (body: string) => { + const parsedObj = xmlParse(body, parseConfig); + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return parsedObj; + }; + + const expectedParts = parseXmlBody(expectedBody); + const generatedParts = parseXmlBody(generatedBody); + + return compareParts(expectedParts, generatedParts); +}; diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.json new file mode 100644 index 000000000000..2d7dc445bb52 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "rootDir": "src", + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json new file mode 100644 index 000000000000..b7018298d8ae --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types" + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} From f7679cceba36a23d1d0d5e93e550963bb33eb3e5 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Oct 2021 22:56:36 +0000 Subject: [PATCH 02/11] fix(protocol_tests): remove legacy paths from .gitignore --- protocol_tests/aws-protocoltests-ec2/.gitignore | 2 +- protocol_tests/aws-protocoltests-ec2/jest.config.js | 5 +++++ protocol_tests/aws-protocoltests-json/jest.config.js | 5 +++++ protocol_tests/aws-protocoltests-query/jest.config.js | 5 +++++ protocol_tests/aws-protocoltests-restjson/jest.config.js | 5 +++++ protocol_tests/aws-protocoltests-restxml/.gitignore | 6 +----- protocol_tests/aws-protocoltests-restxml/jest.config.js | 5 +++++ 7 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 protocol_tests/aws-protocoltests-ec2/jest.config.js create mode 100644 protocol_tests/aws-protocoltests-json/jest.config.js create mode 100644 protocol_tests/aws-protocoltests-query/jest.config.js create mode 100644 protocol_tests/aws-protocoltests-restjson/jest.config.js create mode 100644 protocol_tests/aws-protocoltests-restxml/jest.config.js diff --git a/protocol_tests/aws-protocoltests-ec2/.gitignore b/protocol_tests/aws-protocoltests-ec2/.gitignore index bff6121c007d..54f14c9aef25 100644 --- a/protocol_tests/aws-protocoltests-ec2/.gitignore +++ b/protocol_tests/aws-protocoltests-ec2/.gitignore @@ -6,4 +6,4 @@ *.tsbuildinfo *.tgz *.log -package-lock.json \ No newline at end of file +package-lock.json diff --git a/protocol_tests/aws-protocoltests-ec2/jest.config.js b/protocol_tests/aws-protocoltests-ec2/jest.config.js new file mode 100644 index 000000000000..a8d1c2e49912 --- /dev/null +++ b/protocol_tests/aws-protocoltests-ec2/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, +}; diff --git a/protocol_tests/aws-protocoltests-json/jest.config.js b/protocol_tests/aws-protocoltests-json/jest.config.js new file mode 100644 index 000000000000..a8d1c2e49912 --- /dev/null +++ b/protocol_tests/aws-protocoltests-json/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, +}; diff --git a/protocol_tests/aws-protocoltests-query/jest.config.js b/protocol_tests/aws-protocoltests-query/jest.config.js new file mode 100644 index 000000000000..a8d1c2e49912 --- /dev/null +++ b/protocol_tests/aws-protocoltests-query/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, +}; diff --git a/protocol_tests/aws-protocoltests-restjson/jest.config.js b/protocol_tests/aws-protocoltests-restjson/jest.config.js new file mode 100644 index 000000000000..a8d1c2e49912 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restjson/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, +}; diff --git a/protocol_tests/aws-protocoltests-restxml/.gitignore b/protocol_tests/aws-protocoltests-restxml/.gitignore index 619adfbf932a..bff6121c007d 100644 --- a/protocol_tests/aws-protocoltests-restxml/.gitignore +++ b/protocol_tests/aws-protocoltests-restxml/.gitignore @@ -6,8 +6,4 @@ *.tsbuildinfo *.tgz *.log -package-lock.json - -*.d.ts -*.js -*.js.map +package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-restxml/jest.config.js b/protocol_tests/aws-protocoltests-restxml/jest.config.js new file mode 100644 index 000000000000..a8d1c2e49912 --- /dev/null +++ b/protocol_tests/aws-protocoltests-restxml/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, +}; From 9566e4f49502d887afc09c8224731d2cfde5f6ad Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Oct 2021 22:58:47 +0000 Subject: [PATCH 03/11] chore(protocol_tests): rename protocol test client names in code --- protocol_tests/aws-protocoltests-ec2/package.json | 4 ++-- protocol_tests/aws-protocoltests-query/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol_tests/aws-protocoltests-ec2/package.json b/protocol_tests/aws-protocoltests-ec2/package.json index 1569ac1e83f0..c83a34ee69c2 100644 --- a/protocol_tests/aws-protocoltests-ec2/package.json +++ b/protocol_tests/aws-protocoltests-ec2/package.json @@ -87,10 +87,10 @@ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" }, "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-query", + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-ec2", "repository": { "type": "git", "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-query" + "directory": "clients/aws-protocoltests-ec2" } } diff --git a/protocol_tests/aws-protocoltests-query/package.json b/protocol_tests/aws-protocoltests-query/package.json index fe8342be5885..49d07b969ab1 100644 --- a/protocol_tests/aws-protocoltests-query/package.json +++ b/protocol_tests/aws-protocoltests-query/package.json @@ -87,10 +87,10 @@ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" }, "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-ec2", + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-query", "repository": { "type": "git", "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-ec2" + "directory": "clients/aws-protocoltests-query" } } From 9f74fc755ae794ee8ab048222f8dbc053ee493fe Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:03:28 +0000 Subject: [PATCH 04/11] chore(protocol_tests): update package name and description --- protocol_tests/aws-protocoltests-ec2/package.json | 4 ++-- protocol_tests/aws-protocoltests-query/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol_tests/aws-protocoltests-ec2/package.json b/protocol_tests/aws-protocoltests-ec2/package.json index c83a34ee69c2..fe8342be5885 100644 --- a/protocol_tests/aws-protocoltests-ec2/package.json +++ b/protocol_tests/aws-protocoltests-ec2/package.json @@ -1,6 +1,6 @@ { - "name": "@aws-sdk/aws-protocoltests-query", - "description": "@aws-sdk/aws-protocoltests-query client", + "name": "@aws-sdk/aws-protocoltests-ec2", + "description": "@aws-sdk/aws-protocoltests-ec2 client", "version": "3.38.0", "scripts": { "build": "yarn build:cjs && yarn build:es && yarn build:types", diff --git a/protocol_tests/aws-protocoltests-query/package.json b/protocol_tests/aws-protocoltests-query/package.json index 49d07b969ab1..1569ac1e83f0 100644 --- a/protocol_tests/aws-protocoltests-query/package.json +++ b/protocol_tests/aws-protocoltests-query/package.json @@ -1,6 +1,6 @@ { - "name": "@aws-sdk/aws-protocoltests-ec2", - "description": "@aws-sdk/aws-protocoltests-ec2 client", + "name": "@aws-sdk/aws-protocoltests-query", + "description": "@aws-sdk/aws-protocoltests-query client", "version": "3.38.0", "scripts": { "build": "yarn build:cjs && yarn build:es && yarn build:types", From 531eb814c161c8ab994fb9fe5f4d33d02f952f37 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:27:40 +0000 Subject: [PATCH 05/11] chore(protocol_tests): rename folder to private --- private/aws-protocoltests-ec2/.gitignore | 2 +- .../aws-protocoltests-ec2/.gitignore | 9 - .../aws-protocoltests-ec2/CHANGELOG.md | 775 -- protocol_tests/aws-protocoltests-ec2/LICENSE | 201 - .../aws-protocoltests-ec2/README.md | 203 - .../aws-protocoltests-ec2/jest.config.js | 5 - .../aws-protocoltests-ec2/package.json | 96 - .../aws-protocoltests-ec2/src/EC2Protocol.ts | 752 -- .../src/EC2ProtocolClient.ts | 295 - .../EmptyInputAndEmptyOutputCommand.ts | 98 - .../src/commands/EndpointOperationCommand.ts | 77 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/GreetingWithErrorsCommand.ts | 99 - .../commands/HostWithPathOperationCommand.ts | 77 - .../commands/IgnoresWrappingXmlNameCommand.ts | 97 - .../src/commands/NestedStructuresCommand.ts | 95 - .../src/commands/NoInputAndOutputCommand.ts | 98 - .../QueryIdempotencyTokenAutoFillCommand.ts | 98 - .../src/commands/QueryListsCommand.ts | 92 - .../src/commands/QueryTimestampsCommand.ts | 96 - .../src/commands/RecursiveXmlShapesCommand.ts | 95 - .../src/commands/SimpleInputParamsCommand.ts | 95 - .../SimpleScalarXmlPropertiesCommand.ts | 81 - .../src/commands/XmlBlobsCommand.ts | 92 - .../src/commands/XmlEmptyBlobsCommand.ts | 75 - .../src/commands/XmlEmptyListsCommand.ts | 75 - .../src/commands/XmlEnumsCommand.ts | 92 - .../src/commands/XmlListsCommand.ts | 102 - .../src/commands/XmlNamespacesCommand.ts | 75 - .../src/commands/XmlTimestampsCommand.ts | 94 - .../src/commands/index.ts | 21 - .../aws-protocoltests-ec2/src/endpoints.ts | 62 - .../aws-protocoltests-ec2/src/index.ts | 4 - .../aws-protocoltests-ec2/src/models/index.ts | 1 - .../src/models/models_0.ts | 433 - .../src/protocols/Aws_ec2.ts | 2273 ----- .../src/runtimeConfig.browser.ts | 37 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 40 - .../test/functional/ec2query.spec.ts | 2344 ----- .../aws-protocoltests-ec2/tsconfig.es.json | 10 - .../aws-protocoltests-ec2/tsconfig.json | 32 - .../aws-protocoltests-ec2/tsconfig.types.json | 9 - .../aws-protocoltests-json-10/.gitignore | 9 - .../aws-protocoltests-json-10/CHANGELOG.md | 195 - .../aws-protocoltests-json-10/LICENSE | 201 - .../aws-protocoltests-json-10/README.md | 201 - .../aws-protocoltests-json-10/jest.config.js | 4 - .../aws-protocoltests-json-10/package.json | 94 - .../src/JSONRPC10.ts | 331 - .../src/JSONRPC10Client.ts | 250 - .../EmptyInputAndEmptyOutputCommand.ts | 98 - .../src/commands/EndpointOperationCommand.ts | 77 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/GreetingWithErrorsCommand.ts | 102 - .../commands/HostWithPathOperationCommand.ts | 77 - .../src/commands/JsonUnionsCommand.ts | 95 - .../src/commands/NoInputAndNoOutputCommand.ts | 96 - .../src/commands/NoInputAndOutputCommand.ts | 98 - .../commands/SimpleScalarPropertiesCommand.ts | 78 - .../src/commands/index.ts | 9 - .../src/endpoints.ts | 62 - .../aws-protocoltests-json-10/src/index.ts | 4 - .../src/models/index.ts | 1 - .../src/models/models_0.ts | 362 - .../src/protocols/Aws_json1_0.ts | 959 --- .../src/runtimeConfig.browser.ts | 37 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 40 - .../test/functional/awsjson1_0.spec.ts | 2058 ----- .../tsconfig.es.json | 10 - .../aws-protocoltests-json-10/tsconfig.json | 32 - .../tsconfig.types.json | 9 - .../aws-protocoltests-json/.gitignore | 9 - .../aws-protocoltests-json/CHANGELOG.md | 764 -- protocol_tests/aws-protocoltests-json/LICENSE | 201 - .../aws-protocoltests-json/README.md | 201 - .../aws-protocoltests-json/jest.config.js | 5 - .../aws-protocoltests-json/package.json | 97 - .../src/JsonProtocol.ts | 412 - .../src/JsonProtocolClient.ts | 287 - .../src/commands/EmptyOperationCommand.ts | 77 - .../src/commands/EndpointOperationCommand.ts | 77 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/GreetingWithErrorsCommand.ts | 102 - .../commands/HostWithPathOperationCommand.ts | 77 - .../src/commands/JsonEnumsCommand.ts | 92 - .../src/commands/JsonUnionsCommand.ts | 95 - .../commands/KitchenSinkOperationCommand.ts | 78 - .../src/commands/NullOperationCommand.ts | 78 - ...OperationWithOptionalInputOutputCommand.ts | 84 - .../PutAndGetInlineDocumentsCommand.ts | 95 - .../commands/SimpleScalarPropertiesCommand.ts | 78 - .../src/commands/index.ts | 12 - .../aws-protocoltests-json/src/endpoints.ts | 62 - .../aws-protocoltests-json/src/index.ts | 4 - .../src/models/index.ts | 1 - .../src/models/models_0.ts | 504 -- .../src/protocols/Aws_json1_1.ts | 1867 ---- .../src/runtimeConfig.browser.ts | 41 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 46 - .../test/functional/awsjson1_1.spec.ts | 4565 ---------- .../aws-protocoltests-json/tsconfig.es.json | 10 - .../aws-protocoltests-json/tsconfig.json | 32 - .../tsconfig.types.json | 9 - .../aws-protocoltests-query/.gitignore | 9 - .../aws-protocoltests-query/CHANGELOG.md | 775 -- .../aws-protocoltests-query/LICENSE | 201 - .../aws-protocoltests-query/README.md | 203 - .../aws-protocoltests-query/jest.config.js | 5 - .../aws-protocoltests-query/package.json | 96 - .../src/QueryProtocol.ts | 1022 --- .../src/QueryProtocolClient.ts | 325 - .../EmptyInputAndEmptyOutputCommand.ts | 98 - .../src/commands/EndpointOperationCommand.ts | 77 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/FlattenedXmlMapCommand.ts | 95 - .../FlattenedXmlMapWithXmlNameCommand.ts | 98 - .../FlattenedXmlMapWithXmlNamespaceCommand.ts | 103 - .../src/commands/GreetingWithErrorsCommand.ts | 99 - .../commands/HostWithPathOperationCommand.ts | 77 - .../commands/IgnoresWrappingXmlNameCommand.ts | 98 - .../src/commands/NestedStructuresCommand.ts | 95 - .../src/commands/NoInputAndNoOutputCommand.ts | 97 - .../src/commands/NoInputAndOutputCommand.ts | 98 - .../QueryIdempotencyTokenAutoFillCommand.ts | 98 - .../src/commands/QueryListsCommand.ts | 92 - .../src/commands/QueryMapsCommand.ts | 92 - .../src/commands/QueryTimestampsCommand.ts | 99 - .../src/commands/RecursiveXmlShapesCommand.ts | 95 - .../src/commands/SimpleInputParamsCommand.ts | 95 - .../SimpleScalarXmlPropertiesCommand.ts | 81 - .../src/commands/XmlBlobsCommand.ts | 92 - .../src/commands/XmlEmptyBlobsCommand.ts | 78 - .../src/commands/XmlEmptyListsCommand.ts | 78 - .../src/commands/XmlEmptyMapsCommand.ts | 75 - .../src/commands/XmlEnumsCommand.ts | 92 - .../src/commands/XmlListsCommand.ts | 101 - .../src/commands/XmlMapsCommand.ts | 92 - .../src/commands/XmlMapsXmlNameCommand.ts | 78 - .../src/commands/XmlNamespacesCommand.ts | 78 - .../src/commands/XmlTimestampsCommand.ts | 97 - .../src/commands/index.ts | 29 - .../aws-protocoltests-query/src/endpoints.ts | 62 - .../aws-protocoltests-query/src/index.ts | 4 - .../src/models/index.ts | 1 - .../src/models/models_0.ts | 544 -- .../src/protocols/Aws_query.ts | 3103 ------- .../src/runtimeConfig.browser.ts | 37 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 40 - .../test/functional/awsquery.spec.ts | 3117 ------- .../aws-protocoltests-query/tsconfig.es.json | 10 - .../aws-protocoltests-query/tsconfig.json | 32 - .../tsconfig.types.json | 9 - .../aws-protocoltests-restjson/.gitignore | 9 - .../aws-protocoltests-restjson/CHANGELOG.md | 784 -- .../aws-protocoltests-restjson/LICENSE | 201 - .../aws-protocoltests-restjson/README.md | 203 - .../aws-protocoltests-restjson/jest.config.js | 5 - .../aws-protocoltests-restjson/package.json | 99 - .../src/RestJsonProtocol.ts | 2796 ------ .../src/RestJsonProtocolClient.ts | 605 -- .../commands/AllQueryStringTypesCommand.ts | 95 - .../ConstantAndVariableQueryStringCommand.ts | 103 - .../commands/ConstantQueryStringCommand.ts | 98 - .../commands/DocumentTypeAsPayloadCommand.ts | 95 - .../src/commands/DocumentTypeCommand.ts | 95 - .../EmptyInputAndEmptyOutputCommand.ts | 98 - .../src/commands/EndpointOperationCommand.ts | 77 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/GreetingWithErrorsCommand.ts | 104 - .../commands/HostWithPathOperationCommand.ts | 77 - .../commands/HttpChecksumRequiredCommand.ts | 97 - .../src/commands/HttpEnumPayloadCommand.ts | 78 - .../src/commands/HttpPayloadTraitsCommand.ts | 98 - .../HttpPayloadTraitsWithMediaTypeCommand.ts | 104 - .../HttpPayloadWithStructureCommand.ts | 98 - .../src/commands/HttpPrefixHeadersCommand.ts | 95 - .../HttpPrefixHeadersResponseCommand.ts | 98 - .../HttpRequestWithFloatLabelsCommand.ts | 81 - ...HttpRequestWithGreedyLabelInPathCommand.ts | 84 - ...uestWithLabelsAndTimestampFormatCommand.ts | 106 - .../commands/HttpRequestWithLabelsCommand.ts | 96 - .../src/commands/HttpResponseCodeCommand.ts | 78 - .../src/commands/HttpStringPayloadCommand.ts | 78 - .../IgnoreQueryParamsInResponseCommand.ts | 100 - .../InputAndOutputWithHeadersCommand.ts | 99 - .../src/commands/JsonBlobsCommand.ts | 95 - .../src/commands/JsonEnumsCommand.ts | 95 - .../src/commands/JsonListsCommand.ts | 101 - .../src/commands/JsonMapsCommand.ts | 95 - .../src/commands/JsonTimestampsCommand.ts | 97 - .../src/commands/JsonUnionsCommand.ts | 95 - .../MalformedAcceptWithBodyCommand.ts | 78 - ...MalformedAcceptWithGenericStringCommand.ts | 84 - .../MalformedAcceptWithPayloadCommand.ts | 81 - .../src/commands/MalformedBlobCommand.ts | 78 - .../src/commands/MalformedBooleanCommand.ts | 78 - .../src/commands/MalformedByteCommand.ts | 78 - .../MalformedContentTypeWithBodyCommand.ts | 81 - ...rmedContentTypeWithGenericStringCommand.ts | 84 - .../MalformedContentTypeWithPayloadCommand.ts | 84 - .../MalformedContentTypeWithoutBodyCommand.ts | 83 - .../src/commands/MalformedDoubleCommand.ts | 78 - .../src/commands/MalformedFloatCommand.ts | 78 - .../src/commands/MalformedIntegerCommand.ts | 78 - .../src/commands/MalformedListCommand.ts | 78 - .../src/commands/MalformedLongCommand.ts | 78 - .../src/commands/MalformedMapCommand.ts | 78 - .../commands/MalformedRequestBodyCommand.ts | 78 - .../src/commands/MalformedSetCommand.ts | 78 - .../src/commands/MalformedShortCommand.ts | 78 - .../src/commands/MalformedStringCommand.ts | 78 - .../MalformedTimestampBodyDateTimeCommand.ts | 84 - .../MalformedTimestampBodyDefaultCommand.ts | 81 - .../MalformedTimestampBodyHttpDateCommand.ts | 84 - ...MalformedTimestampHeaderDateTimeCommand.ts | 84 - .../MalformedTimestampHeaderDefaultCommand.ts | 84 - .../MalformedTimestampHeaderEpochCommand.ts | 81 - .../MalformedTimestampPathDefaultCommand.ts | 81 - .../MalformedTimestampPathEpochCommand.ts | 81 - .../MalformedTimestampPathHttpDateCommand.ts | 84 - .../MalformedTimestampQueryDefaultCommand.ts | 84 - .../MalformedTimestampQueryEpochCommand.ts | 81 - .../MalformedTimestampQueryHttpDateCommand.ts | 84 - .../src/commands/MalformedUnionCommand.ts | 78 - .../src/commands/MediaTypeHeaderCommand.ts | 95 - .../src/commands/NoInputAndNoOutputCommand.ts | 96 - .../src/commands/NoInputAndOutputCommand.ts | 98 - .../NullAndEmptyHeadersClientCommand.ts | 98 - .../NullAndEmptyHeadersServerCommand.ts | 98 - .../OmitsNullSerializesEmptyStringCommand.ts | 101 - .../QueryIdempotencyTokenAutoFillCommand.ts | 98 - .../QueryParamsAsStringListMapCommand.ts | 81 - .../src/commands/QueryPrecedenceCommand.ts | 78 - .../src/commands/RecursiveShapesCommand.ts | 95 - .../commands/SimpleScalarPropertiesCommand.ts | 78 - .../src/commands/StreamingTraitsCommand.ts | 107 - .../StreamingTraitsRequireLengthCommand.ts | 113 - .../StreamingTraitsWithMediaTypeCommand.ts | 112 - .../commands/TimestampFormatHeadersCommand.ts | 95 - .../src/commands/index.ts | 79 - .../src/endpoints.ts | 62 - .../aws-protocoltests-restjson/src/index.ts | 4 - .../src/models/index.ts | 1 - .../src/models/models_0.ts | 1530 ---- .../src/protocols/Aws_restJson1.ts | 7387 ---------------- .../src/runtimeConfig.browser.ts | 41 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 44 - .../test/functional/restjson1.spec.ts | 7617 ----------------- .../tsconfig.es.json | 10 - .../aws-protocoltests-restjson/tsconfig.json | 32 - .../tsconfig.types.json | 9 - .../aws-protocoltests-restxml/.gitignore | 9 - .../aws-protocoltests-restxml/CHANGELOG.md | 797 -- .../aws-protocoltests-restxml/LICENSE | 201 - .../aws-protocoltests-restxml/README.md | 203 - .../aws-protocoltests-restxml/jest.config.js | 5 - .../aws-protocoltests-restxml/package.json | 98 - .../src/RestXmlProtocol.ts | 1919 ----- .../src/RestXmlProtocolClient.ts | 457 - .../commands/AllQueryStringTypesCommand.ts | 95 - .../src/commands/BodyWithXmlNameCommand.ts | 96 - .../ConstantAndVariableQueryStringCommand.ts | 103 - .../commands/ConstantQueryStringCommand.ts | 98 - .../EmptyInputAndEmptyOutputCommand.ts | 98 - .../src/commands/EndpointOperationCommand.ts | 77 - ...ointWithHostLabelHeaderOperationCommand.ts | 84 - .../EndpointWithHostLabelOperationCommand.ts | 84 - .../src/commands/FlattenedXmlMapCommand.ts | 95 - .../FlattenedXmlMapWithXmlNameCommand.ts | 100 - .../FlattenedXmlMapWithXmlNamespaceCommand.ts | 103 - .../src/commands/GreetingWithErrorsCommand.ts | 103 - .../src/commands/HttpPayloadTraitsCommand.ts | 98 - .../HttpPayloadTraitsWithMediaTypeCommand.ts | 104 - .../HttpPayloadWithMemberXmlNameCommand.ts | 101 - .../HttpPayloadWithStructureCommand.ts | 98 - .../commands/HttpPayloadWithXmlNameCommand.ts | 96 - ...PayloadWithXmlNamespaceAndPrefixCommand.ts | 104 - .../HttpPayloadWithXmlNamespaceCommand.ts | 100 - .../src/commands/HttpPrefixHeadersCommand.ts | 95 - .../HttpRequestWithFloatLabelsCommand.ts | 81 - ...HttpRequestWithGreedyLabelInPathCommand.ts | 84 - ...uestWithLabelsAndTimestampFormatCommand.ts | 106 - .../commands/HttpRequestWithLabelsCommand.ts | 96 - .../src/commands/HttpResponseCodeCommand.ts | 78 - .../IgnoreQueryParamsInResponseCommand.ts | 100 - .../InputAndOutputWithHeadersCommand.ts | 99 - .../src/commands/NestedXmlMapsCommand.ts | 78 - .../src/commands/NoInputAndNoOutputCommand.ts | 96 - .../src/commands/NoInputAndOutputCommand.ts | 98 - .../NullAndEmptyHeadersClientCommand.ts | 98 - .../NullAndEmptyHeadersServerCommand.ts | 98 - .../OmitsNullSerializesEmptyStringCommand.ts | 101 - .../QueryIdempotencyTokenAutoFillCommand.ts | 98 - .../QueryParamsAsStringListMapCommand.ts | 81 - .../src/commands/QueryPrecedenceCommand.ts | 78 - .../src/commands/RecursiveShapesCommand.ts | 95 - .../commands/SimpleScalarPropertiesCommand.ts | 78 - .../commands/TimestampFormatHeadersCommand.ts | 95 - .../src/commands/XmlAttributesCommand.ts | 95 - .../commands/XmlAttributesOnPayloadCommand.ts | 95 - .../src/commands/XmlBlobsCommand.ts | 92 - .../src/commands/XmlEmptyBlobsCommand.ts | 95 - .../src/commands/XmlEmptyListsCommand.ts | 78 - .../src/commands/XmlEmptyMapsCommand.ts | 78 - .../src/commands/XmlEmptyStringsCommand.ts | 78 - .../src/commands/XmlEnumsCommand.ts | 92 - .../src/commands/XmlListsCommand.ts | 103 - .../src/commands/XmlMapsCommand.ts | 92 - .../src/commands/XmlMapsXmlNameCommand.ts | 78 - .../src/commands/XmlNamespacesCommand.ts | 78 - .../src/commands/XmlTimestampsCommand.ts | 97 - .../src/commands/XmlUnionsCommand.ts | 75 - .../src/commands/index.ts | 53 - .../src/endpoints.ts | 62 - .../aws-protocoltests-restxml/src/index.ts | 4 - .../src/models/index.ts | 1 - .../src/models/models_0.ts | 1141 --- .../src/protocols/Aws_restXml.ts | 6221 -------------- .../src/runtimeConfig.browser.ts | 37 - .../src/runtimeConfig.native.ts | 17 - .../src/runtimeConfig.shared.ts | 17 - .../src/runtimeConfig.ts | 40 - .../test/functional/restxml.spec.ts | 6778 --------------- .../tsconfig.es.json | 10 - .../aws-protocoltests-restxml/tsconfig.json | 32 - .../tsconfig.types.json | 9 - 336 files changed, 1 insertion(+), 89257 deletions(-) delete mode 100644 protocol_tests/aws-protocoltests-ec2/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-ec2/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-ec2/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-ec2/README.md delete mode 100644 protocol_tests/aws-protocoltests-ec2/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-ec2/package.json delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-ec2/tsconfig.types.json delete mode 100644 protocol_tests/aws-protocoltests-json-10/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-json-10/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-json-10/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-json-10/README.md delete mode 100644 protocol_tests/aws-protocoltests-json-10/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-json-10/package.json delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-json-10/tsconfig.types.json delete mode 100644 protocol_tests/aws-protocoltests-json/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-json/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-json/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-json/README.md delete mode 100644 protocol_tests/aws-protocoltests-json/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-json/package.json delete mode 100644 protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-json/tsconfig.types.json delete mode 100644 protocol_tests/aws-protocoltests-query/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-query/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-query/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-query/README.md delete mode 100644 protocol_tests/aws-protocoltests-query/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-query/package.json delete mode 100644 protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-query/tsconfig.types.json delete mode 100644 protocol_tests/aws-protocoltests-restjson/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-restjson/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-restjson/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-restjson/README.md delete mode 100644 protocol_tests/aws-protocoltests-restjson/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-restjson/package.json delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBlobCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedByteCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedFloatCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedListCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedLongCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedMapCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedSetCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedShortCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MalformedUnionCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-restjson/tsconfig.types.json delete mode 100644 protocol_tests/aws-protocoltests-restxml/.gitignore delete mode 100644 protocol_tests/aws-protocoltests-restxml/CHANGELOG.md delete mode 100644 protocol_tests/aws-protocoltests-restxml/LICENSE delete mode 100644 protocol_tests/aws-protocoltests-restxml/README.md delete mode 100644 protocol_tests/aws-protocoltests-restxml/jest.config.js delete mode 100644 protocol_tests/aws-protocoltests-restxml/package.json delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/commands/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/endpoints.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/models/index.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts delete mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.es.json delete mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.json delete mode 100644 protocol_tests/aws-protocoltests-restxml/tsconfig.types.json diff --git a/private/aws-protocoltests-ec2/.gitignore b/private/aws-protocoltests-ec2/.gitignore index bff6121c007d..54f14c9aef25 100644 --- a/private/aws-protocoltests-ec2/.gitignore +++ b/private/aws-protocoltests-ec2/.gitignore @@ -6,4 +6,4 @@ *.tsbuildinfo *.tgz *.log -package-lock.json \ No newline at end of file +package-lock.json diff --git a/protocol_tests/aws-protocoltests-ec2/.gitignore b/protocol_tests/aws-protocoltests-ec2/.gitignore deleted file mode 100644 index 54f14c9aef25..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json diff --git a/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md b/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md deleted file mode 100644 index 7f11dd91a020..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/CHANGELOG.md +++ /dev/null @@ -1,775 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - - -### Bug Fixes - -* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - -### Features - -* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) - - - - - -# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) - - -### Bug Fixes - -* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) - - - - - -# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) - - -### Features - -* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) -* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) - - - - - -# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) - - -### Features - -* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) - - - - - -# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) - - -### Bug Fixes - -* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) - - - - - -# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) - - -### Bug Fixes - -* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) - - - - - -# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) - - -### Bug Fixes - -* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) - - -### Features - -* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) - - - - - -## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) - - -### Features - -* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) - - - - - -# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) - - -### Bug Fixes - -* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) - - -### Features - -* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) - - - - - -# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) - - -### Bug Fixes - -* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) - - - - - -# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) - - -### Features - -* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) - - - - - -# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) - - -### Bug Fixes - -* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) - - - - - -# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) - - -### Bug Fixes - -* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) - - - - - -# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) - - -### Bug Fixes - -* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) - - - - - -# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) - - -### Bug Fixes - -* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) - - - - - -# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) - - -### Features - -* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) -* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) - - - - - -# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) - - -### Bug Fixes - -* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) -* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) - - -### Features - -* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) - - - - - -# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) - - -### Bug Fixes - -* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) - - - - - -# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) - - -### Bug Fixes - -* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) -* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) -* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) -* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) - - -### Features - -* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) - - - - - -# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) - - -### Features - -* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) - - - - - -# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) - - -### Bug Fixes - -* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) - - -### Features - -* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) - - - - - -# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) - - -### Features - -* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) - - - - - -# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) - - -### Bug Fixes - -* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) - - - - - -# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) - - -### Features - -* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) - - - - - -# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) - - -### Bug Fixes - -* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) - - - - - -# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) - - -### Features - -* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) - - - - - -# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.9...@aws-sdk/aws-ec2@1.0.0-gamma.10) (2020-10-07) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.8...@aws-sdk/aws-ec2@1.0.0-gamma.9) (2020-09-29) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.7...@aws-sdk/aws-ec2@1.0.0-gamma.8) (2020-09-15) - - -### Bug Fixes - -* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) -* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) - - - - - -# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.6...@aws-sdk/aws-ec2@1.0.0-gamma.7) (2020-09-01) - - -### Features - -* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) - - - - - -# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.5...@aws-sdk/aws-ec2@1.0.0-gamma.6) (2020-08-25) - - -### Features - -* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) -* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) -* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) - - - - - -# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.4...@aws-sdk/aws-ec2@1.0.0-gamma.5) (2020-08-04) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.3...@aws-sdk/aws-ec2@1.0.0-gamma.4) (2020-07-21) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-ec2@1.0.0-gamma.2...@aws-sdk/aws-ec2@1.0.0-gamma.3) (2020-07-13) - -**Note:** Version bump only for package @aws-sdk/aws-ec2 - - - - - -# 1.0.0-gamma.2 (2020-07-08) - - -### Features - -* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) - - - -# 1.0.0-gamma.2 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.1 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.0 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-beta.0 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-ec2/LICENSE b/protocol_tests/aws-protocoltests-ec2/LICENSE deleted file mode 100644 index dd65ae06be7a..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-ec2/README.md b/protocol_tests/aws-protocoltests-ec2/README.md deleted file mode 100644 index c81774a0da8b..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# @aws-sdk/aws-protocoltests-ec2 - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-ec2/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-ec2) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-ec2.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-ec2) - -## Description - -AWS SDK for JavaScript EC2Protocol Client for Node.js, Browser and React Native. - -An EC2 query service that sends query requests and XML responses. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-ec2 -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-ec2` -- `yarn add @aws-sdk/aws-protocoltests-ec2` -- `pnpm add @aws-sdk/aws-protocoltests-ec2` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `EC2ProtocolClient` and -the commands you need, for example `EmptyInputAndEmptyOutputCommand`: - -```js -// ES5 example -const { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); -``` - -```ts -// ES6+ example -import { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new EC2ProtocolClient({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new EmptyInputAndEmptyOutputCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-ec2"; -const client = new AWS.EC2Protocol({ region: "REGION" }); - -// async/await. -try { - const data = await client.emptyInputAndEmptyOutput(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .emptyInputAndEmptyOutput(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.emptyInputAndEmptyOutput(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-ec2` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-ec2/jest.config.js b/protocol_tests/aws-protocoltests-ec2/jest.config.js deleted file mode 100644 index a8d1c2e49912..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const base = require("../../jest.config.base.js"); - -module.exports = { - ...base, -}; diff --git a/protocol_tests/aws-protocoltests-ec2/package.json b/protocol_tests/aws-protocoltests-ec2/package.json deleted file mode 100644 index fe8342be5885..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-ec2", - "description": "@aws-sdk/aws-protocoltests-ec2 client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-ec2", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-ec2" - } -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts b/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts deleted file mode 100644 index 786316886587..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/EC2Protocol.ts +++ /dev/null @@ -1,752 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommand, - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - GreetingWithErrorsCommand, - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, -} from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommand, - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommand, - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "./commands/IgnoresWrappingXmlNameCommand"; -import { - NestedStructuresCommand, - NestedStructuresCommandInput, - NestedStructuresCommandOutput, -} from "./commands/NestedStructuresCommand"; -import { - NoInputAndOutputCommand, - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, -} from "./commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommand, - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommand, QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; -import { - QueryTimestampsCommand, - QueryTimestampsCommandInput, - QueryTimestampsCommandOutput, -} from "./commands/QueryTimestampsCommand"; -import { - RecursiveXmlShapesCommand, - RecursiveXmlShapesCommandInput, - RecursiveXmlShapesCommandOutput, -} from "./commands/RecursiveXmlShapesCommand"; -import { - SimpleInputParamsCommand, - SimpleInputParamsCommandInput, - SimpleInputParamsCommandOutput, -} from "./commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommand, - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "./commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { - XmlEmptyBlobsCommand, - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, -} from "./commands/XmlEmptyBlobsCommand"; -import { - XmlEmptyListsCommand, - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, -} from "./commands/XmlEmptyListsCommand"; -import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { - XmlNamespacesCommand, - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, -} from "./commands/XmlNamespacesCommand"; -import { - XmlTimestampsCommand, - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, -} from "./commands/XmlTimestampsCommand"; -import { EC2ProtocolClient } from "./EC2ProtocolClient"; - -/** - * An EC2 query service that sends query requests and XML responses. - */ -export class EC2Protocol extends EC2ProtocolClient { - /** - * The example tests how requests and responses are serialized when there's - * no request or response members. - * - * While this should be rare, code generators must support this. - */ - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), - cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): Promise | void { - const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 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. - * - * The wrapping element is always operation name + "Response". - */ - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): void; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): void; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void), - cb?: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): Promise | void { - const command = new IgnoresWrappingXmlNameCommand(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 test serializes nested and recursive structure members. - */ - public nestedStructures( - args: NestedStructuresCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nestedStructures( - args: NestedStructuresCommandInput, - cb: (err: any, data?: NestedStructuresCommandOutput) => void - ): void; - public nestedStructures( - args: NestedStructuresCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NestedStructuresCommandOutput) => void - ): void; - public nestedStructures( - args: NestedStructuresCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedStructuresCommandOutput) => void), - cb?: (err: any, data?: NestedStructuresCommandOutput) => void - ): Promise | void { - const command = new NestedStructuresCommand(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 example tests how requests and responses are serialized when there's - * no request payload or response members. - * - * While this should be rare, code generators must support this. - */ - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndOutputCommand(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); - } - } - - /** - * Automatically adds idempotency tokens. - */ - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), - cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): Promise | void { - const command = new QueryIdempotencyTokenAutoFillCommand(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 test serializes simple and complex lists. - */ - public queryLists(args: QueryListsCommandInput, options?: __HttpHandlerOptions): Promise; - public queryLists(args: QueryListsCommandInput, cb: (err: any, data?: QueryListsCommandOutput) => void): void; - public queryLists( - args: QueryListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryListsCommandOutput) => void - ): void; - public queryLists( - args: QueryListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryListsCommandOutput) => void), - cb?: (err: any, data?: QueryListsCommandOutput) => void - ): Promise | void { - const command = new QueryListsCommand(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 test serializes timestamps. - * - * 1. Timestamps are serialized as RFC 3339 date-time values by default. - * 2. A timestampFormat trait on a member changes the format. - * 3. A timestampFormat trait on the shape targeted by the member changes the format. - */ - public queryTimestamps( - args: QueryTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryTimestamps( - args: QueryTimestampsCommandInput, - cb: (err: any, data?: QueryTimestampsCommandOutput) => void - ): void; - public queryTimestamps( - args: QueryTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryTimestampsCommandOutput) => void - ): void; - public queryTimestamps( - args: QueryTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryTimestampsCommandOutput) => void), - cb?: (err: any, data?: QueryTimestampsCommandOutput) => void - ): Promise | void { - const command = new QueryTimestampsCommand(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); - } - } - - /** - * Recursive shapes - */ - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): void; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): void; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveXmlShapesCommandOutput) => void), - cb?: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): Promise | void { - const command = new RecursiveXmlShapesCommand(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 test serializes strings, numbers, and boolean values. - */ - public simpleInputParams( - args: SimpleInputParamsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - cb: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): void; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): void; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleInputParamsCommandOutput) => void), - cb?: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): Promise | void { - const command = new SimpleInputParamsCommand(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 simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): void; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): void; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarXmlPropertiesCommand(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); - } - } - - /** - * Blobs are base64 encoded - */ - public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlBlobsCommandOutput) => void - ): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlBlobsCommand(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 xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyBlobsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyListsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - /** - * This example serializes enums as top level properties, in lists, sets, and maps. - */ - public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; - public xmlEnums( - args: XmlEnumsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEnumsCommandOutput) => void - ): void; - public xmlEnums( - args: XmlEnumsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), - cb?: (err: any, data?: XmlEnumsCommandOutput) => void - ): Promise | void { - const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Flattened XML lists with @xmlNamespace. - * 8. Lists of structures. - */ - public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; - public xmlLists( - args: XmlListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlListsCommandOutput) => void - ): void; - public xmlLists( - args: XmlListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), - cb?: (err: any, data?: XmlListsCommandOutput) => void - ): Promise | void { - const command = new XmlListsCommand(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 xmlNamespaces( - args: XmlNamespacesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), - cb?: (err: any, data?: XmlNamespacesCommandOutput) => void - ): Promise | void { - const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - */ - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), - cb?: (err: any, data?: XmlTimestampsCommandOutput) => void - ): Promise | void { - const command = new XmlTimestampsCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts b/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts deleted file mode 100644 index 85e7dacae8b0..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/EC2ProtocolClient.ts +++ /dev/null @@ -1,295 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "./commands/IgnoresWrappingXmlNameCommand"; -import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "./commands/NestedStructuresCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; -import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "./commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "./commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "./commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "./commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | EmptyInputAndEmptyOutputCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | GreetingWithErrorsCommandInput - | HostWithPathOperationCommandInput - | IgnoresWrappingXmlNameCommandInput - | NestedStructuresCommandInput - | NoInputAndOutputCommandInput - | QueryIdempotencyTokenAutoFillCommandInput - | QueryListsCommandInput - | QueryTimestampsCommandInput - | RecursiveXmlShapesCommandInput - | SimpleInputParamsCommandInput - | SimpleScalarXmlPropertiesCommandInput - | XmlBlobsCommandInput - | XmlEmptyBlobsCommandInput - | XmlEmptyListsCommandInput - | XmlEnumsCommandInput - | XmlListsCommandInput - | XmlNamespacesCommandInput - | XmlTimestampsCommandInput; - -export type ServiceOutputTypes = - | EmptyInputAndEmptyOutputCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | GreetingWithErrorsCommandOutput - | HostWithPathOperationCommandOutput - | IgnoresWrappingXmlNameCommandOutput - | NestedStructuresCommandOutput - | NoInputAndOutputCommandOutput - | QueryIdempotencyTokenAutoFillCommandOutput - | QueryListsCommandOutput - | QueryTimestampsCommandOutput - | RecursiveXmlShapesCommandOutput - | SimpleInputParamsCommandOutput - | SimpleScalarXmlPropertiesCommandOutput - | XmlBlobsCommandOutput - | XmlEmptyBlobsCommandOutput - | XmlEmptyListsCommandOutput - | XmlEnumsCommandOutput - | XmlListsCommandOutput - | XmlNamespacesCommandOutput - | XmlTimestampsCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; -} - -type EC2ProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of EC2ProtocolClient class constructor that set the region, credentials and other options. - */ -export interface EC2ProtocolClientConfig extends EC2ProtocolClientConfigType {} - -type EC2ProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of EC2ProtocolClient class. This is resolved and normalized from the {@link EC2ProtocolClientConfig | constructor configuration interface}. - */ -export interface EC2ProtocolClientResolvedConfig extends EC2ProtocolClientResolvedConfigType {} - -/** - * An EC2 query service that sends query requests and XML responses. - */ -export class EC2ProtocolClient extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - EC2ProtocolClientResolvedConfig -> { - /** - * The resolved configuration of EC2ProtocolClient class. This is resolved and normalized from the {@link EC2ProtocolClientConfig | constructor configuration interface}. - */ - readonly config: EC2ProtocolClientResolvedConfig; - - constructor(configuration: EC2ProtocolClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveUserAgentConfig(_config_4); - super(_config_5); - this.config = _config_5; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts deleted file mode 100644 index 297a83eb5d00..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/EmptyInputAndEmptyOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; -import { - deserializeAws_ec2EmptyInputAndEmptyOutputCommand, - serializeAws_ec2EmptyInputAndEmptyOutputCommand, -} from "../protocols/Aws_ec2"; - -export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} -export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response members. - * - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new EmptyInputAndEmptyOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. - * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class EmptyInputAndEmptyOutputCommand extends $Command< - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { - // 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 = "EmptyInputAndEmptyOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2EmptyInputAndEmptyOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2EmptyInputAndEmptyOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index 2c9e807a9fa1..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_ec2EndpointOperationCommand, - serializeAws_ec2EndpointOperationCommand, -} from "../protocols/Aws_ec2"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // 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 = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2EndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2EndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index e77d0478ee69..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_ec2EndpointWithHostLabelOperationCommand, - serializeAws_ec2EndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_ec2"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // 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 = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_ec2EndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_ec2EndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index f25e159ed5b4..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,99 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_ec2GreetingWithErrorsCommand, - serializeAws_ec2GreetingWithErrorsCommand, -} from "../protocols/Aws_ec2"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // 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 = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2GreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2GreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts deleted file mode 100644 index ee85445b638f..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/HostWithPathOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts deleted file mode 100644 index 4f0ff1a0d316..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/IgnoresWrappingXmlNameCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -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 { IgnoresWrappingXmlNameOutput } from "../models/models_0"; -import { - deserializeAws_ec2IgnoresWrappingXmlNameCommand, - serializeAws_ec2IgnoresWrappingXmlNameCommand, -} from "../protocols/Aws_ec2"; - -export interface IgnoresWrappingXmlNameCommandInput {} -export interface IgnoresWrappingXmlNameCommandOutput extends IgnoresWrappingXmlNameOutput, __MetadataBearer {} - -/** - * The xmlName trait on the output structure is ignored in AWS Query. - * - * The wrapping element is always operation name + "Response". - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, IgnoresWrappingXmlNameCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, IgnoresWrappingXmlNameCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new IgnoresWrappingXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link IgnoresWrappingXmlNameCommandInput} for command's `input` shape. - * @see {@link IgnoresWrappingXmlNameCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class IgnoresWrappingXmlNameCommand extends $Command< - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: IgnoresWrappingXmlNameCommandInput) { - // 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 = "IgnoresWrappingXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: IgnoresWrappingXmlNameOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2IgnoresWrappingXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2IgnoresWrappingXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts deleted file mode 100644 index 3e05fe36a3ed..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/NestedStructuresCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { NestedStructuresInput } from "../models/models_0"; -import { - deserializeAws_ec2NestedStructuresCommand, - serializeAws_ec2NestedStructuresCommand, -} from "../protocols/Aws_ec2"; - -export interface NestedStructuresCommandInput extends NestedStructuresInput {} -export interface NestedStructuresCommandOutput extends __MetadataBearer {} - -/** - * This test serializes nested and recursive structure members. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, NestedStructuresCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, NestedStructuresCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new NestedStructuresCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NestedStructuresCommandInput} for command's `input` shape. - * @see {@link NestedStructuresCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NestedStructuresCommand extends $Command< - NestedStructuresCommandInput, - NestedStructuresCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NestedStructuresCommandInput) { - // 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 = "NestedStructuresCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NestedStructuresInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NestedStructuresCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2NestedStructuresCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2NestedStructuresCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts deleted file mode 100644 index f0f350cdaa5b..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/NoInputAndOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NoInputAndOutputOutput } from "../models/models_0"; -import { - deserializeAws_ec2NoInputAndOutputCommand, - serializeAws_ec2NoInputAndOutputCommand, -} from "../protocols/Aws_ec2"; - -export interface NoInputAndOutputCommandInput {} -export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request payload or response members. - * - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new NoInputAndOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndOutputCommand extends $Command< - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndOutputCommandInput) { - // 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 = "NoInputAndOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2NoInputAndOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2NoInputAndOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts deleted file mode 100644 index 569261e2dbc2..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryIdempotencyTokenAutoFillCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; -import { - deserializeAws_ec2QueryIdempotencyTokenAutoFillCommand, - serializeAws_ec2QueryIdempotencyTokenAutoFillCommand, -} from "../protocols/Aws_ec2"; - -export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} -export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} - -/** - * Automatically adds idempotency tokens. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new QueryIdempotencyTokenAutoFillCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. - * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryIdempotencyTokenAutoFillCommand extends $Command< - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { - // 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 = "QueryIdempotencyTokenAutoFillCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2QueryIdempotencyTokenAutoFillCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_ec2QueryIdempotencyTokenAutoFillCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts deleted file mode 100644 index a517481d22d8..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryListsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { QueryListsInput } from "../models/models_0"; -import { deserializeAws_ec2QueryListsCommand, serializeAws_ec2QueryListsCommand } from "../protocols/Aws_ec2"; - -export interface QueryListsCommandInput extends QueryListsInput {} -export interface QueryListsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes simple and complex lists. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, QueryListsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, QueryListsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new QueryListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryListsCommandInput} for command's `input` shape. - * @see {@link QueryListsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryListsCommand extends $Command< - QueryListsCommandInput, - QueryListsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryListsCommandInput) { - // 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 = "QueryListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryListsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2QueryListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2QueryListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts deleted file mode 100644 index 2a120e7eae9d..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/QueryTimestampsCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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 { QueryTimestampsInput } from "../models/models_0"; -import { deserializeAws_ec2QueryTimestampsCommand, serializeAws_ec2QueryTimestampsCommand } from "../protocols/Aws_ec2"; - -export interface QueryTimestampsCommandInput extends QueryTimestampsInput {} -export interface QueryTimestampsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes timestamps. - * - * 1. Timestamps are serialized as RFC 3339 date-time values by default. - * 2. A timestampFormat trait on a member changes the format. - * 3. A timestampFormat trait on the shape targeted by the member changes the format. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, QueryTimestampsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, QueryTimestampsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new QueryTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryTimestampsCommandInput} for command's `input` shape. - * @see {@link QueryTimestampsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryTimestampsCommand extends $Command< - QueryTimestampsCommandInput, - QueryTimestampsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryTimestampsCommandInput) { - // 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 = "QueryTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryTimestampsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2QueryTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2QueryTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts deleted file mode 100644 index 3133fa2a45d4..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/RecursiveXmlShapesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { RecursiveXmlShapesOutput } from "../models/models_0"; -import { - deserializeAws_ec2RecursiveXmlShapesCommand, - serializeAws_ec2RecursiveXmlShapesCommand, -} from "../protocols/Aws_ec2"; - -export interface RecursiveXmlShapesCommandInput {} -export interface RecursiveXmlShapesCommandOutput extends RecursiveXmlShapesOutput, __MetadataBearer {} - -/** - * Recursive shapes - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, RecursiveXmlShapesCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, RecursiveXmlShapesCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new RecursiveXmlShapesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link RecursiveXmlShapesCommandInput} for command's `input` shape. - * @see {@link RecursiveXmlShapesCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class RecursiveXmlShapesCommand extends $Command< - RecursiveXmlShapesCommandInput, - RecursiveXmlShapesCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: RecursiveXmlShapesCommandInput) { - // 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 = "RecursiveXmlShapesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: RecursiveXmlShapesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: RecursiveXmlShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2RecursiveXmlShapesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2RecursiveXmlShapesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts deleted file mode 100644 index 8b9f9a2cf2be..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleInputParamsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { SimpleInputParamsInput } from "../models/models_0"; -import { - deserializeAws_ec2SimpleInputParamsCommand, - serializeAws_ec2SimpleInputParamsCommand, -} from "../protocols/Aws_ec2"; - -export interface SimpleInputParamsCommandInput extends SimpleInputParamsInput {} -export interface SimpleInputParamsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes strings, numbers, and boolean values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, SimpleInputParamsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, SimpleInputParamsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new SimpleInputParamsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link SimpleInputParamsCommandInput} for command's `input` shape. - * @see {@link SimpleInputParamsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class SimpleInputParamsCommand extends $Command< - SimpleInputParamsCommandInput, - SimpleInputParamsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleInputParamsCommandInput) { - // 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 = "SimpleInputParamsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleInputParamsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleInputParamsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2SimpleInputParamsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2SimpleInputParamsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts deleted file mode 100644 index 8d1f1e0e2ec1..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/SimpleScalarXmlPropertiesCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { SimpleScalarXmlPropertiesOutput } from "../models/models_0"; -import { - deserializeAws_ec2SimpleScalarXmlPropertiesCommand, - serializeAws_ec2SimpleScalarXmlPropertiesCommand, -} from "../protocols/Aws_ec2"; - -export interface SimpleScalarXmlPropertiesCommandInput {} -export interface SimpleScalarXmlPropertiesCommandOutput extends SimpleScalarXmlPropertiesOutput, __MetadataBearer {} - -export class SimpleScalarXmlPropertiesCommand extends $Command< - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarXmlPropertiesCommandInput) { - // 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 = "SimpleScalarXmlPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: SimpleScalarXmlPropertiesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarXmlPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2SimpleScalarXmlPropertiesCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_ec2SimpleScalarXmlPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts deleted file mode 100644 index 1232529f538a..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlBlobsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlBlobsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlBlobsCommand, serializeAws_ec2XmlBlobsCommand } from "../protocols/Aws_ec2"; - -export interface XmlBlobsCommandInput {} -export interface XmlBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} - -/** - * Blobs are base64 encoded - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new XmlBlobsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlBlobsCommandInput} for command's `input` shape. - * @see {@link XmlBlobsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlBlobsCommand extends $Command< - XmlBlobsCommandInput, - XmlBlobsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlBlobsCommandInput) { - // 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 = "XmlBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts deleted file mode 100644 index 17a9dedce164..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyBlobsCommand.ts +++ /dev/null @@ -1,75 +0,0 @@ -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 { XmlBlobsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlEmptyBlobsCommand, serializeAws_ec2XmlEmptyBlobsCommand } from "../protocols/Aws_ec2"; - -export interface XmlEmptyBlobsCommandInput {} -export interface XmlEmptyBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} - -export class XmlEmptyBlobsCommand extends $Command< - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyBlobsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - 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 = "XmlEmptyBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlEmptyBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlEmptyBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts deleted file mode 100644 index 22e3b9bb6dbd..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEmptyListsCommand.ts +++ /dev/null @@ -1,75 +0,0 @@ -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 { XmlListsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlEmptyListsCommand, serializeAws_ec2XmlEmptyListsCommand } from "../protocols/Aws_ec2"; - -export interface XmlEmptyListsCommandInput {} -export interface XmlEmptyListsCommandOutput extends XmlListsOutput, __MetadataBearer {} - -export class XmlEmptyListsCommand extends $Command< - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyListsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - 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 = "XmlEmptyListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlEmptyListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlEmptyListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts deleted file mode 100644 index 011cd3d719b6..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlEnumsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlEnumsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlEnumsCommand, serializeAws_ec2XmlEnumsCommand } from "../protocols/Aws_ec2"; - -export interface XmlEnumsCommandInput {} -export interface XmlEnumsCommandOutput extends XmlEnumsOutput, __MetadataBearer {} - -/** - * This example serializes enums as top level properties, in lists, sets, and maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new XmlEnumsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlEnumsCommandInput} for command's `input` shape. - * @see {@link XmlEnumsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlEnumsCommand extends $Command< - XmlEnumsCommandInput, - XmlEnumsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEnumsCommandInput) { - // 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 = "XmlEnumsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlEnumsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlEnumsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlEnumsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts deleted file mode 100644 index 86034a8ee244..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlListsCommand.ts +++ /dev/null @@ -1,102 +0,0 @@ -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 { XmlListsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlListsCommand, serializeAws_ec2XmlListsCommand } from "../protocols/Aws_ec2"; - -export interface XmlListsCommandInput {} -export interface XmlListsCommandOutput extends XmlListsOutput, __MetadataBearer {} - -/** - * This test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Flattened XML lists with @xmlNamespace. - * 8. Lists of structures. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new XmlListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlListsCommandInput} for command's `input` shape. - * @see {@link XmlListsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlListsCommand extends $Command< - XmlListsCommandInput, - XmlListsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlListsCommandInput) { - // 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 = "XmlListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts deleted file mode 100644 index 2ac1df84a547..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlNamespacesCommand.ts +++ /dev/null @@ -1,75 +0,0 @@ -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 { XmlNamespacesOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlNamespacesCommand, serializeAws_ec2XmlNamespacesCommand } from "../protocols/Aws_ec2"; - -export interface XmlNamespacesCommandInput {} -export interface XmlNamespacesCommandOutput extends XmlNamespacesOutput, __MetadataBearer {} - -export class XmlNamespacesCommand extends $Command< - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlNamespacesCommandInput) { - // 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 = "XmlNamespacesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlNamespacesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlNamespacesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlNamespacesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts deleted file mode 100644 index dd84204afb33..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/XmlTimestampsCommand.ts +++ /dev/null @@ -1,94 +0,0 @@ -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 { XmlTimestampsOutput } from "../models/models_0"; -import { deserializeAws_ec2XmlTimestampsCommand, serializeAws_ec2XmlTimestampsCommand } from "../protocols/Aws_ec2"; - -export interface XmlTimestampsCommandInput {} -export interface XmlTimestampsCommandOutput extends XmlTimestampsOutput, __MetadataBearer {} - -/** - * This tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { EC2ProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-ec2"; // ES Modules import - * // const { EC2ProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-ec2"); // CommonJS import - * const client = new EC2ProtocolClient(config); - * const command = new XmlTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlTimestampsCommandInput} for command's `input` shape. - * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. - * @see {@link EC2ProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlTimestampsCommand extends $Command< - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, - EC2ProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlTimestampsCommandInput) { - // 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 = "XmlTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlTimestampsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_ec2XmlTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_ec2XmlTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts b/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts deleted file mode 100644 index 6193c6e3088e..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/commands/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -export * from "./EmptyInputAndEmptyOutputCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HostWithPathOperationCommand"; -export * from "./IgnoresWrappingXmlNameCommand"; -export * from "./NestedStructuresCommand"; -export * from "./NoInputAndOutputCommand"; -export * from "./QueryIdempotencyTokenAutoFillCommand"; -export * from "./QueryListsCommand"; -export * from "./QueryTimestampsCommand"; -export * from "./RecursiveXmlShapesCommand"; -export * from "./SimpleInputParamsCommand"; -export * from "./SimpleScalarXmlPropertiesCommand"; -export * from "./XmlBlobsCommand"; -export * from "./XmlEmptyBlobsCommand"; -export * from "./XmlEmptyListsCommand"; -export * from "./XmlEnumsCommand"; -export * from "./XmlListsCommand"; -export * from "./XmlNamespacesCommand"; -export * from "./XmlTimestampsCommand"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts b/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts deleted file mode 100644 index 1dff9bfbb8cb..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "awsec2.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "awsec2.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "awsec2.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "awsec2.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "awsec2.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "awsec2", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-ec2/src/index.ts b/protocol_tests/aws-protocoltests-ec2/src/index.ts deleted file mode 100644 index 3224cf9eac55..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./EC2Protocol"; -export * from "./EC2ProtocolClient"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/models/index.ts b/protocol_tests/aws-protocoltests-ec2/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts b/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts deleted file mode 100644 index fc62d3d0aa95..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/models/models_0.ts +++ /dev/null @@ -1,433 +0,0 @@ -import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; - -export interface EmptyInputAndEmptyOutputInput {} - -export namespace EmptyInputAndEmptyOutputInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputOutput {} - -export namespace EmptyInputAndEmptyOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export interface IgnoresWrappingXmlNameOutput { - foo?: string; -} - -export namespace IgnoresWrappingXmlNameOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: IgnoresWrappingXmlNameOutput): any => ({ - ...obj, - }); -} - -export interface NoInputAndOutputOutput {} - -export namespace NoInputAndOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ - ...obj, - }); -} - -export interface QueryIdempotencyTokenAutoFillInput { - token?: string; -} - -export namespace QueryIdempotencyTokenAutoFillInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ - ...obj, - }); -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -export interface NestedStructWithList { - ListArg?: string[]; -} - -export namespace NestedStructWithList { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedStructWithList): any => ({ - ...obj, - }); -} - -export interface QueryListsInput { - ListArg?: string[]; - ComplexListArg?: GreetingStruct[]; - ListArgWithXmlNameMember?: string[]; - ListArgWithXmlName?: string[]; - NestedWithList?: NestedStructWithList; -} - -export namespace QueryListsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryListsInput): any => ({ - ...obj, - }); -} - -export interface QueryTimestampsInput { - normalFormat?: Date; - epochMember?: Date; - epochTarget?: Date; -} - -export namespace QueryTimestampsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryTimestampsInput): any => ({ - ...obj, - }); -} - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface SimpleInputParamsInput { - Foo?: string; - Bar?: string; - Baz?: boolean; - Bam?: number; - FloatValue?: number; - Boo?: number; - Qux?: Uint8Array; - FooEnum?: FooEnum | string; - HasQueryName?: string; - HasQueryAndXmlName?: string; - UsesXmlName?: string; -} - -export namespace SimpleInputParamsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleInputParamsInput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarXmlPropertiesOutput { - stringValue?: string; - emptyStringValue?: string; - trueBooleanValue?: boolean; - falseBooleanValue?: boolean; - byteValue?: number; - shortValue?: number; - integerValue?: number; - longValue?: number; - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarXmlPropertiesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarXmlPropertiesOutput): any => ({ - ...obj, - }); -} - -export interface XmlBlobsOutput { - data?: Uint8Array; -} - -export namespace XmlBlobsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlBlobsOutput): any => ({ - ...obj, - }); -} - -export interface StructureListMember { - a?: string; - b?: string; -} - -export namespace StructureListMember { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructureListMember): any => ({ - ...obj, - }); -} - -export interface XmlListsOutput { - stringList?: string[]; - stringSet?: string[]; - integerList?: number[]; - booleanList?: boolean[]; - timestampList?: Date[]; - enumList?: (FooEnum | string)[]; - /** - * A list of lists of strings. - */ - nestedStringList?: string[][]; - - renamedListMembers?: string[]; - flattenedList?: string[]; - flattenedList2?: string[]; - flattenedListWithMemberNamespace?: string[]; - flattenedListWithNamespace?: string[]; - structureList?: StructureListMember[]; -} - -export namespace XmlListsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlListsOutput): any => ({ - ...obj, - }); -} - -export interface XmlEnumsOutput { - fooEnum1?: FooEnum | string; - fooEnum2?: FooEnum | string; - fooEnum3?: FooEnum | string; - fooEnumList?: (FooEnum | string)[]; - fooEnumSet?: (FooEnum | string)[]; - fooEnumMap?: { [key: string]: FooEnum | string }; -} - -export namespace XmlEnumsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({ - ...obj, - }); -} - -export interface XmlNamespaceNested { - foo?: string; - values?: string[]; -} - -export namespace XmlNamespaceNested { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ - ...obj, - }); -} - -export interface XmlNamespacesOutput { - nested?: XmlNamespaceNested; -} - -export namespace XmlNamespacesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespacesOutput): any => ({ - ...obj, - }); -} - -export interface XmlTimestampsOutput { - normal?: Date; - dateTime?: Date; - epochSeconds?: Date; - httpDate?: Date; -} - -export namespace XmlTimestampsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlTimestampsOutput): any => ({ - ...obj, - }); -} - -export interface StructArg { - StringArg?: string; - OtherArg?: boolean; - RecursiveArg?: StructArg; -} - -export namespace StructArg { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructArg): any => ({ - ...obj, - }); -} - -export interface NestedStructuresInput { - Nested?: StructArg; -} - -export namespace NestedStructuresInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedStructuresInput): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutputNested1 { - foo?: string; - nested?: RecursiveXmlShapesOutputNested2; -} - -export namespace RecursiveXmlShapesOutputNested1 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested1): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutputNested2 { - bar?: string; - recursiveMember?: RecursiveXmlShapesOutputNested1; -} - -export namespace RecursiveXmlShapesOutputNested2 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested2): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutput { - nested?: RecursiveXmlShapesOutputNested1; -} - -export namespace RecursiveXmlShapesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutput): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts b/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts deleted file mode 100644 index 53711d9be60b..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts +++ /dev/null @@ -1,2273 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - expectNonNull as __expectNonNull, - expectString as __expectString, - extendedEncodeURIComponent as __extendedEncodeURIComponent, - getArrayIfSingleItem as __getArrayIfSingleItem, - getValueFromTextNode as __getValueFromTextNode, - parseBoolean as __parseBoolean, - parseEpochTimestamp as __parseEpochTimestamp, - parseRfc3339DateTime as __parseRfc3339DateTime, - parseRfc7231DateTime as __parseRfc7231DateTime, - serializeFloat as __serializeFloat, - strictParseByte as __strictParseByte, - strictParseFloat as __strictParseFloat, - strictParseInt32 as __strictParseInt32, - strictParseLong as __strictParseLong, - strictParseShort as __strictParseShort, -} from "@aws-sdk/smithy-client"; -import { - Endpoint as __Endpoint, - HeaderBag as __HeaderBag, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "../commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "../commands/EndpointWithHostLabelOperationCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "../commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "../commands/IgnoresWrappingXmlNameCommand"; -import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "../commands/NestedStructuresCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "../commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommandInput, QueryListsCommandOutput } from "../commands/QueryListsCommand"; -import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "../commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "../commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "../commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "../commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; -import { - ComplexError, - ComplexNestedErrorData, - EmptyInputAndEmptyOutputInput, - EmptyInputAndEmptyOutputOutput, - FooEnum, - GreetingStruct, - GreetingWithErrorsOutput, - HostLabelInput, - IgnoresWrappingXmlNameOutput, - InvalidGreeting, - NestedStructuresInput, - NestedStructWithList, - NoInputAndOutputOutput, - QueryIdempotencyTokenAutoFillInput, - QueryListsInput, - QueryTimestampsInput, - RecursiveXmlShapesOutput, - RecursiveXmlShapesOutputNested1, - RecursiveXmlShapesOutputNested2, - SimpleInputParamsInput, - SimpleScalarXmlPropertiesOutput, - StructArg, - StructureListMember, - XmlBlobsOutput, - XmlEnumsOutput, - XmlListsOutput, - XmlNamespaceNested, - XmlNamespacesOutput, - XmlTimestampsOutput, -} from "../models/models_0"; - -export const serializeAws_ec2EmptyInputAndEmptyOutputCommand = async ( - input: EmptyInputAndEmptyOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2EmptyInputAndEmptyOutputInput(input, context), - Action: "EmptyInputAndEmptyOutput", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2EndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "EndpointOperation", - Version: "2020-01-08", - }); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_ec2EndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2HostLabelInput(input, context), - Action: "EndpointWithHostLabelOperation", - Version: "2020-01-08", - }); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_ec2GreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "GreetingWithErrors", - Version: "2020-01-08", - }); - 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 -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "IgnoresWrappingXmlName", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2NestedStructuresCommand = async ( - input: NestedStructuresCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2NestedStructuresInput(input, context), - Action: "NestedStructures", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2NoInputAndOutputCommand = async ( - input: NoInputAndOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "NoInputAndOutput", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2QueryIdempotencyTokenAutoFillCommand = async ( - input: QueryIdempotencyTokenAutoFillCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2QueryIdempotencyTokenAutoFillInput(input, context), - Action: "QueryIdempotencyTokenAutoFill", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2QueryListsCommand = async ( - input: QueryListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2QueryListsInput(input, context), - Action: "QueryLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2QueryTimestampsCommand = async ( - input: QueryTimestampsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2QueryTimestampsInput(input, context), - Action: "QueryTimestamps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2RecursiveXmlShapesCommand = async ( - input: RecursiveXmlShapesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "RecursiveXmlShapes", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2SimpleInputParamsCommand = async ( - input: SimpleInputParamsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_ec2SimpleInputParamsInput(input, context), - Action: "SimpleInputParams", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2SimpleScalarXmlPropertiesCommand = async ( - input: SimpleScalarXmlPropertiesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "SimpleScalarXmlProperties", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlBlobsCommand = async ( - input: XmlBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlBlobs", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlEmptyBlobsCommand = async ( - input: XmlEmptyBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEmptyBlobs", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlEmptyListsCommand = async ( - input: XmlEmptyListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEmptyLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlEnumsCommand = async ( - input: XmlEnumsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEnums", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlListsCommand = async ( - input: XmlListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlNamespacesCommand = async ( - input: XmlNamespacesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlNamespaces", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_ec2XmlTimestampsCommand = async ( - input: XmlTimestampsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlTimestamps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const deserializeAws_ec2EmptyInputAndEmptyOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2EmptyInputAndEmptyOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2EmptyInputAndEmptyOutputOutput(data, context); - const response: EmptyInputAndEmptyOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2EmptyInputAndEmptyOutputCommandError = 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_ec2EndpointOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2EndpointOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2EndpointOperationCommandError = 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_ec2EndpointWithHostLabelOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2EndpointWithHostLabelOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointWithHostLabelOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2EndpointWithHostLabelOperationCommandError = 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_ec2GreetingWithErrorsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2GreetingWithErrorsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2GreetingWithErrorsOutput(data, context); - const response: GreetingWithErrorsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2GreetingWithErrorsCommandError = 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) { - case "ComplexError": - case "aws.protocoltests.ec2#ComplexError": - response = { - ...(await deserializeAws_ec2ComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.ec2#InvalidGreeting": - response = { - ...(await deserializeAws_ec2InvalidGreetingResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - 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_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 -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2IgnoresWrappingXmlNameCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2IgnoresWrappingXmlNameOutput(data, context); - const response: IgnoresWrappingXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2IgnoresWrappingXmlNameCommandError = 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_ec2NestedStructuresCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2NestedStructuresCommandError(output, context); - } - await collectBody(output.body, context); - const response: NestedStructuresCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2NestedStructuresCommandError = 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_ec2NoInputAndOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2NoInputAndOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2NoInputAndOutputOutput(data, context); - const response: NoInputAndOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2NoInputAndOutputCommandError = 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_ec2QueryIdempotencyTokenAutoFillCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2QueryIdempotencyTokenAutoFillCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryIdempotencyTokenAutoFillCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2QueryIdempotencyTokenAutoFillCommandError = 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_ec2QueryListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2QueryListsCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryListsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2QueryListsCommandError = 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_ec2QueryTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2QueryTimestampsCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryTimestampsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2QueryTimestampsCommandError = 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_ec2RecursiveXmlShapesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2RecursiveXmlShapesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2RecursiveXmlShapesOutput(data, context); - const response: RecursiveXmlShapesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2RecursiveXmlShapesCommandError = 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_ec2SimpleInputParamsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2SimpleInputParamsCommandError(output, context); - } - await collectBody(output.body, context); - const response: SimpleInputParamsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2SimpleInputParamsCommandError = 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_ec2SimpleScalarXmlPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2SimpleScalarXmlPropertiesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2SimpleScalarXmlPropertiesOutput(data, context); - const response: SimpleScalarXmlPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2SimpleScalarXmlPropertiesCommandError = 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_ec2XmlBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlBlobsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlBlobsOutput(data, context); - const response: XmlBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlBlobsCommandError = 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_ec2XmlEmptyBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlEmptyBlobsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlBlobsOutput(data, context); - const response: XmlEmptyBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlEmptyBlobsCommandError = 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_ec2XmlEmptyListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlEmptyListsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlListsOutput(data, context); - const response: XmlEmptyListsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlEmptyListsCommandError = 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_ec2XmlEnumsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlEnumsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlEnumsOutput(data, context); - const response: XmlEnumsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlEnumsCommandError = 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_ec2XmlListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlListsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlListsOutput(data, context); - const response: XmlListsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlListsCommandError = 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_ec2XmlNamespacesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlNamespacesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlNamespacesOutput(data, context); - const response: XmlNamespacesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlNamespacesCommandError = 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_ec2XmlTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_ec2XmlTimestampsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_ec2XmlTimestampsOutput(data, context); - const response: XmlTimestampsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_ec2XmlTimestampsCommandError = 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)); -}; - -const deserializeAws_ec2ComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_ec2ComplexError(body.Errors.Error, context); - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_ec2InvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_ec2InvalidGreeting(body.Errors.Error, context); - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const serializeAws_ec2EmptyInputAndEmptyOutputInput = ( - input: EmptyInputAndEmptyOutputInput, - context: __SerdeContext -): any => { - const entries: any = {}; - return entries; -}; - -const serializeAws_ec2HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.label !== undefined && input.label !== null) { - entries["Label"] = input.label; - } - return entries; -}; - -const serializeAws_ec2ListWithXmlName = (input: string[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - entries[`Item.${counter}`] = entry; - counter++; - } - return entries; -}; - -const serializeAws_ec2NestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.Nested !== undefined && input.Nested !== null) { - const memberEntries = serializeAws_ec2StructArg(input.Nested, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Nested.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_ec2NestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { - const entries: any = {}; - if (input.ListArg !== undefined && input.ListArg !== null) { - const memberEntries = serializeAws_ec2StringList(input.ListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArg.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_ec2QueryIdempotencyTokenAutoFillInput = ( - input: QueryIdempotencyTokenAutoFillInput, - context: __SerdeContext -): any => { - const entries: any = {}; - if (input.token === undefined) { - input.token = generateIdempotencyToken(); - } - if (input.token !== undefined && input.token !== null) { - entries["Token"] = input.token; - } - return entries; -}; - -const serializeAws_ec2QueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.ListArg !== undefined && input.ListArg !== null) { - const memberEntries = serializeAws_ec2StringList(input.ListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArg.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.ComplexListArg !== undefined && input.ComplexListArg !== null) { - const memberEntries = serializeAws_ec2GreetingList(input.ComplexListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ComplexListArg.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.ListArgWithXmlNameMember !== undefined && input.ListArgWithXmlNameMember !== null) { - const memberEntries = serializeAws_ec2ListWithXmlName(input.ListArgWithXmlNameMember, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArgWithXmlNameMember.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.ListArgWithXmlName !== undefined && input.ListArgWithXmlName !== null) { - const memberEntries = serializeAws_ec2ListWithXmlName(input.ListArgWithXmlName, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.NestedWithList !== undefined && input.NestedWithList !== null) { - const memberEntries = serializeAws_ec2NestedStructWithList(input.NestedWithList, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `NestedWithList.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_ec2QueryTimestampsInput = (input: QueryTimestampsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.normalFormat !== undefined && input.normalFormat !== null) { - entries["NormalFormat"] = input.normalFormat.toISOString().split(".")[0] + "Z"; - } - if (input.epochMember !== undefined && input.epochMember !== null) { - entries["EpochMember"] = Math.round(input.epochMember.getTime() / 1000); - } - if (input.epochTarget !== undefined && input.epochTarget !== null) { - entries["EpochTarget"] = Math.round(input.epochTarget.getTime() / 1000); - } - return entries; -}; - -const serializeAws_ec2SimpleInputParamsInput = (input: SimpleInputParamsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.Foo !== undefined && input.Foo !== null) { - entries["Foo"] = input.Foo; - } - if (input.Bar !== undefined && input.Bar !== null) { - entries["Bar"] = input.Bar; - } - if (input.Baz !== undefined && input.Baz !== null) { - entries["Baz"] = input.Baz; - } - if (input.Bam !== undefined && input.Bam !== null) { - entries["Bam"] = input.Bam; - } - if (input.FloatValue !== undefined && input.FloatValue !== null) { - entries["FloatValue"] = __serializeFloat(input.FloatValue); - } - if (input.Boo !== undefined && input.Boo !== null) { - entries["Boo"] = __serializeFloat(input.Boo); - } - if (input.Qux !== undefined && input.Qux !== null) { - entries["Qux"] = context.base64Encoder(input.Qux); - } - if (input.FooEnum !== undefined && input.FooEnum !== null) { - entries["FooEnum"] = input.FooEnum; - } - if (input.HasQueryName !== undefined && input.HasQueryName !== null) { - entries["A"] = input.HasQueryName; - } - if (input.HasQueryAndXmlName !== undefined && input.HasQueryAndXmlName !== null) { - entries["B"] = input.HasQueryAndXmlName; - } - if (input.UsesXmlName !== undefined && input.UsesXmlName !== null) { - entries["C"] = input.UsesXmlName; - } - return entries; -}; - -const serializeAws_ec2StructArg = (input: StructArg, context: __SerdeContext): any => { - const entries: any = {}; - if (input.StringArg !== undefined && input.StringArg !== null) { - entries["StringArg"] = input.StringArg; - } - if (input.OtherArg !== undefined && input.OtherArg !== null) { - entries["OtherArg"] = input.OtherArg; - } - if (input.RecursiveArg !== undefined && input.RecursiveArg !== null) { - const memberEntries = serializeAws_ec2StructArg(input.RecursiveArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `RecursiveArg.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_ec2GreetingList = (input: GreetingStruct[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - const memberEntries = serializeAws_ec2GreetingStruct(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`Member.${counter}.${key}`] = value; - }); - counter++; - } - return entries; -}; - -const serializeAws_ec2GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - const entries: any = {}; - if (input.hi !== undefined && input.hi !== null) { - entries["Hi"] = input.hi; - } - return entries; -}; - -const serializeAws_ec2StringList = (input: string[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - entries[`Member.${counter}`] = entry; - counter++; - } - return entries; -}; - -const deserializeAws_ec2ComplexError = (output: any, context: __SerdeContext): ComplexError => { - const contents: any = { - TopLevel: undefined, - Nested: undefined, - }; - if (output["TopLevel"] !== undefined) { - contents.TopLevel = __expectString(output["TopLevel"]); - } - if (output["Nested"] !== undefined) { - contents.Nested = deserializeAws_ec2ComplexNestedErrorData(output["Nested"], context); - } - return contents; -}; - -const deserializeAws_ec2ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - const contents: any = { - Foo: undefined, - }; - if (output["Foo"] !== undefined) { - contents.Foo = __expectString(output["Foo"]); - } - return contents; -}; - -const deserializeAws_ec2EmptyInputAndEmptyOutputOutput = ( - output: any, - context: __SerdeContext -): EmptyInputAndEmptyOutputOutput => { - const contents: any = {}; - return contents; -}; - -const deserializeAws_ec2GreetingWithErrorsOutput = (output: any, context: __SerdeContext): GreetingWithErrorsOutput => { - const contents: any = { - greeting: undefined, - }; - if (output["greeting"] !== undefined) { - contents.greeting = __expectString(output["greeting"]); - } - return contents; -}; - -const deserializeAws_ec2IgnoresWrappingXmlNameOutput = ( - output: any, - context: __SerdeContext -): IgnoresWrappingXmlNameOutput => { - const contents: any = { - foo: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - return contents; -}; - -const deserializeAws_ec2InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - const contents: any = { - Message: undefined, - }; - if (output["Message"] !== undefined) { - contents.Message = __expectString(output["Message"]); - } - return contents; -}; - -const deserializeAws_ec2ListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2ListWithNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInputAndOutputOutput => { - const contents: any = {}; - return contents; -}; - -const deserializeAws_ec2RecursiveXmlShapesOutput = (output: any, context: __SerdeContext): RecursiveXmlShapesOutput => { - const contents: any = { - nested: undefined, - }; - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_ec2RecursiveXmlShapesOutputNested1(output["nested"], context); - } - return contents; -}; - -const deserializeAws_ec2RecursiveXmlShapesOutputNested1 = ( - output: any, - context: __SerdeContext -): RecursiveXmlShapesOutputNested1 => { - const contents: any = { - foo: undefined, - nested: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_ec2RecursiveXmlShapesOutputNested2(output["nested"], context); - } - return contents; -}; - -const deserializeAws_ec2RecursiveXmlShapesOutputNested2 = ( - output: any, - context: __SerdeContext -): RecursiveXmlShapesOutputNested2 => { - const contents: any = { - bar: undefined, - recursiveMember: undefined, - }; - if (output["bar"] !== undefined) { - contents.bar = __expectString(output["bar"]); - } - if (output["recursiveMember"] !== undefined) { - contents.recursiveMember = deserializeAws_ec2RecursiveXmlShapesOutputNested1(output["recursiveMember"], context); - } - return contents; -}; - -const deserializeAws_ec2RenamedListMembers = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2SimpleScalarXmlPropertiesOutput = ( - output: any, - context: __SerdeContext -): SimpleScalarXmlPropertiesOutput => { - const contents: any = { - stringValue: undefined, - emptyStringValue: undefined, - trueBooleanValue: undefined, - falseBooleanValue: undefined, - byteValue: undefined, - shortValue: undefined, - integerValue: undefined, - longValue: undefined, - floatValue: undefined, - doubleValue: undefined, - }; - if (output["stringValue"] !== undefined) { - contents.stringValue = __expectString(output["stringValue"]); - } - if (output["emptyStringValue"] !== undefined) { - contents.emptyStringValue = __expectString(output["emptyStringValue"]); - } - if (output["trueBooleanValue"] !== undefined) { - contents.trueBooleanValue = __parseBoolean(output["trueBooleanValue"]); - } - if (output["falseBooleanValue"] !== undefined) { - contents.falseBooleanValue = __parseBoolean(output["falseBooleanValue"]); - } - if (output["byteValue"] !== undefined) { - contents.byteValue = __strictParseByte(output["byteValue"]) as number; - } - if (output["shortValue"] !== undefined) { - contents.shortValue = __strictParseShort(output["shortValue"]) as number; - } - if (output["integerValue"] !== undefined) { - contents.integerValue = __strictParseInt32(output["integerValue"]) as number; - } - if (output["longValue"] !== undefined) { - contents.longValue = __strictParseLong(output["longValue"]) as number; - } - if (output["floatValue"] !== undefined) { - contents.floatValue = __strictParseFloat(output["floatValue"]) as number; - } - if (output["DoubleDribble"] !== undefined) { - contents.doubleValue = __strictParseFloat(output["DoubleDribble"]) as number; - } - return contents; -}; - -const deserializeAws_ec2StructureList = (output: any, context: __SerdeContext): StructureListMember[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_ec2StructureListMember(entry, context); - }); -}; - -const deserializeAws_ec2StructureListMember = (output: any, context: __SerdeContext): StructureListMember => { - const contents: any = { - a: undefined, - b: undefined, - }; - if (output["value"] !== undefined) { - contents.a = __expectString(output["value"]); - } - if (output["other"] !== undefined) { - contents.b = __expectString(output["other"]); - } - return contents; -}; - -const deserializeAws_ec2XmlBlobsOutput = (output: any, context: __SerdeContext): XmlBlobsOutput => { - const contents: any = { - data: undefined, - }; - if (output["data"] !== undefined) { - contents.data = context.base64Decoder(output["data"]); - } - return contents; -}; - -const deserializeAws_ec2XmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput => { - const contents: any = { - fooEnum1: undefined, - fooEnum2: undefined, - fooEnum3: undefined, - fooEnumList: undefined, - fooEnumSet: undefined, - fooEnumMap: undefined, - }; - if (output["fooEnum1"] !== undefined) { - contents.fooEnum1 = __expectString(output["fooEnum1"]); - } - if (output["fooEnum2"] !== undefined) { - contents.fooEnum2 = __expectString(output["fooEnum2"]); - } - if (output["fooEnum3"] !== undefined) { - contents.fooEnum3 = __expectString(output["fooEnum3"]); - } - if (output.fooEnumList === "") { - contents.fooEnumList = []; - } - if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = deserializeAws_ec2FooEnumList( - __getArrayIfSingleItem(output["fooEnumList"]["member"]), - context - ); - } - if (output.fooEnumSet === "") { - contents.fooEnumSet = []; - } - if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = deserializeAws_ec2FooEnumSet(__getArrayIfSingleItem(output["fooEnumSet"]["member"]), context); - } - if (output.fooEnumMap === "") { - contents.fooEnumMap = {}; - } - if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = deserializeAws_ec2FooEnumMap(__getArrayIfSingleItem(output["fooEnumMap"]["entry"]), context); - } - return contents; -}; - -const deserializeAws_ec2XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput => { - const contents: any = { - stringList: undefined, - stringSet: undefined, - integerList: undefined, - booleanList: undefined, - timestampList: undefined, - enumList: undefined, - nestedStringList: undefined, - renamedListMembers: undefined, - flattenedList: undefined, - flattenedList2: undefined, - flattenedListWithMemberNamespace: undefined, - flattenedListWithNamespace: undefined, - structureList: undefined, - }; - if (output.stringList === "") { - contents.stringList = []; - } - if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { - contents.stringList = deserializeAws_ec2StringList(__getArrayIfSingleItem(output["stringList"]["member"]), context); - } - if (output.stringSet === "") { - contents.stringSet = []; - } - if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { - contents.stringSet = deserializeAws_ec2StringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); - } - if (output.integerList === "") { - contents.integerList = []; - } - if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { - contents.integerList = deserializeAws_ec2IntegerList( - __getArrayIfSingleItem(output["integerList"]["member"]), - context - ); - } - if (output.booleanList === "") { - contents.booleanList = []; - } - if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { - contents.booleanList = deserializeAws_ec2BooleanList( - __getArrayIfSingleItem(output["booleanList"]["member"]), - context - ); - } - if (output.timestampList === "") { - contents.timestampList = []; - } - if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { - contents.timestampList = deserializeAws_ec2TimestampList( - __getArrayIfSingleItem(output["timestampList"]["member"]), - context - ); - } - if (output.enumList === "") { - contents.enumList = []; - } - if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { - contents.enumList = deserializeAws_ec2FooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); - } - if (output.nestedStringList === "") { - contents.nestedStringList = []; - } - if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { - contents.nestedStringList = deserializeAws_ec2NestedStringList( - __getArrayIfSingleItem(output["nestedStringList"]["member"]), - context - ); - } - if (output.renamed === "") { - contents.renamedListMembers = []; - } - if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { - contents.renamedListMembers = deserializeAws_ec2RenamedListMembers( - __getArrayIfSingleItem(output["renamed"]["item"]), - context - ); - } - if (output.flattenedList === "") { - contents.flattenedList = []; - } - if (output["flattenedList"] !== undefined) { - contents.flattenedList = deserializeAws_ec2RenamedListMembers( - __getArrayIfSingleItem(output["flattenedList"]), - context - ); - } - if (output.customName === "") { - contents.flattenedList2 = []; - } - if (output["customName"] !== undefined) { - contents.flattenedList2 = deserializeAws_ec2RenamedListMembers( - __getArrayIfSingleItem(output["customName"]), - context - ); - } - if (output.flattenedListWithMemberNamespace === "") { - contents.flattenedListWithMemberNamespace = []; - } - if (output["flattenedListWithMemberNamespace"] !== undefined) { - contents.flattenedListWithMemberNamespace = deserializeAws_ec2ListWithMemberNamespace( - __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), - context - ); - } - if (output.flattenedListWithNamespace === "") { - contents.flattenedListWithNamespace = []; - } - if (output["flattenedListWithNamespace"] !== undefined) { - contents.flattenedListWithNamespace = deserializeAws_ec2ListWithNamespace( - __getArrayIfSingleItem(output["flattenedListWithNamespace"]), - context - ); - } - if (output.myStructureList === "") { - contents.structureList = []; - } - if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { - contents.structureList = deserializeAws_ec2StructureList( - __getArrayIfSingleItem(output["myStructureList"]["item"]), - context - ); - } - return contents; -}; - -const deserializeAws_ec2XmlNamespacedList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2XmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { - const contents: any = { - foo: undefined, - values: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output.values === "") { - contents.values = []; - } - if (output["values"] !== undefined && output["values"]["member"] !== undefined) { - contents.values = deserializeAws_ec2XmlNamespacedList(__getArrayIfSingleItem(output["values"]["member"]), context); - } - return contents; -}; - -const deserializeAws_ec2XmlNamespacesOutput = (output: any, context: __SerdeContext): XmlNamespacesOutput => { - const contents: any = { - nested: undefined, - }; - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_ec2XmlNamespaceNested(output["nested"], context); - } - return contents; -}; - -const deserializeAws_ec2XmlTimestampsOutput = (output: any, context: __SerdeContext): XmlTimestampsOutput => { - const contents: any = { - normal: undefined, - dateTime: undefined, - epochSeconds: undefined, - httpDate: undefined, - }; - if (output["normal"] !== undefined) { - contents.normal = __expectNonNull(__parseRfc3339DateTime(output["normal"])); - } - if (output["dateTime"] !== undefined) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTime(output["dateTime"])); - } - if (output["epochSeconds"] !== undefined) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(output["epochSeconds"])); - } - if (output["httpDate"] !== undefined) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(output["httpDate"])); - } - return contents; -}; - -const deserializeAws_ec2BooleanList = (output: any, context: __SerdeContext): boolean[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __parseBoolean(entry); - }); -}; - -const deserializeAws_ec2FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2FooEnumMap = (output: any, context: __SerdeContext): { [key: string]: FooEnum | string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["value"] === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: __expectString(pair["value"]) as any, - }; - }, {}); -}; - -const deserializeAws_ec2FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2IntegerList = (output: any, context: __SerdeContext): number[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __strictParseInt32(entry) as number; - }); -}; - -const deserializeAws_ec2NestedStringList = (output: any, context: __SerdeContext): string[][] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_ec2StringList(__getArrayIfSingleItem(entry["member"]), context); - }); -}; - -const deserializeAws_ec2StringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2StringSet = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_ec2TimestampList = (output: any, context: __SerdeContext): Date[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectNonNull(__parseRfc3339DateTime(entry)); - }); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const buildHttpRpcRequest = async ( - context: __SerdeContext, - headers: __HeaderBag, - path: string, - resolvedHostname: string | undefined, - body: any -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents: any = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers, - }; - if (resolvedHostname !== undefined) { - contents.hostname = resolvedHostname; - } - if (body !== undefined) { - contents.body = body; - } - return new __HttpRequest(contents); -}; - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - const parsedObj = xmlParse(encoded, { - attributeNamePrefix: "", - ignoreAttributes: false, - parseNodeValue: false, - trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; - } - return __getValueFromTextNode(parsedObjToReturn); - } - return {}; - }); - -const buildFormUrlencodedString = (formEntries: { [key: string]: string }): string => - Object.entries(formEntries) - .map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value)) - .join("&"); - -const loadEc2ErrorCode = (output: __HttpResponse, data: any): string => { - if (data.Errors.Error.Code !== undefined) { - return data.Errors.Error.Code; - } - if (output.statusCode == 404) { - return "NotFound"; - } - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts deleted file mode 100644 index aa5e0b059e47..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts deleted file mode 100644 index 2d7386ac1163..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts deleted file mode 100644 index 8b25f37edde3..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; -import { defaultRegionInfoProvider } from "./endpoints"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => ({ - apiVersion: "2020-01-08", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "EC2 Protocol", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts deleted file mode 100644 index ca6e2ed871b4..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/src/runtimeConfig.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Hash } from "@aws-sdk/hash-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts b/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts deleted file mode 100644 index ae49d2885cf8..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/test/functional/ec2query.spec.ts +++ /dev/null @@ -1,2344 +0,0 @@ -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"; - -import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; -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"; -import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommand } from "../../src/commands/QueryListsCommand"; -import { QueryTimestampsCommand } from "../../src/commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommand } from "../../src/commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommand } from "../../src/commands/SimpleInputParamsCommand"; -import { SimpleScalarXmlPropertiesCommand } from "../../src/commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; -import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; -import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; -import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; -import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; -import { EC2ProtocolClient } from "../../src/EC2ProtocolClient"; -import { ComplexError, InvalidGreeting } from "../../src/models/models_0"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Empty input serializes no extra query params - */ -it("Ec2QueryEmptyInputAndEmptyOutput:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyInputAndEmptyOutputCommand({} as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EmptyInputAndEmptyOutput&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output - */ -it("Ec2QueryEmptyInputAndEmptyOutput:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - requestid - - ` - ), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("Ec2QueryEndpointTrait:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EndpointOperation&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("Ec2QueryEndpointTraitWithHostLabel:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EndpointWithHostLabelOperation&Version=2020-01-08&Label=bar`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that operations with errors successfully know how to deserialize the successful response - */ -it("Ec2GreetingWithErrors:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - Hello - requestid - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - greeting: "Hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses simple XML errors - */ -it("Ec2InvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - - InvalidGreeting - Hi - - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -it("Ec2ComplexError:Error:GreetingWithErrors", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - - ComplexError - Hi - Top level - - bar - - - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - 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 - */ -it("Ec2IgnoresWrappingXmlName:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - bar - requestid - - ` - ), - }); - - const params: any = {}; - const command = new IgnoresWrappingXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "bar", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes nested structures using dots - */ -it("Ec2NestedStructures:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NestedStructuresCommand({ - Nested: { - StringArg: "foo", - - OtherArg: true, - - RecursiveArg: { - StringArg: "baz", - } as any, - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=NestedStructures&Version=2020-01-08&Nested.StringArg=foo&Nested.OtherArg=true&Nested.RecursiveArg.StringArg=baz`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * No input serializes no payload - */ -it("Ec2QueryNoInputAndOutput:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndOutputCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=NoInputAndOutput&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output - */ -it("Ec2QueryNoInputAndOutput:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - requestid - - ` - ), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Automatically adds idempotency token when not set - */ -it("Ec2ProtocolIdempotencyTokenAutoFill:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&Token=00000000-0000-4000-8000-000000000000`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Uses the given idempotency token as-is - */ -it("Ec2ProtocolIdempotencyTokenAutoFillIsSet:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000123", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&Token=00000000-0000-4000-8000-000000000123`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query lists. All EC2 lists are flattened. - */ -it("Ec2Lists:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArg: ["foo", "bar", "baz"], - - ComplexListArg: [ - { - hi: "hello", - } as any, - - { - hi: "hola", - } as any, - ], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&ComplexListArg.1.Hi=hello&ComplexListArg.2.Hi=hola`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Does not serialize empty query lists - */ -it("Ec2EmptyQueryLists:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArg: [], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * An xmlName trait in the member of a list has no effect on the list serialization. - */ -it("Ec2ListArgWithXmlNameMember:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArgWithXmlNameMember: ["A", "B"], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&ListArgWithXmlNameMember.1=A&ListArgWithXmlNameMember.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Changes the name of the list using the xmlName trait - */ -it("Ec2ListMemberWithXmlName:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArgWithXmlName: ["A", "B"], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&Hi.1=A&Hi.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Nested structure with a list member - */ -it("Ec2ListNestedStructWithList:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - NestedWithList: { - ListArg: ["A", "B"], - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.1=A&NestedWithList.ListArg.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamps - */ -it("Ec2TimestampsInput:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryTimestampsCommand({ - normalFormat: new Date(1422172800000), - - epochMember: new Date(1422172800000), - - epochTarget: new Date(1422172800000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryTimestamps&Version=2020-01-08&NormalFormat=2015-01-25T08%3A00%3A00Z&EpochMember=1422172800&EpochTarget=1422172800`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes recursive structures - */ -it("Ec2RecursiveShapes:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - Foo1 - - Bar1 - - Foo2 - - Bar2 - - - - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new RecursiveXmlShapesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - }, - }, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes strings - */ -it("Ec2SimpleInputParamsStrings:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Foo: "val1", - - Bar: "val2", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Bar=val2`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes booleans that are true - */ -it("Ec2SimpleInputParamsStringAndBooleanTrue:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Foo: "val1", - - Baz: true, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Baz=true`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes booleans that are false - */ -it("Ec2SimpleInputParamsStringsAndBooleanFalse:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Baz: false, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Baz=false`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes integers - */ -it("Ec2SimpleInputParamsInteger:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Bam: 10, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Bam=10`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes floats - */ -it("Ec2SimpleInputParamsFloat:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Boo: 10.8, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Boo=10.8`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Blobs are base64 encoded in the query string - */ -it("Ec2SimpleInputParamsBlob:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Qux: Uint8Array.from("value", (c) => c.charCodeAt(0)), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Qux=dmFsdWU%3D`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes enums in the query string - */ -it("Ec2Enums:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FooEnum: "Foo", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FooEnum=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query using ec2QueryName trait. - */ -it("Ec2Query:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - HasQueryName: "Hi", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&A=Hi`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * ec2QueryName trait is preferred over xmlName. - */ -it("Ec2QueryIsPreferred:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - HasQueryAndXmlName: "Hi", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&B=Hi`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * xmlName is used with the ec2 protocol, but the first character is uppercased - */ -it("Ec2XmlNameIsUppercased:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - UsesXmlName: "Hi", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&C=Hi`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("Ec2QuerySupportsNaNFloatInputs:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: NaN, - - Boo: NaN, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=NaN&Boo=NaN`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("Ec2QuerySupportsInfinityFloatInputs:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: Infinity, - - Boo: Infinity, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=Infinity&Boo=Infinity`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("Ec2QuerySupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: -Infinity, - - Boo: -Infinity, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=-Infinity&Boo=-Infinity`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("Ec2SimpleScalarProperties:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - string - - true - false - 1 - 2 - 3 - 4 - 5.5 - 6.5 - requestid - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - emptyStringValue: "", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float values. - */ -it("Ec2QuerySupportsNaNFloatOutputs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - NaN - NaN - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("Ec2QuerySupportsInfinityFloatOutputs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - Infinity - Infinity - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("Ec2QuerySupportsNegativeInfinityFloatOutputs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - -Infinity - -Infinity - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Blobs are base64 encoded - */ -it("Ec2XmlBlobs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - dmFsdWU= - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty blobs are deserialized as empty string - */ -it("Ec2XmlEmptyBlobs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty self closed blobs are deserialized as empty string - */ -it("Ec2XmlEmptySelfClosedBlobs:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes empty XML lists - */ -it("Ec2XmlEmptyLists:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: [], - - stringSet: [], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("Ec2XmlEnums:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - Foo - 0 - 1 - - Foo - 0 - - - Foo - 0 - - - - hi - Foo - - - zero - 0 - - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlEnumsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests for XML list serialization - */ -it("Ec2XmlLists:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - foo - bar - - - foo - bar - - - 1 - 2 - - - true - false - - - 2014-04-29T18:30:38Z - 2014-04-29T18:30:38Z - - - Foo - 0 - - - - foo - bar - - - baz - qux - - - - foo - bar - - hi - bye - yep - nope - a - b - a - b - - - 1 - 2 - - - 3 - 4 - - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - renamedListMembers: ["foo", "bar"], - - flattenedList: ["hi", "bye"], - - flattenedList2: ["yep", "nope"], - - flattenedListWithMemberNamespace: ["a", "b"], - - flattenedListWithNamespace: ["a", "b"], - - structureList: [ - { - a: "1", - - b: "2", - }, - - { - a: "3", - - b: "4", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML namespaces - */ -it("Ec2XmlNamespaces:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - - Foo - - Bar - Baz - - - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlNamespacesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo", - - values: ["Bar", "Baz"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests how normal timestamps are serialized - */ -it("Ec2XmlTimestamps:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - 2014-04-29T18:30:38Z - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - normal: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("Ec2XmlTimestampsWithDateTimeFormat:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - 2014-04-29T18:30:38Z - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - dateTime: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("Ec2XmlTimestampsWithEpochSecondsFormat:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - 1398796238 - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - epochSeconds: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("Ec2XmlTimestampsWithHttpDateFormat:Response", async () => { - const client = new EC2ProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml;charset=UTF-8", - }, - ` - Tue, 29 Apr 2014 18:30:38 GMT - requestid - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - httpDate: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBody: string): Object => { - const fromEntries = (components: string[][]): { [key: string]: string } => { - const parts: { [key: string]: string } = {}; - - components.forEach((component) => { - parts[component[0]] = component[1]; - }); - - return parts; - }; - - // Generate to k:v maps from query components - const expectedParts = fromEntries(expectedBody.split("&").map((part) => part.trim().split("="))); - const generatedParts = fromEntries(generatedBody.split("&").map((part) => part.trim().split("="))); - - 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-protocoltests-ec2/tsconfig.es.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-ec2/tsconfig.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json b/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-ec2/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-json-10/.gitignore b/protocol_tests/aws-protocoltests-json-10/.gitignore deleted file mode 100644 index 54f14c9aef25..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json diff --git a/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md b/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md deleted file mode 100644 index 0995571d0579..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/CHANGELOG.md +++ /dev/null @@ -1,195 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - -**Note:** Version bump only for package @aws-sdk/aws-json-10 - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* **protocol_tests:** add downlevel-dts script to aws-json-10 ([#2540](https://github.com/aws/aws-sdk-js-v3/issues/2540)) ([e77b926](https://github.com/aws/aws-sdk-js-v3/commit/e77b926c739bcf8fd673a6f2725116ef6865c6c0)) diff --git a/protocol_tests/aws-protocoltests-json-10/LICENSE b/protocol_tests/aws-protocoltests-json-10/LICENSE deleted file mode 100644 index f9e0c8672bca..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-json-10/README.md b/protocol_tests/aws-protocoltests-json-10/README.md deleted file mode 100644 index d5387252a790..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# @aws-sdk/aws-protocoltests-json-10 - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-json-10/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json-10) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-json-10.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json-10) - -## Description - -AWS SDK for JavaScript JSONRPC10 Client for Node.js, Browser and React Native. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-json-10 -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-json-10` -- `yarn add @aws-sdk/aws-protocoltests-json-10` -- `pnpm add @aws-sdk/aws-protocoltests-json-10` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `JSONRPC10Client` and -the commands you need, for example `EmptyInputAndEmptyOutputCommand`: - -```js -// ES5 example -const { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); -``` - -```ts -// ES6+ example -import { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new JSONRPC10Client({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new EmptyInputAndEmptyOutputCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-json-10"; -const client = new AWS.JSONRPC10({ region: "REGION" }); - -// async/await. -try { - const data = await client.emptyInputAndEmptyOutput(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .emptyInputAndEmptyOutput(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.emptyInputAndEmptyOutput(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-json-10` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-json-10/jest.config.js b/protocol_tests/aws-protocoltests-json-10/jest.config.js deleted file mode 100644 index 02eed352c6a8..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - preset: "ts-jest", - testMatch: ["**/*.spec.ts", "!**/*.browser.spec.ts", "!**/*.integ.spec.ts"], -}; diff --git a/protocol_tests/aws-protocoltests-json-10/package.json b/protocol_tests/aws-protocoltests-json-10/package.json deleted file mode 100644 index e9e7e651283f..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-json-10", - "description": "@aws-sdk/aws-protocoltests-json-10 client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-json-10", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-json-10" - } -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts deleted file mode 100644 index f391f3a6375d..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10.ts +++ /dev/null @@ -1,331 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommand, - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - GreetingWithErrorsCommand, - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, -} from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommand, - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { JsonUnionsCommand, JsonUnionsCommandInput, JsonUnionsCommandOutput } from "./commands/JsonUnionsCommand"; -import { - NoInputAndNoOutputCommand, - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, -} from "./commands/NoInputAndNoOutputCommand"; -import { - NoInputAndOutputCommand, - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, -} from "./commands/NoInputAndOutputCommand"; -import { - SimpleScalarPropertiesCommand, - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { JSONRPC10Client } from "./JSONRPC10Client"; - -export class JSONRPC10 extends JSONRPC10Client { - /** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - */ - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), - cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): Promise | void { - const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A ComplexError error. - * - * Implementations must be able to successfully take a response and - * properly deserialize successful and error responses. - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 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. - */ - public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; - public jsonUnions( - args: JsonUnionsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonUnionsCommandOutput) => void - ): void; - public jsonUnions( - args: JsonUnionsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), - cb?: (err: any, data?: JsonUnionsCommandOutput) => void - ): Promise | void { - const command = new JsonUnionsCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - */ - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - */ - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndOutputCommand(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 simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarPropertiesCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts b/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts deleted file mode 100644 index 439cac743957..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/JSONRPC10Client.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - 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"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | EmptyInputAndEmptyOutputCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | GreetingWithErrorsCommandInput - | HostWithPathOperationCommandInput - | JsonUnionsCommandInput - | NoInputAndNoOutputCommandInput - | NoInputAndOutputCommandInput - | SimpleScalarPropertiesCommandInput; - -export type ServiceOutputTypes = - | EmptyInputAndEmptyOutputCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | GreetingWithErrorsCommandOutput - | HostWithPathOperationCommandOutput - | JsonUnionsCommandOutput - | NoInputAndNoOutputCommandOutput - | NoInputAndOutputCommandOutput - | SimpleScalarPropertiesCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; -} - -type JSONRPC10ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of JSONRPC10Client class constructor that set the region, credentials and other options. - */ -export interface JSONRPC10ClientConfig extends JSONRPC10ClientConfigType {} - -type JSONRPC10ClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of JSONRPC10Client class. This is resolved and normalized from the {@link JSONRPC10ClientConfig | constructor configuration interface}. - */ -export interface JSONRPC10ClientResolvedConfig extends JSONRPC10ClientResolvedConfigType {} - -export class JSONRPC10Client extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - JSONRPC10ClientResolvedConfig -> { - /** - * The resolved configuration of JSONRPC10Client class. This is resolved and normalized from the {@link JSONRPC10ClientConfig | constructor configuration interface}. - */ - readonly config: JSONRPC10ClientResolvedConfig; - - constructor(configuration: JSONRPC10ClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveUserAgentConfig(_config_4); - super(_config_5); - this.config = _config_5; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts deleted file mode 100644 index 156d28111e97..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/EmptyInputAndEmptyOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { EmptyInputAndEmptyOutputInput } from "../models/models_0"; -import { - deserializeAws_json1_0EmptyInputAndEmptyOutputCommand, - serializeAws_json1_0EmptyInputAndEmptyOutputCommand, -} from "../protocols/Aws_json1_0"; - -export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} -export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputInput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import - * // const { JSONRPC10Client, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import - * const client = new JSONRPC10Client(config); - * const command = new EmptyInputAndEmptyOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. - * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. - * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. - * - */ -export class EmptyInputAndEmptyOutputCommand extends $Command< - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { - // 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 = "EmptyInputAndEmptyOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - outputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0EmptyInputAndEmptyOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0EmptyInputAndEmptyOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index 8ea0621a0e08..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_0EndpointOperationCommand, - serializeAws_json1_0EndpointOperationCommand, -} from "../protocols/Aws_json1_0"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // 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 = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0EndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0EndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index fe7d56364811..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_json1_0EndpointWithHostLabelOperationCommand, - serializeAws_json1_0EndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_json1_0"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // 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 = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_json1_0EndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_json1_0EndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index faea0676ae2a..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,102 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_json1_0GreetingWithErrorsCommand, - serializeAws_json1_0GreetingWithErrorsCommand, -} from "../protocols/Aws_json1_0"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A ComplexError error. - * - * Implementations must be able to successfully take a response and - * properly deserialize successful and error responses. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JSONRPC10Client, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import - * // const { JSONRPC10Client, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import - * const client = new JSONRPC10Client(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // 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 = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0GreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0GreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts deleted file mode 100644 index 9b0f527cacdb..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/HostWithPathOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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-protocoltests-json-10/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts deleted file mode 100644 index 69aab9b76c7c..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/JsonUnionsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { UnionInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_0JsonUnionsCommand, - serializeAws_json1_0JsonUnionsCommand, -} from "../protocols/Aws_json1_0"; - -export interface JsonUnionsCommandInput extends UnionInputOutput {} -export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} - -/** - * This operation uses unions for inputs and outputs. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JSONRPC10Client, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import - * // const { JSONRPC10Client, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import - * const client = new JSONRPC10Client(config); - * const command = new JsonUnionsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonUnionsCommandInput} for command's `input` shape. - * @see {@link JsonUnionsCommandOutput} for command's `response` shape. - * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonUnionsCommand extends $Command< - JsonUnionsCommandInput, - JsonUnionsCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonUnionsCommandInput) { - // 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 = "JsonUnionsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0JsonUnionsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0JsonUnionsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts deleted file mode 100644 index 076599e0dc95..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndNoOutputCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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_0NoInputAndNoOutputCommand, - serializeAws_json1_0NoInputAndNoOutputCommand, -} from "../protocols/Aws_json1_0"; - -export interface NoInputAndNoOutputCommandInput {} -export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JSONRPC10Client, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import - * // const { JSONRPC10Client, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import - * const client = new JSONRPC10Client(config); - * const command = new NoInputAndNoOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. - * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndNoOutputCommand extends $Command< - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndNoOutputCommandInput) { - // 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 = "NoInputAndNoOutputCommand"; - 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0NoInputAndNoOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0NoInputAndNoOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts deleted file mode 100644 index 6ffef247a863..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/NoInputAndOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NoInputAndOutputOutput } from "../models/models_0"; -import { - deserializeAws_json1_0NoInputAndOutputCommand, - serializeAws_json1_0NoInputAndOutputCommand, -} from "../protocols/Aws_json1_0"; - -export interface NoInputAndOutputCommandInput {} -export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JSONRPC10Client, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import - * // const { JSONRPC10Client, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import - * const client = new JSONRPC10Client(config); - * const command = new NoInputAndOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. - * @see {@link JSONRPC10ClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndOutputCommand extends $Command< - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndOutputCommandInput) { - // 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 = "NoInputAndOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0NoInputAndOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0NoInputAndOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts deleted file mode 100644 index f38a7bb73982..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/SimpleScalarPropertiesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_0SimpleScalarPropertiesCommand, - serializeAws_json1_0SimpleScalarPropertiesCommand, -} from "../protocols/Aws_json1_0"; - -export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} -export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} - -export class SimpleScalarPropertiesCommand extends $Command< - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, - JSONRPC10ClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarPropertiesCommandInput) { - // 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 = "SimpleScalarPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_0SimpleScalarPropertiesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_0SimpleScalarPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts b/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts deleted file mode 100644 index 324ce1f9916e..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/commands/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from "./EmptyInputAndEmptyOutputCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HostWithPathOperationCommand"; -export * from "./JsonUnionsCommand"; -export * from "./NoInputAndNoOutputCommand"; -export * from "./NoInputAndOutputCommand"; -export * from "./SimpleScalarPropertiesCommand"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts b/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts deleted file mode 100644 index 113b0b9ec77f..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "jsonrpc10.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "jsonrpc10.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "jsonrpc10.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "jsonrpc10.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "jsonrpc10.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "jsonrpc10", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-json-10/src/index.ts b/protocol_tests/aws-protocoltests-json-10/src/index.ts deleted file mode 100644 index 2c7186bc1e30..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./JSONRPC10"; -export * from "./JSONRPC10Client"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/models/index.ts b/protocol_tests/aws-protocoltests-json-10/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts b/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts deleted file mode 100644 index 263491bd4a9d..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/models/models_0.ts +++ /dev/null @@ -1,362 +0,0 @@ -import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputInput {} - -export namespace EmptyInputAndEmptyOutputInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -/** - * This error has test cases that test some of the dark corners of Amazon service - * framework history. It should only be implemented by clients. - */ -export interface FooError extends __SmithyException, $MetadataBearer { - name: "FooError"; - $fault: "server"; -} - -export namespace FooError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FooError): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -/** - * A union with a representative set of types for members. - */ -export type MyUnion = - | MyUnion.BlobValueMember - | MyUnion.BooleanValueMember - | MyUnion.EnumValueMember - | MyUnion.ListValueMember - | MyUnion.MapValueMember - | MyUnion.NumberValueMember - | MyUnion.StringValueMember - | MyUnion.StructureValueMember - | MyUnion.TimestampValueMember - | MyUnion.$UnknownMember; - -export namespace MyUnion { - export interface StringValueMember { - stringValue: string; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface BooleanValueMember { - stringValue?: never; - booleanValue: boolean; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface NumberValueMember { - stringValue?: never; - booleanValue?: never; - numberValue: number; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface BlobValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue: Uint8Array; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface TimestampValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue: Date; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface EnumValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue: FooEnum | string; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface ListValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue: string[]; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface MapValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue: { [key: string]: string }; - structureValue?: never; - $unknown?: never; - } - - export interface StructureValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue: GreetingStruct; - $unknown?: never; - } - - export interface $UnknownMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown: [string, any]; - } - - export interface Visitor { - stringValue: (value: string) => T; - booleanValue: (value: boolean) => T; - numberValue: (value: number) => T; - blobValue: (value: Uint8Array) => T; - timestampValue: (value: Date) => T; - enumValue: (value: FooEnum | string) => T; - listValue: (value: string[]) => T; - mapValue: (value: { [key: string]: string }) => T; - structureValue: (value: GreetingStruct) => T; - _: (name: string, value: any) => T; - } - - export const visit = (value: MyUnion, visitor: Visitor): T => { - if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); - if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); - if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); - if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); - if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); - if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); - if (value.listValue !== undefined) return visitor.listValue(value.listValue); - if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); - if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); - return visitor._(value.$unknown[0], value.$unknown[1]); - }; - - /** - * @internal - */ - export const filterSensitiveLog = (obj: MyUnion): any => { - if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; - if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; - if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; - if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; - if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; - if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; - if (obj.listValue !== undefined) return { listValue: obj.listValue }; - if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; - if (obj.structureValue !== undefined) - return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; - if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; - }; -} - -/** - * A shared structure that contains a single union member. - */ -export interface UnionInputOutput { - /** - * A union with a representative set of types for members. - */ - contents?: MyUnion; -} - -export namespace UnionInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ - ...obj, - ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), - }); -} - -export interface NoInputAndOutputOutput {} - -export namespace NoInputAndOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarPropertiesInputOutput { - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarPropertiesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts b/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts deleted file mode 100644 index 07e9cd3c78cc..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts +++ /dev/null @@ -1,959 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - expectBoolean as __expectBoolean, - expectInt32 as __expectInt32, - expectNonNull as __expectNonNull, - expectNumber as __expectNumber, - expectString as __expectString, - expectUnion as __expectUnion, - limitedParseDouble as __limitedParseDouble, - limitedParseFloat32 as __limitedParseFloat32, - parseEpochTimestamp as __parseEpochTimestamp, - serializeFloat as __serializeFloat, -} from "@aws-sdk/smithy-client"; -import { - Endpoint as __Endpoint, - HeaderBag as __HeaderBag, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "../commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - 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"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "../commands/SimpleScalarPropertiesCommand"; -import { - ComplexError, - ComplexNestedErrorData, - EmptyInputAndEmptyOutputInput, - FooError, - GreetingStruct, - GreetingWithErrorsOutput, - HostLabelInput, - InvalidGreeting, - MyUnion, - NoInputAndOutputOutput, - SimpleScalarPropertiesInputOutput, - UnionInputOutput, -} from "../models/models_0"; - -export const serializeAws_json1_0EmptyInputAndEmptyOutputCommand = async ( - input: EmptyInputAndEmptyOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.EmptyInputAndEmptyOutput", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_0EmptyInputAndEmptyOutputInput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_0EndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.EndpointOperation", - }; - const body = "{}"; - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_json1_0EndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.EndpointWithHostLabelOperation", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_0HostLabelInput(input, context)); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_json1_0GreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.GreetingWithErrors", - }; - const body = "{}"; - 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 -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.JsonUnions", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_0UnionInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_0NoInputAndNoOutputCommand = async ( - input: NoInputAndNoOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.NoInputAndNoOutput", - }; - const body = "{}"; - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_0NoInputAndOutputCommand = async ( - input: NoInputAndOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.NoInputAndOutput", - }; - const body = "{}"; - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_0SimpleScalarPropertiesCommand = async ( - input: SimpleScalarPropertiesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": "JsonRpc10.SimpleScalarProperties", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_0SimpleScalarPropertiesInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const deserializeAws_json1_0EmptyInputAndEmptyOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0EmptyInputAndEmptyOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_0EmptyInputAndEmptyOutputInput(data, context); - const response: EmptyInputAndEmptyOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0EmptyInputAndEmptyOutputCommandError = 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_0EndpointOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0EndpointOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0EndpointOperationCommandError = 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_0EndpointWithHostLabelOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0EndpointWithHostLabelOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointWithHostLabelOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0EndpointWithHostLabelOperationCommandError = 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_0GreetingWithErrorsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0GreetingWithErrorsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_0GreetingWithErrorsOutput(data, context); - const response: GreetingWithErrorsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0GreetingWithErrorsCommandError = 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.json10#ComplexError": - response = { - ...(await deserializeAws_json1_0ComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "FooError": - case "aws.protocoltests.json10#FooError": - response = { - ...(await deserializeAws_json1_0FooErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.json10#InvalidGreeting": - response = { - ...(await deserializeAws_json1_0InvalidGreetingResponse(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_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 -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0JsonUnionsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_0UnionInputOutput(data, context); - const response: JsonUnionsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0JsonUnionsCommandError = 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_0NoInputAndNoOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0NoInputAndNoOutputCommandError(output, context); - } - await collectBody(output.body, context); - const response: NoInputAndNoOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0NoInputAndNoOutputCommandError = 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_0NoInputAndOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0NoInputAndOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_0NoInputAndOutputOutput(data, context); - const response: NoInputAndOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0NoInputAndOutputCommandError = 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_0SimpleScalarPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_0SimpleScalarPropertiesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_0SimpleScalarPropertiesInputOutput(data, context); - const response: SimpleScalarPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_0SimpleScalarPropertiesCommandError = 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)); -}; - -const deserializeAws_json1_0ComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_0ComplexError(body, context); - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_0FooErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_0FooError(body, context); - const contents: FooError = { - name: "FooError", - $fault: "server", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_0InvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_0InvalidGreeting(body, context); - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const serializeAws_json1_0EmptyInputAndEmptyOutputInput = ( - input: EmptyInputAndEmptyOutputInput, - context: __SerdeContext -): any => { - return {}; -}; - -const serializeAws_json1_0HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { - return { - ...(input.label !== undefined && input.label !== null && { label: input.label }), - }; -}; - -const serializeAws_json1_0MyUnion = (input: MyUnion, context: __SerdeContext): any => { - return MyUnion.visit(input, { - blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), - booleanValue: (value) => ({ booleanValue: value }), - enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: serializeAws_json1_0StringList(value, context) }), - mapValue: (value) => ({ mapValue: serializeAws_json1_0StringMap(value, context) }), - numberValue: (value) => ({ numberValue: value }), - stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: serializeAws_json1_0GreetingStruct(value, context) }), - timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), - _: (name, value) => ({ name: value } as any), - }); -}; - -const serializeAws_json1_0SimpleScalarPropertiesInputOutput = ( - input: SimpleScalarPropertiesInputOutput, - context: __SerdeContext -): any => { - return { - ...(input.doubleValue !== undefined && - input.doubleValue !== null && { doubleValue: __serializeFloat(input.doubleValue) }), - ...(input.floatValue !== undefined && - input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), - }; -}; - -const serializeAws_json1_0UnionInputOutput = (input: UnionInputOutput, context: __SerdeContext): any => { - return { - ...(input.contents !== undefined && - input.contents !== null && { contents: serializeAws_json1_0MyUnion(input.contents, context) }), - }; -}; - -const serializeAws_json1_0GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), - }; -}; - -const serializeAws_json1_0StringList = (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_json1_0StringMap = (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 deserializeAws_json1_0ComplexError = (output: any, context: __SerdeContext): ComplexError => { - return { - Nested: - output.Nested !== undefined && output.Nested !== null - ? deserializeAws_json1_0ComplexNestedErrorData(output.Nested, context) - : undefined, - TopLevel: __expectString(output.TopLevel), - } as any; -}; - -const deserializeAws_json1_0ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Fooooo), - } as any; -}; - -const deserializeAws_json1_0EmptyInputAndEmptyOutputInput = ( - output: any, - context: __SerdeContext -): EmptyInputAndEmptyOutputInput => { - return {} as any; -}; - -const deserializeAws_json1_0FooError = (output: any, context: __SerdeContext): FooError => { - return {} as any; -}; - -const deserializeAws_json1_0GreetingWithErrorsOutput = ( - output: any, - context: __SerdeContext -): GreetingWithErrorsOutput => { - return { - greeting: __expectString(output.greeting), - } as any; -}; - -const deserializeAws_json1_0InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - return { - Message: __expectString(output.Message), - } as any; -}; - -const deserializeAws_json1_0MyUnion = (output: any, context: __SerdeContext): MyUnion => { - if (output.blobValue !== undefined && output.blobValue !== null) { - return { - blobValue: context.base64Decoder(output.blobValue), - }; - } - if (__expectBoolean(output.booleanValue) !== undefined) { - return { booleanValue: __expectBoolean(output.booleanValue) as any }; - } - if (__expectString(output.enumValue) !== undefined) { - return { enumValue: __expectString(output.enumValue) as any }; - } - if (output.listValue !== undefined && output.listValue !== null) { - return { - listValue: deserializeAws_json1_0StringList(output.listValue, context), - }; - } - if (output.mapValue !== undefined && output.mapValue !== null) { - return { - mapValue: deserializeAws_json1_0StringMap(output.mapValue, context), - }; - } - if (__expectInt32(output.numberValue) !== undefined) { - return { numberValue: __expectInt32(output.numberValue) as any }; - } - if (__expectString(output.stringValue) !== undefined) { - return { stringValue: __expectString(output.stringValue) as any }; - } - if (output.structureValue !== undefined && output.structureValue !== null) { - return { - structureValue: deserializeAws_json1_0GreetingStruct(output.structureValue, context), - }; - } - if (output.timestampValue !== undefined && output.timestampValue !== null) { - return { - timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), - }; - } - return { $unknown: Object.entries(output)[0] }; -}; - -const deserializeAws_json1_0NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInputAndOutputOutput => { - return {} as any; -}; - -const deserializeAws_json1_0SimpleScalarPropertiesInputOutput = ( - output: any, - context: __SerdeContext -): SimpleScalarPropertiesInputOutput => { - return { - doubleValue: __limitedParseDouble(output.doubleValue), - floatValue: __limitedParseFloat32(output.floatValue), - } as any; -}; - -const deserializeAws_json1_0UnionInputOutput = (output: any, context: __SerdeContext): UnionInputOutput => { - return { - contents: - output.contents !== undefined && output.contents !== null - ? deserializeAws_json1_0MyUnion(__expectUnion(output.contents), context) - : undefined, - } as any; -}; - -const deserializeAws_json1_0GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; -}; - -const deserializeAws_json1_0StringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_json1_0StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const buildHttpRpcRequest = async ( - context: __SerdeContext, - headers: __HeaderBag, - path: string, - resolvedHostname: string | undefined, - body: any -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents: any = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers, - }; - if (resolvedHostname !== undefined) { - contents.hostname = resolvedHostname; - } - if (body !== undefined) { - contents.body = body; - } - return new __HttpRequest(contents); -}; - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); - } - return {}; - }); - -/** - * Load an error code for the aws.rest-json-1.1 protocol. - */ -const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { - const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - - const sanitizeErrorCode = (rawValue: string): string => { - let cleanValue = rawValue; - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } - return cleanValue; - }; - - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== undefined) { - return sanitizeErrorCode(output.headers[headerKey]); - } - - if (data.code !== undefined) { - return sanitizeErrorCode(data.code); - } - - if (data["__type"] !== undefined) { - return sanitizeErrorCode(data["__type"]); - } - - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts deleted file mode 100644 index df129702b088..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts deleted file mode 100644 index a05e1a499cea..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts deleted file mode 100644 index 5b41a4cc375c..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { defaultRegionInfoProvider } from "./endpoints"; -import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => ({ - apiVersion: "2020-07-14", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "JSON RPC 10", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts deleted file mode 100644 index 15c436103384..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/src/runtimeConfig.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Hash } from "@aws-sdk/hash-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { JSONRPC10ClientConfig } from "./JSONRPC10Client"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JSONRPC10ClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts b/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts deleted file mode 100644 index e30cc0e3d46c..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts +++ /dev/null @@ -1,2058 +0,0 @@ -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"; - -import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; -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"; -import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; -import { JSONRPC10Client } from "../../src/JSONRPC10Client"; -import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Clients must always send an empty object if input is modeled. - */ -it("AwsJson10EmptyInputAndEmptyOutput:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyInputAndEmptyOutputCommand({} as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.EmptyInputAndEmptyOutput"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * A service will always return a JSON object for operations with modeled output. - */ -it("AwsJson10EmptyInputAndEmptyOutputSendJsonObject:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("AwsJson10EndpointTrait:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("AwsJson10EndpointTraitWithHostLabel:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"label\": \"bar\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Parses simple JSON errors - */ -it("AwsJson10InvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "aws.protocoltests.json10#InvalidGreeting", - "Message": "Hi" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. - */ -it("AwsJson10FooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' - * is to be interpreted as 'ValidationException'. - * - * For an example service see Amazon Polly. - */ -it("AwsJson10FooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. - */ -it("AwsJson10FooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": - "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. - * - * For example service see Amazon S3 Glacier. - */ -it("AwsJson10FooErrorUsingCode:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "code": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("AwsJson10FooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "code": "aws.protocoltests.json10#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("AwsJson10FooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "code": "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type. - */ -it("AwsJson10FooErrorWithDunderType:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("AwsJson10FooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "aws.protocoltests.json10#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("AwsJson10FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "aws.protocoltests.json10#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Parses a complex error with no message member - */ -it("AwsJson10ComplexError:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "aws.protocoltests.json10#ComplexError", - "TopLevel": "Top level", - "Nested": { - "Fooooo": "bar" - } - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Parses a complex error with an empty body - */ -it("AwsJson10EmptyComplexError:Error:GreetingWithErrors", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "__type": "aws.protocoltests.json10#ComplexError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - return; - } - 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 - */ -it("AwsJson10SerializeStringUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - stringValue: "foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"stringValue\": \"foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a boolean union value - */ -it("AwsJson10SerializeBooleanUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - booleanValue: true, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"booleanValue\": true - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a number union value - */ -it("AwsJson10SerializeNumberUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - numberValue: 1, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"numberValue\": 1 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob union value - */ -it("AwsJson10SerializeBlobUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"blobValue\": \"Zm9v\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a timestamp union value - */ -it("AwsJson10SerializeTimestampUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - timestampValue: new Date(1398796238000), - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"timestampValue\": 1398796238 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an enum union value - */ -it("AwsJson10SerializeEnumUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - enumValue: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"enumValue\": \"Foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a list union value - */ -it("AwsJson10SerializeListUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - listValue: ["foo", "bar"], - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"listValue\": [\"foo\", \"bar\"] - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a map union value - */ -it("AwsJson10SerializeMapUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"mapValue\": { - \"foo\": \"bar\", - \"spam\": \"eggs\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure union value - */ -it("AwsJson10SerializeStructureUnionValue:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - structureValue: { - hi: "hello", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"structureValue\": { - \"hi\": \"hello\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes a string union value - */ -it("AwsJson10DeserializeStringUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "stringValue": "foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - stringValue: "foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a boolean union value - */ -it("AwsJson10DeserializeBooleanUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "booleanValue": true - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - booleanValue: true, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a number union value - */ -it("AwsJson10DeserializeNumberUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "numberValue": 1 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - numberValue: 1, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a blob union value - */ -it("AwsJson10DeserializeBlobUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "blobValue": "Zm9v" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a timestamp union value - */ -it("AwsJson10DeserializeTimestampUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "timestampValue": 1398796238 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - timestampValue: new Date(1398796238000), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes an enum union value - */ -it("AwsJson10DeserializeEnumUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "enumValue": "Foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - enumValue: "Foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a list union value - */ -it("AwsJson10DeserializeListUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "listValue": ["foo", "bar"] - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - listValue: ["foo", "bar"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a map union value - */ -it("AwsJson10DeserializeMapUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "mapValue": { - "foo": "bar", - "spam": "eggs" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a structure union value - */ -it("AwsJson10DeserializeStructureUnionValue:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "contents": { - "structureValue": { - "hi": "hello" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - structureValue: { - hi: "hello", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Clients must always send an empty JSON object payload for - * operations with no input (that is, `{}`). While AWS service - * implementations support requests with no payload or requests - * that send `{}`, always sending `{}` from the client is - * preferred for forward compatibility in case input is ever - * added to an operation. - */ -it("AwsJson10MustAlwaysSendEmptyJsonPayload:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndNoOutputCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.NoInputAndNoOutput"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * When no output is defined, the service is expected to return - * an empty payload, however, client must ignore a JSON payload - * if one is returned. This ensures that if output is added later, - * then it will not break the client. - */ -it("AwsJson10HandlesEmptyOutputShape:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * This client-only test builds on handles_empty_output_shape, - * by including unexpected fields in the JSON. A client - * needs to ignore JSON output that is empty or that contains - * JSON object data. - */ -it("AwsJson10HandlesUnexpectedJsonOutput:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "foo": true - }` - ), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * When no output is defined, the service is expected to return - * an empty payload. Despite the lack of a payload, the service - * is expected to always send a Content-Type header. Clients must - * handle cases where a service returns a JSON object and where - * a service returns no JSON at all. - */ -it("AwsJson10ServiceRespondsWithNoPayload:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `` - ), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * A client should always send and empty JSON object payload. - */ -it("AwsJson10NoInputAndOutput:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndOutputCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.NoInputAndOutput"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output always serializes an empty object payload. - */ -it("AwsJson10NoInputAndOutput:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Supports handling NaN float values. - */ -it("AwsJson10SupportsNaNFloatInputs:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: NaN, - - doubleValue: NaN, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"NaN\", - \"doubleValue\": \"NaN\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsJson10SupportsInfinityFloatInputs:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: Infinity, - - doubleValue: Infinity, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"Infinity\", - \"doubleValue\": \"Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsJson10SupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: -Infinity, - - doubleValue: -Infinity, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.0"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonRpc10.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"-Infinity\", - \"doubleValue\": \"-Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("AwsJson10SupportsNaNFloatInputs:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "floatValue": "NaN", - "doubleValue": "NaN" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsJson10SupportsInfinityFloatInputs:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "floatValue": "Infinity", - "doubleValue": "Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsJson10SupportsNegativeInfinityFloatInputs:Response", async () => { - const client = new JSONRPC10Client({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.0", - }, - `{ - "floatValue": "-Infinity", - "doubleValue": "-Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { - const expectedParts = JSON.parse(expectedBody); - const generatedParts = JSON.parse(generatedBody); - - 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-protocoltests-json-10/tsconfig.es.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-json-10/tsconfig.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json b/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-json-10/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-json/.gitignore b/protocol_tests/aws-protocoltests-json/.gitignore deleted file mode 100644 index bff6121c007d..000000000000 --- a/protocol_tests/aws-protocoltests-json/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-json/CHANGELOG.md b/protocol_tests/aws-protocoltests-json/CHANGELOG.md deleted file mode 100644 index 066813739d08..000000000000 --- a/protocol_tests/aws-protocoltests-json/CHANGELOG.md +++ /dev/null @@ -1,764 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -## [3.36.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.0...v3.36.1) (2021-10-12) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - - -### Features - -* **codegen:** assert sets have no duplicates ([#2764](https://github.com/aws/aws-sdk-js-v3/issues/2764)) ([aa62fc3](https://github.com/aws/aws-sdk-js-v3/commit/aa62fc3eda48e9a57753cea6fc5896b65f2dbe3b)) - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - -### Features - -* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) - - - - - -# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) - - -### Features - -* support Sigv4 for non AWS services ([#2385](https://github.com/aws/aws-sdk-js-v3/issues/2385)) ([0a251aa](https://github.com/aws/aws-sdk-js-v3/commit/0a251aa44d54fbf21e328ccf2b20db45e94aaa90)), closes [/github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/main.smithy#L11-L13](https://github.com//github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/main.smithy/issues/L11-L13) -* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) - - - - - -# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) - - -### Features - -* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) - - - - - -# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) - - -### Bug Fixes - -* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) - - - - - -# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) - - -### Bug Fixes - -* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) - - -### Features - -* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) - - - - - -## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) - - -### Features - -* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) - - - - - -# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) - - -### Bug Fixes - -* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) - - -### Features - -* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) - - - - - -# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) - - -### Features - -* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) - - - - - -# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) - - -### Bug Fixes - -* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) - - - - - -# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) - - -### Bug Fixes - -* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) - - - - - -# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) - - -### Bug Fixes - -* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) - - - - - -# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) - - -### Features - -* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) -* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) - - - - - -# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) - - -### Bug Fixes - -* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) -* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) -* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) - - -### Features - -* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) - - - - - -# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) - - -### Bug Fixes - -* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) - - - - - -# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) - - -### Bug Fixes - -* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) -* **clients:** use signing name from auth sigv4 trait ([#1835](https://github.com/aws/aws-sdk-js-v3/issues/1835)) ([e539302](https://github.com/aws/aws-sdk-js-v3/commit/e539302f69e55eb46ffd751125fe06d49c21d1c5)) -* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) -* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) -* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) - - -### Features - -* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) - - - - - -# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) - - -### Features - -* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) - - - - - -# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) - - -### Bug Fixes - -* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) - - -### Features - -* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) - - - - - -# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) - - -### Features - -* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) - - - - - -# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) - - -### Bug Fixes - -* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) - - - - - -# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) - - -### Features - -* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) - - - - - -# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) - - -### Bug Fixes - -* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) - - - - - -# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) - - -### Features - -* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) - - - - - -# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.9...@aws-sdk/aws-json@1.0.0-gamma.10) (2020-10-07) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.8...@aws-sdk/aws-json@1.0.0-gamma.9) (2020-09-29) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.7...@aws-sdk/aws-json@1.0.0-gamma.8) (2020-09-15) - - -### Bug Fixes - -* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) -* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) - - - - - -# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.6...@aws-sdk/aws-json@1.0.0-gamma.7) (2020-09-01) - - -### Features - -* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) - - - - - -# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.5...@aws-sdk/aws-json@1.0.0-gamma.6) (2020-08-25) - - -### Features - -* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) -* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) -* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) - - - - - -# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.4...@aws-sdk/aws-json@1.0.0-gamma.5) (2020-08-04) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.3...@aws-sdk/aws-json@1.0.0-gamma.4) (2020-07-21) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-json@1.0.0-gamma.2...@aws-sdk/aws-json@1.0.0-gamma.3) (2020-07-13) - -**Note:** Version bump only for package @aws-sdk/aws-json - - - - - -# 1.0.0-gamma.2 (2020-07-08) - - -### Features - -* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) - - - -# 1.0.0-gamma.2 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.1 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.0 (2020-05-21) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-beta.0 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-json/LICENSE b/protocol_tests/aws-protocoltests-json/LICENSE deleted file mode 100644 index dd65ae06be7a..000000000000 --- a/protocol_tests/aws-protocoltests-json/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-json/README.md b/protocol_tests/aws-protocoltests-json/README.md deleted file mode 100644 index 439b9b21e9d4..000000000000 --- a/protocol_tests/aws-protocoltests-json/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# @aws-sdk/aws-protocoltests-json - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-json/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-json.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-json) - -## Description - -AWS SDK for JavaScript JsonProtocol Client for Node.js, Browser and React Native. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-json -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-json` -- `yarn add @aws-sdk/aws-protocoltests-json` -- `pnpm add @aws-sdk/aws-protocoltests-json` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `JsonProtocolClient` and -the commands you need, for example `EmptyOperationCommand`: - -```js -// ES5 example -const { JsonProtocolClient, EmptyOperationCommand } = require("@aws-sdk/aws-protocoltests-json"); -``` - -```ts -// ES6+ example -import { JsonProtocolClient, EmptyOperationCommand } from "@aws-sdk/aws-protocoltests-json"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new JsonProtocolClient({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new EmptyOperationCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-json"; -const client = new AWS.JsonProtocol({ region: "REGION" }); - -// async/await. -try { - const data = await client.emptyOperation(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .emptyOperation(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.emptyOperation(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-json` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-json/jest.config.js b/protocol_tests/aws-protocoltests-json/jest.config.js deleted file mode 100644 index a8d1c2e49912..000000000000 --- a/protocol_tests/aws-protocoltests-json/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const base = require("../../jest.config.base.js"); - -module.exports = { - ...base, -}; diff --git a/protocol_tests/aws-protocoltests-json/package.json b/protocol_tests/aws-protocoltests-json/package.json deleted file mode 100644 index 67d4484047e6..000000000000 --- a/protocol_tests/aws-protocoltests-json/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-json", - "description": "@aws-sdk/aws-protocoltests-json client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/client-sts": "3.38.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/credential-provider-node": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-signing": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-json", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-json" - } -} diff --git a/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts b/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts deleted file mode 100644 index 3cdf050776b4..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/JsonProtocol.ts +++ /dev/null @@ -1,412 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - EmptyOperationCommand, - EmptyOperationCommandInput, - EmptyOperationCommandOutput, -} from "./commands/EmptyOperationCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - GreetingWithErrorsCommand, - 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 { - KitchenSinkOperationCommand, - KitchenSinkOperationCommandInput, - KitchenSinkOperationCommandOutput, -} from "./commands/KitchenSinkOperationCommand"; -import { - NullOperationCommand, - NullOperationCommandInput, - NullOperationCommandOutput, -} from "./commands/NullOperationCommand"; -import { - OperationWithOptionalInputOutputCommand, - OperationWithOptionalInputOutputCommandInput, - OperationWithOptionalInputOutputCommandOutput, -} from "./commands/OperationWithOptionalInputOutputCommand"; -import { - PutAndGetInlineDocumentsCommand, - PutAndGetInlineDocumentsCommandInput, - PutAndGetInlineDocumentsCommandOutput, -} from "./commands/PutAndGetInlineDocumentsCommand"; -import { - SimpleScalarPropertiesCommand, - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { JsonProtocolClient } from "./JsonProtocolClient"; - -export class JsonProtocol extends JsonProtocolClient { - public emptyOperation( - args: EmptyOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyOperation( - args: EmptyOperationCommandInput, - cb: (err: any, data?: EmptyOperationCommandOutput) => void - ): void; - public emptyOperation( - args: EmptyOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyOperationCommandOutput) => void - ): void; - public emptyOperation( - args: EmptyOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyOperationCommandOutput) => void), - cb?: (err: any, data?: EmptyOperationCommandOutput) => void - ): Promise | void { - const command = new EmptyOperationCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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 has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A ComplexError error. - * - * Implementations must be able to successfully take a response and - * properly deserialize successful and error responses. - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 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. - */ - public jsonEnums(args: JsonEnumsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonEnums(args: JsonEnumsCommandInput, cb: (err: any, data?: JsonEnumsCommandOutput) => void): void; - public jsonEnums( - args: JsonEnumsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonEnumsCommandOutput) => void - ): void; - public jsonEnums( - args: JsonEnumsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonEnumsCommandOutput) => void), - cb?: (err: any, data?: JsonEnumsCommandOutput) => void - ): Promise | void { - const command = new JsonEnumsCommand(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. - */ - public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; - public jsonUnions( - args: JsonUnionsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonUnionsCommandOutput) => void - ): void; - public jsonUnions( - args: JsonUnionsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), - cb?: (err: any, data?: JsonUnionsCommandOutput) => void - ): Promise | void { - const command = new JsonUnionsCommand(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 kitchenSinkOperation( - args: KitchenSinkOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public kitchenSinkOperation( - args: KitchenSinkOperationCommandInput, - cb: (err: any, data?: KitchenSinkOperationCommandOutput) => void - ): void; - public kitchenSinkOperation( - args: KitchenSinkOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: KitchenSinkOperationCommandOutput) => void - ): void; - public kitchenSinkOperation( - args: KitchenSinkOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: KitchenSinkOperationCommandOutput) => void), - cb?: (err: any, data?: KitchenSinkOperationCommandOutput) => void - ): Promise | void { - const command = new KitchenSinkOperationCommand(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 nullOperation( - args: NullOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nullOperation( - args: NullOperationCommandInput, - cb: (err: any, data?: NullOperationCommandOutput) => void - ): void; - public nullOperation( - args: NullOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NullOperationCommandOutput) => void - ): void; - public nullOperation( - args: NullOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullOperationCommandOutput) => void), - cb?: (err: any, data?: NullOperationCommandOutput) => void - ): Promise | void { - const command = new NullOperationCommand(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 operationWithOptionalInputOutput( - args: OperationWithOptionalInputOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public operationWithOptionalInputOutput( - args: OperationWithOptionalInputOutputCommandInput, - cb: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void - ): void; - public operationWithOptionalInputOutput( - args: OperationWithOptionalInputOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void - ): void; - public operationWithOptionalInputOutput( - args: OperationWithOptionalInputOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void), - cb?: (err: any, data?: OperationWithOptionalInputOutputCommandOutput) => void - ): Promise | void { - const command = new OperationWithOptionalInputOutputCommand(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 an inline document as part of the payload. - */ - public putAndGetInlineDocuments( - args: PutAndGetInlineDocumentsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public putAndGetInlineDocuments( - args: PutAndGetInlineDocumentsCommandInput, - cb: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void - ): void; - public putAndGetInlineDocuments( - args: PutAndGetInlineDocumentsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void - ): void; - public putAndGetInlineDocuments( - args: PutAndGetInlineDocumentsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void), - cb?: (err: any, data?: PutAndGetInlineDocumentsCommandOutput) => void - ): Promise | void { - const command = new PutAndGetInlineDocumentsCommand(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 simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarPropertiesCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts b/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts deleted file mode 100644 index 373b4829272a..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/JsonProtocolClient.ts +++ /dev/null @@ -1,287 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - AwsAuthInputConfig, - AwsAuthResolvedConfig, - getAwsAuthPlugin, - resolveAwsAuthConfig, -} from "@aws-sdk/middleware-signing"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Credentials as __Credentials, - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; - -import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "./commands/EmptyOperationCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - 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 { - KitchenSinkOperationCommandInput, - KitchenSinkOperationCommandOutput, -} from "./commands/KitchenSinkOperationCommand"; -import { NullOperationCommandInput, NullOperationCommandOutput } from "./commands/NullOperationCommand"; -import { - OperationWithOptionalInputOutputCommandInput, - OperationWithOptionalInputOutputCommandOutput, -} from "./commands/OperationWithOptionalInputOutputCommand"; -import { - PutAndGetInlineDocumentsCommandInput, - PutAndGetInlineDocumentsCommandOutput, -} from "./commands/PutAndGetInlineDocumentsCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | EmptyOperationCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | GreetingWithErrorsCommandInput - | HostWithPathOperationCommandInput - | JsonEnumsCommandInput - | JsonUnionsCommandInput - | KitchenSinkOperationCommandInput - | NullOperationCommandInput - | OperationWithOptionalInputOutputCommandInput - | PutAndGetInlineDocumentsCommandInput - | SimpleScalarPropertiesCommandInput; - -export type ServiceOutputTypes = - | EmptyOperationCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | GreetingWithErrorsCommandOutput - | HostWithPathOperationCommandOutput - | JsonEnumsCommandOutput - | JsonUnionsCommandOutput - | KitchenSinkOperationCommandOutput - | NullOperationCommandOutput - | OperationWithOptionalInputOutputCommandOutput - | PutAndGetInlineDocumentsCommandOutput - | SimpleScalarPropertiesCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * The AWS region to which this client will send requests - */ - region?: string | __Provider; - - /** - * Default credentials provider; Not available in browser runtime. - * @internal - */ - credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; -} - -type JsonProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - AwsAuthInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of JsonProtocolClient class constructor that set the region, credentials and other options. - */ -export interface JsonProtocolClientConfig extends JsonProtocolClientConfigType {} - -type JsonProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - AwsAuthResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of JsonProtocolClient class. This is resolved and normalized from the {@link JsonProtocolClientConfig | constructor configuration interface}. - */ -export interface JsonProtocolClientResolvedConfig extends JsonProtocolClientResolvedConfigType {} - -export class JsonProtocolClient extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - JsonProtocolClientResolvedConfig -> { - /** - * The resolved configuration of JsonProtocolClient class. This is resolved and normalized from the {@link JsonProtocolClientConfig | constructor configuration interface}. - */ - readonly config: JsonProtocolClientResolvedConfig; - - constructor(configuration: JsonProtocolClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveAwsAuthConfig(_config_4); - const _config_6 = resolveUserAgentConfig(_config_5); - super(_config_6); - this.config = _config_6; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getAwsAuthPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts deleted file mode 100644 index daeaed0d8ab2..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/EmptyOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_1EmptyOperationCommand, - serializeAws_json1_1EmptyOperationCommand, -} from "../protocols/Aws_json1_1"; - -export interface EmptyOperationCommandInput {} -export interface EmptyOperationCommandOutput extends __MetadataBearer {} - -export class EmptyOperationCommand extends $Command< - EmptyOperationCommandInput, - EmptyOperationCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyOperationCommandInput) { - // 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 = "EmptyOperationCommand"; - 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: EmptyOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1EmptyOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1EmptyOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index f142667f20d7..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_1EndpointOperationCommand, - serializeAws_json1_1EndpointOperationCommand, -} from "../protocols/Aws_json1_1"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // 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 = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1EndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1EndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index 9e9517480853..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_json1_1EndpointWithHostLabelOperationCommand, - serializeAws_json1_1EndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_json1_1"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // 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 = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_json1_1EndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_json1_1EndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index 91b5a143b839..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,102 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_json1_1GreetingWithErrorsCommand, - serializeAws_json1_1GreetingWithErrorsCommand, -} from "../protocols/Aws_json1_1"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A ComplexError error. - * - * Implementations must be able to successfully take a response and - * properly deserialize successful and error responses. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JsonProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import - * // const { JsonProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import - * const client = new JsonProtocolClient(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // 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 = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1GreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1GreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts deleted file mode 100644 index 6851697eb662..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/HostWithPathOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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-protocoltests-json/src/commands/JsonEnumsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts deleted file mode 100644 index 0401450a2707..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/JsonEnumsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { JsonEnumsInputOutput } from "../models/models_0"; -import { deserializeAws_json1_1JsonEnumsCommand, serializeAws_json1_1JsonEnumsCommand } from "../protocols/Aws_json1_1"; - -export interface JsonEnumsCommandInput extends JsonEnumsInputOutput {} -export interface JsonEnumsCommandOutput extends JsonEnumsInputOutput, __MetadataBearer {} - -/** - * This example serializes enums as top level properties, in lists, sets, and maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JsonProtocolClient, JsonEnumsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import - * // const { JsonProtocolClient, JsonEnumsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import - * const client = new JsonProtocolClient(config); - * const command = new JsonEnumsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonEnumsCommandInput} for command's `input` shape. - * @see {@link JsonEnumsCommandOutput} for command's `response` shape. - * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonEnumsCommand extends $Command< - JsonEnumsCommandInput, - JsonEnumsCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonEnumsCommandInput) { - // 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 = "JsonEnumsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1JsonEnumsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1JsonEnumsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts deleted file mode 100644 index d2d66a33a896..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/JsonUnionsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { UnionInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_1JsonUnionsCommand, - serializeAws_json1_1JsonUnionsCommand, -} from "../protocols/Aws_json1_1"; - -export interface JsonUnionsCommandInput extends UnionInputOutput {} -export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} - -/** - * This operation uses unions for inputs and outputs. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JsonProtocolClient, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import - * // const { JsonProtocolClient, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import - * const client = new JsonProtocolClient(config); - * const command = new JsonUnionsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonUnionsCommandInput} for command's `input` shape. - * @see {@link JsonUnionsCommandOutput} for command's `response` shape. - * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonUnionsCommand extends $Command< - JsonUnionsCommandInput, - JsonUnionsCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonUnionsCommandInput) { - // 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 = "JsonUnionsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1JsonUnionsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1JsonUnionsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts deleted file mode 100644 index 622fd79ce66d..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/KitchenSinkOperationCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { KitchenSink } from "../models/models_0"; -import { - deserializeAws_json1_1KitchenSinkOperationCommand, - serializeAws_json1_1KitchenSinkOperationCommand, -} from "../protocols/Aws_json1_1"; - -export interface KitchenSinkOperationCommandInput extends KitchenSink {} -export interface KitchenSinkOperationCommandOutput extends KitchenSink, __MetadataBearer {} - -export class KitchenSinkOperationCommand extends $Command< - KitchenSinkOperationCommandInput, - KitchenSinkOperationCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: KitchenSinkOperationCommandInput) { - // 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 = "KitchenSinkOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: KitchenSink.filterSensitiveLog, - outputFilterSensitiveLog: KitchenSink.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: KitchenSinkOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1KitchenSinkOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1KitchenSinkOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts deleted file mode 100644 index cc26c97ae886..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/NullOperationCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { NullOperationInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_1NullOperationCommand, - serializeAws_json1_1NullOperationCommand, -} from "../protocols/Aws_json1_1"; - -export interface NullOperationCommandInput extends NullOperationInputOutput {} -export interface NullOperationCommandOutput extends NullOperationInputOutput, __MetadataBearer {} - -export class NullOperationCommand extends $Command< - NullOperationCommandInput, - NullOperationCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NullOperationCommandInput) { - // 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 = "NullOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NullOperationInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: NullOperationInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NullOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1NullOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1NullOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts deleted file mode 100644 index 57caa84d3144..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/OperationWithOptionalInputOutputCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { SimpleStruct } from "../models/models_0"; -import { - deserializeAws_json1_1OperationWithOptionalInputOutputCommand, - serializeAws_json1_1OperationWithOptionalInputOutputCommand, -} from "../protocols/Aws_json1_1"; - -export interface OperationWithOptionalInputOutputCommandInput extends SimpleStruct {} -export interface OperationWithOptionalInputOutputCommandOutput extends SimpleStruct, __MetadataBearer {} - -export class OperationWithOptionalInputOutputCommand extends $Command< - OperationWithOptionalInputOutputCommandInput, - OperationWithOptionalInputOutputCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: OperationWithOptionalInputOutputCommandInput) { - // 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 = "OperationWithOptionalInputOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleStruct.filterSensitiveLog, - outputFilterSensitiveLog: SimpleStruct.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: OperationWithOptionalInputOutputCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_json1_1OperationWithOptionalInputOutputCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_json1_1OperationWithOptionalInputOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts deleted file mode 100644 index 6de2a9f3de3e..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/PutAndGetInlineDocumentsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { PutAndGetInlineDocumentsInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_1PutAndGetInlineDocumentsCommand, - serializeAws_json1_1PutAndGetInlineDocumentsCommand, -} from "../protocols/Aws_json1_1"; - -export interface PutAndGetInlineDocumentsCommandInput extends PutAndGetInlineDocumentsInputOutput {} -export interface PutAndGetInlineDocumentsCommandOutput extends PutAndGetInlineDocumentsInputOutput, __MetadataBearer {} - -/** - * This example serializes an inline document as part of the payload. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { JsonProtocolClient, PutAndGetInlineDocumentsCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import - * // const { JsonProtocolClient, PutAndGetInlineDocumentsCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import - * const client = new JsonProtocolClient(config); - * const command = new PutAndGetInlineDocumentsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link PutAndGetInlineDocumentsCommandInput} for command's `input` shape. - * @see {@link PutAndGetInlineDocumentsCommandOutput} for command's `response` shape. - * @see {@link JsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class PutAndGetInlineDocumentsCommand extends $Command< - PutAndGetInlineDocumentsCommandInput, - PutAndGetInlineDocumentsCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: PutAndGetInlineDocumentsCommandInput) { - // 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 = "PutAndGetInlineDocumentsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: PutAndGetInlineDocumentsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: PutAndGetInlineDocumentsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: PutAndGetInlineDocumentsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1PutAndGetInlineDocumentsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1PutAndGetInlineDocumentsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts deleted file mode 100644 index 2bec26bf9bde..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/SimpleScalarPropertiesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; -import { - deserializeAws_json1_1SimpleScalarPropertiesCommand, - serializeAws_json1_1SimpleScalarPropertiesCommand, -} from "../protocols/Aws_json1_1"; - -export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} -export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} - -export class SimpleScalarPropertiesCommand extends $Command< - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, - JsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarPropertiesCommandInput) { - // 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 = "SimpleScalarPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_json1_1SimpleScalarPropertiesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_json1_1SimpleScalarPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-json/src/commands/index.ts b/protocol_tests/aws-protocoltests-json/src/commands/index.ts deleted file mode 100644 index 3dc6a63b593f..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/commands/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from "./EmptyOperationCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HostWithPathOperationCommand"; -export * from "./JsonEnumsCommand"; -export * from "./JsonUnionsCommand"; -export * from "./KitchenSinkOperationCommand"; -export * from "./NullOperationCommand"; -export * from "./OperationWithOptionalInputOutputCommand"; -export * from "./PutAndGetInlineDocumentsCommand"; -export * from "./SimpleScalarPropertiesCommand"; diff --git a/protocol_tests/aws-protocoltests-json/src/endpoints.ts b/protocol_tests/aws-protocoltests-json/src/endpoints.ts deleted file mode 100644 index 5b52f205dd6a..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "jsonprotocol.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "jsonprotocol.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "jsonprotocol.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "jsonprotocol.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "jsonprotocol.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "foo", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-json/src/index.ts b/protocol_tests/aws-protocoltests-json/src/index.ts deleted file mode 100644 index e67863477563..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./JsonProtocol"; -export * from "./JsonProtocolClient"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-json/src/models/index.ts b/protocol_tests/aws-protocoltests-json/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-json/src/models/models_0.ts b/protocol_tests/aws-protocoltests-json/src/models/models_0.ts deleted file mode 100644 index 8c45fb97b3e7..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/models/models_0.ts +++ /dev/null @@ -1,504 +0,0 @@ -import { LazyJsonString as __LazyJsonString } from "@aws-sdk/smithy-client"; -import { - DocumentType as __DocumentType, - MetadataBearer as $MetadataBearer, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface EmptyStruct {} - -export namespace EmptyStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyStruct): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -export interface SimpleStruct { - Value?: string; -} - -export namespace SimpleStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleStruct): any => ({ - ...obj, - }); -} - -export interface StructWithLocationName { - Value?: string; -} - -export namespace StructWithLocationName { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructWithLocationName): any => ({ - ...obj, - }); -} - -export interface ErrorWithoutMembers extends __SmithyException, $MetadataBearer { - name: "ErrorWithoutMembers"; - $fault: "server"; -} - -export namespace ErrorWithoutMembers { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ErrorWithoutMembers): any => ({ - ...obj, - }); -} - -/** - * This error has test cases that test some of the dark corners of Amazon service - * framework history. It should only be implemented by clients. - */ -export interface FooError extends __SmithyException, $MetadataBearer { - name: "FooError"; - $fault: "server"; -} - -export namespace FooError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FooError): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface JsonEnumsInputOutput { - fooEnum1?: FooEnum | string; - fooEnum2?: FooEnum | string; - fooEnum3?: FooEnum | string; - fooEnumList?: (FooEnum | string)[]; - fooEnumSet?: (FooEnum | string)[]; - fooEnumMap?: { [key: string]: FooEnum | string }; -} - -export namespace JsonEnumsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonEnumsInputOutput): any => ({ - ...obj, - }); -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -/** - * A union with a representative set of types for members. - */ -export type MyUnion = - | MyUnion.BlobValueMember - | MyUnion.BooleanValueMember - | MyUnion.EnumValueMember - | MyUnion.ListValueMember - | MyUnion.MapValueMember - | MyUnion.NumberValueMember - | MyUnion.StringValueMember - | MyUnion.StructureValueMember - | MyUnion.TimestampValueMember - | MyUnion.$UnknownMember; - -export namespace MyUnion { - export interface StringValueMember { - stringValue: string; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface BooleanValueMember { - stringValue?: never; - booleanValue: boolean; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface NumberValueMember { - stringValue?: never; - booleanValue?: never; - numberValue: number; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface BlobValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue: Uint8Array; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface TimestampValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue: Date; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface EnumValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue: FooEnum | string; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface ListValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue: string[]; - mapValue?: never; - structureValue?: never; - $unknown?: never; - } - - export interface MapValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue: { [key: string]: string }; - structureValue?: never; - $unknown?: never; - } - - export interface StructureValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue: GreetingStruct; - $unknown?: never; - } - - export interface $UnknownMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - $unknown: [string, any]; - } - - export interface Visitor { - stringValue: (value: string) => T; - booleanValue: (value: boolean) => T; - numberValue: (value: number) => T; - blobValue: (value: Uint8Array) => T; - timestampValue: (value: Date) => T; - enumValue: (value: FooEnum | string) => T; - listValue: (value: string[]) => T; - mapValue: (value: { [key: string]: string }) => T; - structureValue: (value: GreetingStruct) => T; - _: (name: string, value: any) => T; - } - - export const visit = (value: MyUnion, visitor: Visitor): T => { - if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); - if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); - if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); - if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); - if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); - if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); - if (value.listValue !== undefined) return visitor.listValue(value.listValue); - if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); - if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); - return visitor._(value.$unknown[0], value.$unknown[1]); - }; - - /** - * @internal - */ - export const filterSensitiveLog = (obj: MyUnion): any => { - if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; - if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; - if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; - if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; - if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; - if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; - if (obj.listValue !== undefined) return { listValue: obj.listValue }; - if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; - if (obj.structureValue !== undefined) - return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; - if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; - }; -} - -/** - * A shared structure that contains a single union member. - */ -export interface UnionInputOutput { - /** - * A union with a representative set of types for members. - */ - contents?: MyUnion; -} - -export namespace UnionInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ - ...obj, - ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), - }); -} - -export interface NullOperationInputOutput { - string?: string; - sparseStringList?: string[]; - sparseStringMap?: { [key: string]: string }; -} - -export namespace NullOperationInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NullOperationInputOutput): any => ({ - ...obj, - }); -} - -export interface PutAndGetInlineDocumentsInputOutput { - inlineDocument?: __DocumentType; -} - -export namespace PutAndGetInlineDocumentsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: PutAndGetInlineDocumentsInputOutput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarPropertiesInputOutput { - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarPropertiesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ - ...obj, - }); -} - -export interface KitchenSink { - Blob?: Uint8Array; - Boolean?: boolean; - Double?: number; - EmptyStruct?: EmptyStruct; - Float?: number; - HttpdateTimestamp?: Date; - Integer?: number; - Iso8601Timestamp?: Date; - JsonValue?: __LazyJsonString | string; - ListOfLists?: string[][]; - ListOfMapsOfStrings?: { [key: string]: string }[]; - ListOfStrings?: string[]; - ListOfStructs?: SimpleStruct[]; - Long?: number; - MapOfListsOfStrings?: { [key: string]: string[] }; - MapOfMaps?: { [key: string]: { [key: string]: string } }; - MapOfStrings?: { [key: string]: string }; - MapOfStructs?: { [key: string]: SimpleStruct }; - RecursiveList?: KitchenSink[]; - RecursiveMap?: { [key: string]: KitchenSink }; - RecursiveStruct?: KitchenSink; - SimpleStruct?: SimpleStruct; - String?: string; - StructWithLocationName?: StructWithLocationName; - Timestamp?: Date; - UnixTimestamp?: Date; -} - -export namespace KitchenSink { - /** - * @internal - */ - export const filterSensitiveLog = (obj: KitchenSink): any => ({ - ...obj, - }); -} - -export interface ErrorWithMembers extends __SmithyException, $MetadataBearer { - name: "ErrorWithMembers"; - $fault: "client"; - Code?: string; - ComplexData?: KitchenSink; - IntegerField?: number; - ListField?: string[]; - MapField?: { [key: string]: string }; - Message?: string; - /** - * abc - */ - StringField?: string; -} - -export namespace ErrorWithMembers { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ErrorWithMembers): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts b/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts deleted file mode 100644 index a8571c0ef28b..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/protocols/Aws_json1_1.ts +++ /dev/null @@ -1,1867 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - dateToUtcString as __dateToUtcString, - expectBoolean as __expectBoolean, - expectInt32 as __expectInt32, - expectLong as __expectLong, - expectNonNull as __expectNonNull, - expectNumber as __expectNumber, - expectString as __expectString, - expectUnion as __expectUnion, - LazyJsonString as __LazyJsonString, - limitedParseDouble as __limitedParseDouble, - limitedParseFloat32 as __limitedParseFloat32, - parseEpochTimestamp as __parseEpochTimestamp, - parseRfc3339DateTime as __parseRfc3339DateTime, - parseRfc7231DateTime as __parseRfc7231DateTime, - serializeFloat as __serializeFloat, -} from "@aws-sdk/smithy-client"; -import { - DocumentType as __DocumentType, - Endpoint as __Endpoint, - HeaderBag as __HeaderBag, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "../commands/EmptyOperationCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - 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 { - KitchenSinkOperationCommandInput, - KitchenSinkOperationCommandOutput, -} from "../commands/KitchenSinkOperationCommand"; -import { NullOperationCommandInput, NullOperationCommandOutput } from "../commands/NullOperationCommand"; -import { - OperationWithOptionalInputOutputCommandInput, - OperationWithOptionalInputOutputCommandOutput, -} from "../commands/OperationWithOptionalInputOutputCommand"; -import { - PutAndGetInlineDocumentsCommandInput, - PutAndGetInlineDocumentsCommandOutput, -} from "../commands/PutAndGetInlineDocumentsCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "../commands/SimpleScalarPropertiesCommand"; -import { - ComplexError, - ComplexNestedErrorData, - EmptyStruct, - ErrorWithMembers, - ErrorWithoutMembers, - FooEnum, - FooError, - GreetingStruct, - GreetingWithErrorsOutput, - HostLabelInput, - InvalidGreeting, - JsonEnumsInputOutput, - KitchenSink, - MyUnion, - NullOperationInputOutput, - PutAndGetInlineDocumentsInputOutput, - SimpleScalarPropertiesInputOutput, - SimpleStruct, - StructWithLocationName, - UnionInputOutput, -} from "../models/models_0"; - -export const serializeAws_json1_1EmptyOperationCommand = async ( - input: EmptyOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.EmptyOperation", - }; - const body = "{}"; - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1EndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.EndpointOperation", - }; - const body = "{}"; - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_json1_1EndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.EndpointWithHostLabelOperation", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1HostLabelInput(input, context)); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_json1_1GreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.GreetingWithErrors", - }; - const body = "{}"; - 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 -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.JsonEnums", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1JsonEnumsInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1JsonUnionsCommand = async ( - input: JsonUnionsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.JsonUnions", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1UnionInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1KitchenSinkOperationCommand = async ( - input: KitchenSinkOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.KitchenSinkOperation", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1KitchenSink(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1NullOperationCommand = async ( - input: NullOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.NullOperation", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1NullOperationInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1OperationWithOptionalInputOutputCommand = async ( - input: OperationWithOptionalInputOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.OperationWithOptionalInputOutput", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1SimpleStruct(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1PutAndGetInlineDocumentsCommand = async ( - input: PutAndGetInlineDocumentsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.PutAndGetInlineDocuments", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1PutAndGetInlineDocumentsInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_json1_1SimpleScalarPropertiesCommand = async ( - input: SimpleScalarPropertiesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-amz-json-1.1", - "x-amz-target": "JsonProtocol.SimpleScalarProperties", - }; - let body: any; - body = JSON.stringify(serializeAws_json1_1SimpleScalarPropertiesInputOutput(input, context)); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const deserializeAws_json1_1EmptyOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1EmptyOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EmptyOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1EmptyOperationCommandError = 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_1EndpointOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1EndpointOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1EndpointOperationCommandError = 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_1EndpointWithHostLabelOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1EndpointWithHostLabelOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointWithHostLabelOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1EndpointWithHostLabelOperationCommandError = 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_1GreetingWithErrorsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1GreetingWithErrorsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1GreetingWithErrorsOutput(data, context); - const response: GreetingWithErrorsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1GreetingWithErrorsCommandError = 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.json#ComplexError": - response = { - ...(await deserializeAws_json1_1ComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "FooError": - case "aws.protocoltests.json#FooError": - response = { - ...(await deserializeAws_json1_1FooErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.json#InvalidGreeting": - response = { - ...(await deserializeAws_json1_1InvalidGreetingResponse(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_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 -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1JsonEnumsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1JsonEnumsInputOutput(data, context); - const response: JsonEnumsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1JsonEnumsCommandError = 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_1JsonUnionsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1JsonUnionsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1UnionInputOutput(data, context); - const response: JsonUnionsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1JsonUnionsCommandError = 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_1KitchenSinkOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1KitchenSinkOperationCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1KitchenSink(data, context); - const response: KitchenSinkOperationCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1KitchenSinkOperationCommandError = 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 "ErrorWithMembers": - case "aws.protocoltests.json#ErrorWithMembers": - response = { - ...(await deserializeAws_json1_1ErrorWithMembersResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "ErrorWithoutMembers": - case "aws.protocoltests.json#ErrorWithoutMembers": - response = { - ...(await deserializeAws_json1_1ErrorWithoutMembersResponse(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_json1_1NullOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1NullOperationCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1NullOperationInputOutput(data, context); - const response: NullOperationCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1NullOperationCommandError = 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_1OperationWithOptionalInputOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1OperationWithOptionalInputOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1SimpleStruct(data, context); - const response: OperationWithOptionalInputOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1OperationWithOptionalInputOutputCommandError = 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_1PutAndGetInlineDocumentsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1PutAndGetInlineDocumentsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1PutAndGetInlineDocumentsInputOutput(data, context); - const response: PutAndGetInlineDocumentsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1PutAndGetInlineDocumentsCommandError = 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_1SimpleScalarPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_json1_1SimpleScalarPropertiesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_json1_1SimpleScalarPropertiesInputOutput(data, context); - const response: SimpleScalarPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_json1_1SimpleScalarPropertiesCommandError = 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)); -}; - -const deserializeAws_json1_1ComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_1ComplexError(body, context); - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_1ErrorWithMembersResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_1ErrorWithMembers(body, context); - const contents: ErrorWithMembers = { - name: "ErrorWithMembers", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_1ErrorWithoutMembersResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_1ErrorWithoutMembers(body, context); - const contents: ErrorWithoutMembers = { - name: "ErrorWithoutMembers", - $fault: "server", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_1FooErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_1FooError(body, context); - const contents: FooError = { - name: "FooError", - $fault: "server", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_json1_1InvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_json1_1InvalidGreeting(body, context); - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const serializeAws_json1_1Document = (input: __DocumentType, context: __SerdeContext): any => { - return input; -}; - -const serializeAws_json1_1EmptyStruct = (input: EmptyStruct, context: __SerdeContext): any => { - return {}; -}; - -const serializeAws_json1_1HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { - return { - ...(input.label !== undefined && input.label !== null && { label: input.label }), - }; -}; - -const serializeAws_json1_1JsonEnumsInputOutput = (input: JsonEnumsInputOutput, context: __SerdeContext): any => { - return { - ...(input.fooEnum1 !== undefined && input.fooEnum1 !== null && { fooEnum1: input.fooEnum1 }), - ...(input.fooEnum2 !== undefined && input.fooEnum2 !== null && { fooEnum2: input.fooEnum2 }), - ...(input.fooEnum3 !== undefined && input.fooEnum3 !== null && { fooEnum3: input.fooEnum3 }), - ...(input.fooEnumList !== undefined && - input.fooEnumList !== null && { fooEnumList: serializeAws_json1_1FooEnumList(input.fooEnumList, context) }), - ...(input.fooEnumMap !== undefined && - input.fooEnumMap !== null && { fooEnumMap: serializeAws_json1_1FooEnumMap(input.fooEnumMap, context) }), - ...(input.fooEnumSet !== undefined && - input.fooEnumSet !== null && { fooEnumSet: serializeAws_json1_1FooEnumSet(input.fooEnumSet, context) }), - }; -}; - -const serializeAws_json1_1KitchenSink = (input: KitchenSink, context: __SerdeContext): any => { - return { - ...(input.Blob !== undefined && input.Blob !== null && { Blob: context.base64Encoder(input.Blob) }), - ...(input.Boolean !== undefined && input.Boolean !== null && { Boolean: input.Boolean }), - ...(input.Double !== undefined && input.Double !== null && { Double: __serializeFloat(input.Double) }), - ...(input.EmptyStruct !== undefined && - input.EmptyStruct !== null && { EmptyStruct: serializeAws_json1_1EmptyStruct(input.EmptyStruct, context) }), - ...(input.Float !== undefined && input.Float !== null && { Float: __serializeFloat(input.Float) }), - ...(input.HttpdateTimestamp !== undefined && - input.HttpdateTimestamp !== null && { HttpdateTimestamp: __dateToUtcString(input.HttpdateTimestamp) }), - ...(input.Integer !== undefined && input.Integer !== null && { Integer: input.Integer }), - ...(input.Iso8601Timestamp !== undefined && - input.Iso8601Timestamp !== null && { - Iso8601Timestamp: input.Iso8601Timestamp.toISOString().split(".")[0] + "Z", - }), - ...(input.JsonValue !== undefined && - input.JsonValue !== null && { JsonValue: __LazyJsonString.fromObject(input.JsonValue) }), - ...(input.ListOfLists !== undefined && - input.ListOfLists !== null && { - ListOfLists: serializeAws_json1_1ListOfListOfStrings(input.ListOfLists, context), - }), - ...(input.ListOfMapsOfStrings !== undefined && - input.ListOfMapsOfStrings !== null && { - ListOfMapsOfStrings: serializeAws_json1_1ListOfMapsOfStrings(input.ListOfMapsOfStrings, context), - }), - ...(input.ListOfStrings !== undefined && - input.ListOfStrings !== null && { - ListOfStrings: serializeAws_json1_1ListOfStrings(input.ListOfStrings, context), - }), - ...(input.ListOfStructs !== undefined && - input.ListOfStructs !== null && { - ListOfStructs: serializeAws_json1_1ListOfStructs(input.ListOfStructs, context), - }), - ...(input.Long !== undefined && input.Long !== null && { Long: input.Long }), - ...(input.MapOfListsOfStrings !== undefined && - input.MapOfListsOfStrings !== null && { - MapOfListsOfStrings: serializeAws_json1_1MapOfListsOfStrings(input.MapOfListsOfStrings, context), - }), - ...(input.MapOfMaps !== undefined && - input.MapOfMaps !== null && { MapOfMaps: serializeAws_json1_1MapOfMapOfStrings(input.MapOfMaps, context) }), - ...(input.MapOfStrings !== undefined && - input.MapOfStrings !== null && { MapOfStrings: serializeAws_json1_1MapOfStrings(input.MapOfStrings, context) }), - ...(input.MapOfStructs !== undefined && - input.MapOfStructs !== null && { MapOfStructs: serializeAws_json1_1MapOfStructs(input.MapOfStructs, context) }), - ...(input.RecursiveList !== undefined && - input.RecursiveList !== null && { - RecursiveList: serializeAws_json1_1ListOfKitchenSinks(input.RecursiveList, context), - }), - ...(input.RecursiveMap !== undefined && - input.RecursiveMap !== null && { - RecursiveMap: serializeAws_json1_1MapOfKitchenSinks(input.RecursiveMap, context), - }), - ...(input.RecursiveStruct !== undefined && - input.RecursiveStruct !== null && { - RecursiveStruct: serializeAws_json1_1KitchenSink(input.RecursiveStruct, context), - }), - ...(input.SimpleStruct !== undefined && - input.SimpleStruct !== null && { SimpleStruct: serializeAws_json1_1SimpleStruct(input.SimpleStruct, context) }), - ...(input.String !== undefined && input.String !== null && { String: input.String }), - ...(input.StructWithLocationName !== undefined && - input.StructWithLocationName !== null && { - StructWithLocationName: serializeAws_json1_1StructWithLocationName(input.StructWithLocationName, context), - }), - ...(input.Timestamp !== undefined && - input.Timestamp !== null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }), - ...(input.UnixTimestamp !== undefined && - input.UnixTimestamp !== null && { UnixTimestamp: Math.round(input.UnixTimestamp.getTime() / 1000) }), - }; -}; - -const serializeAws_json1_1ListOfKitchenSinks = (input: KitchenSink[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_json1_1KitchenSink(entry, context); - }); -}; - -const serializeAws_json1_1ListOfListOfStrings = (input: string[][], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_json1_1ListOfStrings(entry, context); - }); -}; - -const serializeAws_json1_1ListOfMapsOfStrings = (input: { [key: string]: string }[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_json1_1MapOfStrings(entry, context); - }); -}; - -const serializeAws_json1_1ListOfStrings = (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_json1_1ListOfStructs = (input: SimpleStruct[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_json1_1SimpleStruct(entry, context); - }); -}; - -const serializeAws_json1_1MapOfKitchenSinks = (input: { [key: string]: KitchenSink }, context: __SerdeContext): any => { - return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: serializeAws_json1_1KitchenSink(value, context), - }; - }, {}); -}; - -const serializeAws_json1_1MapOfListsOfStrings = (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]: serializeAws_json1_1ListOfStrings(value, context), - }; - }, {}); -}; - -const serializeAws_json1_1MapOfMapOfStrings = ( - input: { [key: string]: { [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]: serializeAws_json1_1MapOfStrings(value, context), - }; - }, {}); -}; - -const serializeAws_json1_1MapOfStrings = (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_json1_1MapOfStructs = (input: { [key: string]: SimpleStruct }, context: __SerdeContext): any => { - return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: serializeAws_json1_1SimpleStruct(value, context), - }; - }, {}); -}; - -const serializeAws_json1_1MyUnion = (input: MyUnion, context: __SerdeContext): any => { - return MyUnion.visit(input, { - blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), - booleanValue: (value) => ({ booleanValue: value }), - enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: serializeAws_json1_1StringList(value, context) }), - mapValue: (value) => ({ mapValue: serializeAws_json1_1StringMap(value, context) }), - numberValue: (value) => ({ numberValue: value }), - stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: serializeAws_json1_1GreetingStruct(value, context) }), - timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), - _: (name, value) => ({ name: value } as any), - }); -}; - -const serializeAws_json1_1NullOperationInputOutput = ( - input: NullOperationInputOutput, - context: __SerdeContext -): any => { - return { - ...(input.sparseStringList !== undefined && - input.sparseStringList !== null && { - sparseStringList: serializeAws_json1_1SparseStringList(input.sparseStringList, context), - }), - ...(input.sparseStringMap !== undefined && - input.sparseStringMap !== null && { - sparseStringMap: serializeAws_json1_1SparseStringMap(input.sparseStringMap, context), - }), - ...(input.string !== undefined && input.string !== null && { string: input.string }), - }; -}; - -const serializeAws_json1_1PutAndGetInlineDocumentsInputOutput = ( - input: PutAndGetInlineDocumentsInputOutput, - context: __SerdeContext -): any => { - return { - ...(input.inlineDocument !== undefined && - input.inlineDocument !== null && { inlineDocument: serializeAws_json1_1Document(input.inlineDocument, context) }), - }; -}; - -const serializeAws_json1_1SimpleScalarPropertiesInputOutput = ( - input: SimpleScalarPropertiesInputOutput, - context: __SerdeContext -): any => { - return { - ...(input.doubleValue !== undefined && - input.doubleValue !== null && { doubleValue: __serializeFloat(input.doubleValue) }), - ...(input.floatValue !== undefined && - input.floatValue !== null && { floatValue: __serializeFloat(input.floatValue) }), - }; -}; - -const serializeAws_json1_1SimpleStruct = (input: SimpleStruct, context: __SerdeContext): any => { - return { - ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }), - }; -}; - -const serializeAws_json1_1StructWithLocationName = (input: StructWithLocationName, context: __SerdeContext): any => { - return { - ...(input.Value !== undefined && input.Value !== null && { RenamedMember: input.Value }), - }; -}; - -const serializeAws_json1_1UnionInputOutput = (input: UnionInputOutput, context: __SerdeContext): any => { - return { - ...(input.contents !== undefined && - input.contents !== null && { contents: serializeAws_json1_1MyUnion(input.contents, context) }), - }; -}; - -const serializeAws_json1_1FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_json1_1FooEnumMap = (input: { [key: string]: FooEnum | 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_json1_1FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_json1_1GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), - }; -}; - -const serializeAws_json1_1SparseStringList = (input: string[], context: __SerdeContext): any => { - return input.map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_json1_1SparseStringMap = (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, [key]: null as any }; - } - return { - ...acc, - [key]: value, - }; - }, {}); -}; - -const serializeAws_json1_1StringList = (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_json1_1StringMap = (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 deserializeAws_json1_1ComplexError = (output: any, context: __SerdeContext): ComplexError => { - return { - Nested: - output.Nested !== undefined && output.Nested !== null - ? deserializeAws_json1_1ComplexNestedErrorData(output.Nested, context) - : undefined, - TopLevel: __expectString(output.TopLevel), - } as any; -}; - -const deserializeAws_json1_1ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Fooooo), - } as any; -}; - -const deserializeAws_json1_1Document = (output: any, context: __SerdeContext): __DocumentType => { - return output; -}; - -const deserializeAws_json1_1EmptyStruct = (output: any, context: __SerdeContext): EmptyStruct => { - return {} as any; -}; - -const deserializeAws_json1_1ErrorWithMembers = (output: any, context: __SerdeContext): ErrorWithMembers => { - return { - Code: __expectString(output.Code), - ComplexData: - output.ComplexData !== undefined && output.ComplexData !== null - ? deserializeAws_json1_1KitchenSink(output.ComplexData, context) - : undefined, - IntegerField: __expectInt32(output.IntegerField), - ListField: - output.ListField !== undefined && output.ListField !== null - ? deserializeAws_json1_1ListOfStrings(output.ListField, context) - : undefined, - MapField: - output.MapField !== undefined && output.MapField !== null - ? deserializeAws_json1_1MapOfStrings(output.MapField, context) - : undefined, - Message: __expectString(output.Message), - StringField: __expectString(output.StringField), - } as any; -}; - -const deserializeAws_json1_1ErrorWithoutMembers = (output: any, context: __SerdeContext): ErrorWithoutMembers => { - return {} as any; -}; - -const deserializeAws_json1_1FooError = (output: any, context: __SerdeContext): FooError => { - return {} as any; -}; - -const deserializeAws_json1_1GreetingWithErrorsOutput = ( - output: any, - context: __SerdeContext -): GreetingWithErrorsOutput => { - return { - greeting: __expectString(output.greeting), - } as any; -}; - -const deserializeAws_json1_1InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - return { - Message: __expectString(output.Message), - } as any; -}; - -const deserializeAws_json1_1JsonEnumsInputOutput = (output: any, context: __SerdeContext): JsonEnumsInputOutput => { - return { - fooEnum1: __expectString(output.fooEnum1), - fooEnum2: __expectString(output.fooEnum2), - fooEnum3: __expectString(output.fooEnum3), - fooEnumList: - output.fooEnumList !== undefined && output.fooEnumList !== null - ? deserializeAws_json1_1FooEnumList(output.fooEnumList, context) - : undefined, - fooEnumMap: - output.fooEnumMap !== undefined && output.fooEnumMap !== null - ? deserializeAws_json1_1FooEnumMap(output.fooEnumMap, context) - : undefined, - fooEnumSet: - output.fooEnumSet !== undefined && output.fooEnumSet !== null - ? deserializeAws_json1_1FooEnumSet(output.fooEnumSet, context) - : undefined, - } as any; -}; - -const deserializeAws_json1_1KitchenSink = (output: any, context: __SerdeContext): KitchenSink => { - return { - Blob: output.Blob !== undefined && output.Blob !== null ? context.base64Decoder(output.Blob) : undefined, - Boolean: __expectBoolean(output.Boolean), - Double: __limitedParseDouble(output.Double), - EmptyStruct: - output.EmptyStruct !== undefined && output.EmptyStruct !== null - ? deserializeAws_json1_1EmptyStruct(output.EmptyStruct, context) - : undefined, - Float: __limitedParseFloat32(output.Float), - HttpdateTimestamp: - output.HttpdateTimestamp !== undefined && output.HttpdateTimestamp !== null - ? __expectNonNull(__parseRfc7231DateTime(output.HttpdateTimestamp)) - : undefined, - Integer: __expectInt32(output.Integer), - Iso8601Timestamp: - output.Iso8601Timestamp !== undefined && output.Iso8601Timestamp !== null - ? __expectNonNull(__parseRfc3339DateTime(output.Iso8601Timestamp)) - : undefined, - JsonValue: - output.JsonValue !== undefined && output.JsonValue !== null ? new __LazyJsonString(output.JsonValue) : undefined, - ListOfLists: - output.ListOfLists !== undefined && output.ListOfLists !== null - ? deserializeAws_json1_1ListOfListOfStrings(output.ListOfLists, context) - : undefined, - ListOfMapsOfStrings: - output.ListOfMapsOfStrings !== undefined && output.ListOfMapsOfStrings !== null - ? deserializeAws_json1_1ListOfMapsOfStrings(output.ListOfMapsOfStrings, context) - : undefined, - ListOfStrings: - output.ListOfStrings !== undefined && output.ListOfStrings !== null - ? deserializeAws_json1_1ListOfStrings(output.ListOfStrings, context) - : undefined, - ListOfStructs: - output.ListOfStructs !== undefined && output.ListOfStructs !== null - ? deserializeAws_json1_1ListOfStructs(output.ListOfStructs, context) - : undefined, - Long: __expectLong(output.Long), - MapOfListsOfStrings: - output.MapOfListsOfStrings !== undefined && output.MapOfListsOfStrings !== null - ? deserializeAws_json1_1MapOfListsOfStrings(output.MapOfListsOfStrings, context) - : undefined, - MapOfMaps: - output.MapOfMaps !== undefined && output.MapOfMaps !== null - ? deserializeAws_json1_1MapOfMapOfStrings(output.MapOfMaps, context) - : undefined, - MapOfStrings: - output.MapOfStrings !== undefined && output.MapOfStrings !== null - ? deserializeAws_json1_1MapOfStrings(output.MapOfStrings, context) - : undefined, - MapOfStructs: - output.MapOfStructs !== undefined && output.MapOfStructs !== null - ? deserializeAws_json1_1MapOfStructs(output.MapOfStructs, context) - : undefined, - RecursiveList: - output.RecursiveList !== undefined && output.RecursiveList !== null - ? deserializeAws_json1_1ListOfKitchenSinks(output.RecursiveList, context) - : undefined, - RecursiveMap: - output.RecursiveMap !== undefined && output.RecursiveMap !== null - ? deserializeAws_json1_1MapOfKitchenSinks(output.RecursiveMap, context) - : undefined, - RecursiveStruct: - output.RecursiveStruct !== undefined && output.RecursiveStruct !== null - ? deserializeAws_json1_1KitchenSink(output.RecursiveStruct, context) - : undefined, - SimpleStruct: - output.SimpleStruct !== undefined && output.SimpleStruct !== null - ? deserializeAws_json1_1SimpleStruct(output.SimpleStruct, context) - : undefined, - String: __expectString(output.String), - StructWithLocationName: - output.StructWithLocationName !== undefined && output.StructWithLocationName !== null - ? deserializeAws_json1_1StructWithLocationName(output.StructWithLocationName, context) - : undefined, - Timestamp: - output.Timestamp !== undefined && output.Timestamp !== null - ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.Timestamp))) - : undefined, - UnixTimestamp: - output.UnixTimestamp !== undefined && output.UnixTimestamp !== null - ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.UnixTimestamp))) - : undefined, - } as any; -}; - -const deserializeAws_json1_1ListOfKitchenSinks = (output: any, context: __SerdeContext): KitchenSink[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_json1_1KitchenSink(entry, context); - }); -}; - -const deserializeAws_json1_1ListOfListOfStrings = (output: any, context: __SerdeContext): string[][] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_json1_1ListOfStrings(entry, context); - }); -}; - -const deserializeAws_json1_1ListOfMapsOfStrings = ( - output: any, - context: __SerdeContext -): { [key: string]: string }[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_json1_1MapOfStrings(entry, context); - }); -}; - -const deserializeAws_json1_1ListOfStrings = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_json1_1ListOfStructs = (output: any, context: __SerdeContext): SimpleStruct[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_json1_1SimpleStruct(entry, context); - }); -}; - -const deserializeAws_json1_1MapOfKitchenSinks = ( - output: any, - context: __SerdeContext -): { [key: string]: KitchenSink } => { - return Object.entries(output).reduce((acc: { [key: string]: KitchenSink }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_json1_1KitchenSink(value, context), - }; - }, {}); -}; - -const deserializeAws_json1_1MapOfListsOfStrings = ( - output: any, - context: __SerdeContext -): { [key: string]: string[] } => { - return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_json1_1ListOfStrings(value, context), - }; - }, {}); -}; - -const deserializeAws_json1_1MapOfMapOfStrings = ( - output: any, - context: __SerdeContext -): { [key: string]: { [key: string]: string } } => { - return Object.entries(output).reduce( - (acc: { [key: string]: { [key: string]: string } }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_json1_1MapOfStrings(value, context), - }; - }, - {} - ); -}; - -const deserializeAws_json1_1MapOfStrings = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_json1_1MapOfStructs = (output: any, context: __SerdeContext): { [key: string]: SimpleStruct } => { - return Object.entries(output).reduce((acc: { [key: string]: SimpleStruct }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_json1_1SimpleStruct(value, context), - }; - }, {}); -}; - -const deserializeAws_json1_1MyUnion = (output: any, context: __SerdeContext): MyUnion => { - if (output.blobValue !== undefined && output.blobValue !== null) { - return { - blobValue: context.base64Decoder(output.blobValue), - }; - } - if (__expectBoolean(output.booleanValue) !== undefined) { - return { booleanValue: __expectBoolean(output.booleanValue) as any }; - } - if (__expectString(output.enumValue) !== undefined) { - return { enumValue: __expectString(output.enumValue) as any }; - } - if (output.listValue !== undefined && output.listValue !== null) { - return { - listValue: deserializeAws_json1_1StringList(output.listValue, context), - }; - } - if (output.mapValue !== undefined && output.mapValue !== null) { - return { - mapValue: deserializeAws_json1_1StringMap(output.mapValue, context), - }; - } - if (__expectInt32(output.numberValue) !== undefined) { - return { numberValue: __expectInt32(output.numberValue) as any }; - } - if (__expectString(output.stringValue) !== undefined) { - return { stringValue: __expectString(output.stringValue) as any }; - } - if (output.structureValue !== undefined && output.structureValue !== null) { - return { - structureValue: deserializeAws_json1_1GreetingStruct(output.structureValue, context), - }; - } - if (output.timestampValue !== undefined && output.timestampValue !== null) { - return { - timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), - }; - } - return { $unknown: Object.entries(output)[0] }; -}; - -const deserializeAws_json1_1NullOperationInputOutput = ( - output: any, - context: __SerdeContext -): NullOperationInputOutput => { - return { - sparseStringList: - output.sparseStringList !== undefined && output.sparseStringList !== null - ? deserializeAws_json1_1SparseStringList(output.sparseStringList, context) - : undefined, - sparseStringMap: - output.sparseStringMap !== undefined && output.sparseStringMap !== null - ? deserializeAws_json1_1SparseStringMap(output.sparseStringMap, context) - : undefined, - string: __expectString(output.string), - } as any; -}; - -const deserializeAws_json1_1PutAndGetInlineDocumentsInputOutput = ( - output: any, - context: __SerdeContext -): PutAndGetInlineDocumentsInputOutput => { - return { - inlineDocument: - output.inlineDocument !== undefined && output.inlineDocument !== null - ? deserializeAws_json1_1Document(output.inlineDocument, context) - : undefined, - } as any; -}; - -const deserializeAws_json1_1SimpleScalarPropertiesInputOutput = ( - output: any, - context: __SerdeContext -): SimpleScalarPropertiesInputOutput => { - return { - doubleValue: __limitedParseDouble(output.doubleValue), - floatValue: __limitedParseFloat32(output.floatValue), - } as any; -}; - -const deserializeAws_json1_1SimpleStruct = (output: any, context: __SerdeContext): SimpleStruct => { - return { - Value: __expectString(output.Value), - } as any; -}; - -const deserializeAws_json1_1StructWithLocationName = (output: any, context: __SerdeContext): StructWithLocationName => { - return { - Value: __expectString(output.RenamedMember), - } as any; -}; - -const deserializeAws_json1_1UnionInputOutput = (output: any, context: __SerdeContext): UnionInputOutput => { - return { - contents: - output.contents !== undefined && output.contents !== null - ? deserializeAws_json1_1MyUnion(__expectUnion(output.contents), context) - : undefined, - } as any; -}; - -const deserializeAws_json1_1FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_json1_1FooEnumMap = ( - output: any, - context: __SerdeContext -): { [key: string]: FooEnum | string } => { - return Object.entries(output).reduce((acc: { [key: string]: FooEnum | string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_json1_1FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - const uniqueValues = new Set(); - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - const parsedEntry = __expectString(entry) as any; - if (uniqueValues.has(parsedEntry)) { - throw new TypeError('All elements of the set "aws.protocoltests.shared#FooEnumSet" must be unique.'); - } else { - uniqueValues.add(parsedEntry); - return parsedEntry; - } - }); -}; - -const deserializeAws_json1_1GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; -}; - -const deserializeAws_json1_1SparseStringList = (output: any, context: __SerdeContext): string[] => { - return (output || []).map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_json1_1SparseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_json1_1StringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_json1_1StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const buildHttpRpcRequest = async ( - context: __SerdeContext, - headers: __HeaderBag, - path: string, - resolvedHostname: string | undefined, - body: any -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents: any = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers, - }; - if (resolvedHostname !== undefined) { - contents.hostname = resolvedHostname; - } - if (body !== undefined) { - contents.body = body; - } - return new __HttpRequest(contents); -}; - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); - } - return {}; - }); - -/** - * Load an error code for the aws.rest-json-1.1 protocol. - */ -const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { - const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - - const sanitizeErrorCode = (rawValue: string): string => { - let cleanValue = rawValue; - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } - return cleanValue; - }; - - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== undefined) { - return sanitizeErrorCode(output.headers[headerKey]); - } - - if (data.code !== undefined) { - return sanitizeErrorCode(data.code); - } - - if (data["__type"] !== undefined) { - return sanitizeErrorCode(data["__type"]); - } - - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts deleted file mode 100644 index dfe2f7ddc1ab..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { invalidProvider } from "@aws-sdk/invalid-dependency"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { JsonProtocolClientConfig } from "./JsonProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - credentialDefaultProvider: - config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - region: config?.region ?? invalidProvider("Region is missing"), - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts deleted file mode 100644 index d7d9b706b6e7..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { JsonProtocolClientConfig } from "./JsonProtocolClient"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts deleted file mode 100644 index eb8ab174b23b..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { defaultRegionInfoProvider } from "./endpoints"; -import { JsonProtocolClientConfig } from "./JsonProtocolClient"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JsonProtocolClientConfig) => ({ - apiVersion: "2018-01-01", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "Json Protocol", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts deleted file mode 100644 index 579a5ba379b9..000000000000 --- a/protocol_tests/aws-protocoltests-json/src/runtimeConfig.ts +++ /dev/null @@ -1,46 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts"; -import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver"; -import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; -import { Hash } from "@aws-sdk/hash-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { JsonProtocolClientConfig } from "./JsonProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - credentialDefaultProvider: - config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts b/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts deleted file mode 100644 index c51dbdbd35c3..000000000000 --- a/protocol_tests/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts +++ /dev/null @@ -1,4565 +0,0 @@ -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"; - -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"; -import { NullOperationCommand } from "../../src/commands/NullOperationCommand"; -import { OperationWithOptionalInputOutputCommand } from "../../src/commands/OperationWithOptionalInputOutputCommand"; -import { PutAndGetInlineDocumentsCommand } from "../../src/commands/PutAndGetInlineDocumentsCommand"; -import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; -import { JsonProtocolClient } from "../../src/JsonProtocolClient"; -import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Sends requests to / - */ -it("sends_requests_to_slash:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyOperationCommand({}); - 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("/"); - } -}); - -/** - * Includes X-Amz-Target header and Content-Type - */ -it("includes_x_amz_target_and_content_type:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyOperationCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.EmptyOperation"); - } -}); - -/** - * Clients must always send an empty JSON object payload for - * operations with no input (that is, `{}`). While AWS service - * implementations support requests with no payload or requests - * that send `{}`, always sending `{}` from the client is - * preferred for forward compatibility in case input is ever - * added to an operation. - */ -it("json_1_1_client_sends_empty_payload_for_no_input_shape:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyOperationCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * When no output is defined, the service is expected to return - * an empty payload, however, client must ignore a JSON payload - * if one is returned. This ensures that if output is added later, - * then it will not break the client. - */ -it("handles_empty_output_shape:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new EmptyOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * This client-only test builds on handles_empty_output_shape, - * by including unexpected fields in the JSON. A client - * needs to ignore JSON output that is empty or that contains - * JSON object data. - */ -it("handles_unexpected_json_output:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "foo": true - }` - ), - }); - - const params: any = {}; - const command = new EmptyOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * When no output is defined, the service is expected to return - * an empty payload. Despite the lack of a payload, the service - * is expected to always send a Content-Type header. Clients must - * handle cases where a service returns a JSON object and where - * a service returns no JSON at all. - */ -it("json_1_1_service_responds_with_no_payload:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `` - ), - }); - - const params: any = {}; - const command = new EmptyOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("AwsJson11EndpointTrait:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("AwsJson11EndpointTraitWithHostLabel:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"label\": \"bar\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Parses simple JSON errors - */ -it("AwsJson11InvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "InvalidGreeting", - "Message": "Hi" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Parses a complex error with no message member - */ -it("AwsJson11ComplexError:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "ComplexError", - "TopLevel": "Top level", - "Nested": { - "Fooooo": "bar" - } - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -it("AwsJson11EmptyComplexError:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "ComplexError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. - */ -it("AwsJson11FooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' - * is to be interpreted as 'ValidationException'. - * - * For an example service see Amazon Polly. - */ -it("AwsJson11FooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. - */ -it("AwsJson11FooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": - "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. - * - * For example service see Amazon S3 Glacier. - */ -it("AwsJson11FooErrorUsingCode:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "code": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("AwsJson11FooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "code": "aws.protocoltests.restjson#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("AwsJson11FooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "code": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type. - */ -it("AwsJson11FooErrorWithDunderType:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("AwsJson11FooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "aws.protocoltests.restjson#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("AwsJson11FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "__type": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - 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 - */ -it("AwsJson11Enums:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonEnumsCommand({ - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"fooEnum1\": \"Foo\", - \"fooEnum2\": \"0\", - \"fooEnum3\": \"1\", - \"fooEnumList\": [ - \"Foo\", - \"0\" - ], - \"fooEnumSet\": [ - \"Foo\", - \"0\" - ], - \"fooEnumMap\": { - \"hi\": \"Foo\", - \"zero\": \"0\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("AwsJson11Enums:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "fooEnum1": "Foo", - "fooEnum2": "0", - "fooEnum3": "1", - "fooEnumList": [ - "Foo", - "0" - ], - "fooEnumSet": [ - "Foo", - "0" - ], - "fooEnumMap": { - "hi": "Foo", - "zero": "0" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonEnumsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a string union value - */ -it("AwsJson11SerializeStringUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - stringValue: "foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"stringValue\": \"foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a boolean union value - */ -it("AwsJson11SerializeBooleanUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - booleanValue: true, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"booleanValue\": true - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a number union value - */ -it("AwsJson11SerializeNumberUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - numberValue: 1, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"numberValue\": 1 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob union value - */ -it("AwsJson11SerializeBlobUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"blobValue\": \"Zm9v\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a timestamp union value - */ -it("AwsJson11SerializeTimestampUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - timestampValue: new Date(1398796238000), - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"timestampValue\": 1398796238 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an enum union value - */ -it("AwsJson11SerializeEnumUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - enumValue: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"enumValue\": \"Foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a list union value - */ -it("AwsJson11SerializeListUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - listValue: ["foo", "bar"], - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"listValue\": [\"foo\", \"bar\"] - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a map union value - */ -it("AwsJson11SerializeMapUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"mapValue\": { - \"foo\": \"bar\", - \"spam\": \"eggs\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure union value - */ -it("AwsJson11SerializeStructureUnionValue:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - structureValue: { - hi: "hello", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.JsonUnions"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"structureValue\": { - \"hi\": \"hello\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes a string union value - */ -it("AwsJson11DeserializeStringUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "stringValue": "foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - stringValue: "foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a boolean union value - */ -it("AwsJson11DeserializeBooleanUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "booleanValue": true - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - booleanValue: true, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a number union value - */ -it("AwsJson11DeserializeNumberUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "numberValue": 1 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - numberValue: 1, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a blob union value - */ -it("AwsJson11DeserializeBlobUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "blobValue": "Zm9v" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a timestamp union value - */ -it("AwsJson11DeserializeTimestampUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "timestampValue": 1398796238 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - timestampValue: new Date(1398796238000), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes an enum union value - */ -it("AwsJson11DeserializeEnumUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "enumValue": "Foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - enumValue: "Foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a list union value - */ -it("AwsJson11DeserializeListUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "listValue": ["foo", "bar"] - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - listValue: ["foo", "bar"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a map union value - */ -it("AwsJson11DeserializeMapUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "mapValue": { - "foo": "bar", - "spam": "eggs" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a structure union value - */ -it("AwsJson11DeserializeStructureUnionValue:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "contents": { - "structureValue": { - "hi": "hello" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - structureValue: { - hi: "hello", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes string shapes - */ -it("serializes_string_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - String: "abc xyz", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"String\":\"abc xyz\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes string shapes with jsonvalue trait - */ -it("serializes_string_shapes_with_jsonvalue_trait:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - JsonValue: - '{"string":"value","number":1234.5,"boolTrue":true,"boolFalse":false,"array":[1,2,3,4],"object":{"key":"value"},"null":null}', - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"JsonValue\":\"{\\"string\\":\\"value\\",\\"number\\":1234.5,\\"boolTrue\\":true,\\"boolFalse\\":false,\\"array\\":[1,2,3,4],\\"object\\":{\\"key\\":\\"value\\"},\\"null\\":null}\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes integer shapes - */ -it("serializes_integer_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Integer: 1234, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Integer\":1234}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes long shapes - */ -it("serializes_long_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Long: 999999999999, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Long\":999999999999}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes float shapes - */ -it("serializes_float_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Float: 1234.5, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Float\":1234.5}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes double shapes - */ -it("serializes_double_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Double: 1234.5, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Double\":1234.5}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes blob shapes - */ -it("serializes_blob_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Blob: Uint8Array.from("binary-value", (c) => c.charCodeAt(0)), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Blob\":\"YmluYXJ5LXZhbHVl\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes boolean shapes (true) - */ -it("serializes_boolean_shapes_true:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Boolean: true, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Boolean\":true}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes boolean shapes (false) - */ -it("serializes_boolean_shapes_false:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Boolean: false, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Boolean\":false}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamp shapes - */ -it("serializes_timestamp_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Timestamp: new Date(946845296000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Timestamp\":946845296}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamp shapes with iso8601 timestampFormat - */ -it("serializes_timestamp_shapes_with_iso8601_timestampformat:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - Iso8601Timestamp: new Date(946845296000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamp shapes with httpdate timestampFormat - */ -it("serializes_timestamp_shapes_with_httpdate_timestampformat:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - HttpdateTimestamp: new Date(946845296000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamp shapes with unixTimestamp timestampFormat - */ -it("serializes_timestamp_shapes_with_unixtimestamp_timestampformat:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - UnixTimestamp: new Date(946845296000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"UnixTimestamp\":946845296}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes list shapes - */ -it("serializes_list_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - ListOfStrings: ["abc", "mno", "xyz"], - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes empty list shapes - */ -it("serializes_empty_list_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - ListOfStrings: [], - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"ListOfStrings\":[]}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes list of map shapes - */ -it("serializes_list_of_map_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - ListOfMapsOfStrings: [ - { - foo: "bar", - } as any, - - { - abc: "xyz", - } as any, - - { - red: "blue", - } as any, - ], - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes list of structure shapes - */ -it("serializes_list_of_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - ListOfStructs: [ - { - Value: "abc", - } as any, - - { - Value: "mno", - } as any, - - { - Value: "xyz", - } as any, - ], - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes list of recursive structure shapes - */ -it("serializes_list_of_recursive_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - RecursiveList: [ - { - RecursiveList: [ - { - RecursiveList: [ - { - Integer: 123, - } as any, - ], - } as any, - ], - } as any, - ], - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes map shapes - */ -it("serializes_map_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - MapOfStrings: { - abc: "xyz", - - mno: "hjk", - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes empty map shapes - */ -it("serializes_empty_map_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - MapOfStrings: {} as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"MapOfStrings\":{}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes map of list shapes - */ -it("serializes_map_of_list_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - MapOfListsOfStrings: { - abc: ["abc", "xyz"], - - mno: ["xyz", "abc"], - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes map of structure shapes - */ -it("serializes_map_of_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - MapOfStructs: { - key1: { - Value: "value-1", - } as any, - - key2: { - Value: "value-2", - } as any, - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes map of recursive structure shapes - */ -it("serializes_map_of_recursive_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - RecursiveMap: { - key1: { - RecursiveMap: { - key2: { - RecursiveMap: { - key3: { - Boolean: false, - } as any, - } as any, - } as any, - } as any, - } as any, - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes structure shapes - */ -it("serializes_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - SimpleStruct: { - Value: "abc", - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"SimpleStruct\":{\"Value\":\"abc\"}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes structure members with locationName traits - */ -it("serializes_structure_members_with_locationname_traits:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - StructWithLocationName: { - Value: "some-value", - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"StructWithLocationName\":{\"RenamedMember\":\"some-value\"}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes empty structure shapes - */ -it("serializes_empty_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - SimpleStruct: {} as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"SimpleStruct\":{}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes structure which have no members - */ -it("serializes_structure_which_have_no_members:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - EmptyStruct: {} as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"EmptyStruct\":{}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes recursive structure shapes - */ -it("serializes_recursive_structure_shapes:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new KitchenSinkOperationCommand({ - String: "top-value", - - Boolean: false, - - RecursiveStruct: { - String: "nested-value", - - Boolean: true, - - RecursiveList: [ - { - String: "string-only", - } as any, - - { - RecursiveStruct: { - MapOfStrings: { - color: "red", - - size: "large", - } as any, - } as any, - } as any, - ], - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Parses operations with empty JSON bodies - */ -it("parses_operations_with_empty_json_bodies:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Parses string shapes - */ -it("parses_string_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"String":"string-value"}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - String: "string-value", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses integer shapes - */ -it("parses_integer_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Integer":1234}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Integer: 1234, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses long shapes - */ -it("parses_long_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Long":1234567890123456789}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Long: 1234567890123456789, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses float shapes - */ -it("parses_float_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Float":1234.5}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Float: 1234.5, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses double shapes - */ -it("parses_double_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Double":123456789.12345679}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Double: 1.2345678912345679e8, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses boolean shapes (true) - */ -it("parses_boolean_shapes_true:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Boolean":true}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Boolean: true, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses boolean (false) - */ -it("parses_boolean_false:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Boolean":false}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Boolean: false, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses blob shapes - */ -it("parses_blob_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Blob":"YmluYXJ5LXZhbHVl"}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Blob: Uint8Array.from("binary-value", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses timestamp shapes - */ -it("parses_timestamp_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Timestamp":946845296}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Timestamp: new Date(946845296000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses iso8601 timestamps - */ -it("parses_iso8601_timestamps:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"Iso8601Timestamp":"2000-01-02T20:34:56.000Z"}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - Iso8601Timestamp: new Date(946845296000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses httpdate timestamps - */ -it("parses_httpdate_timestamps:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"HttpdateTimestamp":"Sun, 02 Jan 2000 20:34:56.000 GMT"}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - HttpdateTimestamp: new Date(946845296000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses list shapes - */ -it("parses_list_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"ListOfStrings":["abc","mno","xyz"]}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - ListOfStrings: ["abc", "mno", "xyz"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses list of map shapes - */ -it("parses_list_of_map_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"ListOfMapsOfStrings":[{"size":"large"},{"color":"red"}]}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - ListOfMapsOfStrings: [ - { - size: "large", - }, - - { - color: "red", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses list of list shapes - */ -it("parses_list_of_list_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"ListOfLists":[["abc","mno","xyz"],["hjk","qrs","tuv"]]}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - ListOfLists: [ - ["abc", "mno", "xyz"], - - ["hjk", "qrs", "tuv"], - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses list of structure shapes - */ -it("parses_list_of_structure_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"ListOfStructs":[{"Value":"value-1"},{"Value":"value-2"}]}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - ListOfStructs: [ - { - Value: "value-1", - }, - - { - Value: "value-2", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses list of recursive structure shapes - */ -it("parses_list_of_recursive_structure_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"RecursiveList":[{"RecursiveList":[{"RecursiveList":[{"String":"value"}]}]}]}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - RecursiveList: [ - { - RecursiveList: [ - { - RecursiveList: [ - { - String: "value", - }, - ], - }, - ], - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses map shapes - */ -it("parses_map_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"MapOfStrings":{"size":"large","color":"red"}}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - MapOfStrings: { - size: "large", - - color: "red", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses map of list shapes - */ -it("parses_map_of_list_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"MapOfListsOfStrings":{"sizes":["large","small"],"colors":["red","green"]}}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - MapOfListsOfStrings: { - sizes: ["large", "small"], - - colors: ["red", "green"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses map of map shapes - */ -it("parses_map_of_map_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"MapOfMaps":{"sizes":{"large":"L","medium":"M"},"colors":{"red":"R","blue":"B"}}}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - MapOfMaps: { - sizes: { - large: "L", - - medium: "M", - }, - - colors: { - red: "R", - - blue: "B", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses map of structure shapes - */ -it("parses_map_of_structure_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"MapOfStructs":{"size":{"Value":"small"},"color":{"Value":"red"}}}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - MapOfStructs: { - size: { - Value: "small", - }, - - color: { - Value: "red", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses map of recursive structure shapes - */ -it("parses_map_of_recursive_structure_shapes:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{"RecursiveMap":{"key-1":{"RecursiveMap":{"key-2":{"RecursiveMap":{"key-3":{"String":"value"}}}}}}}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - RecursiveMap: { - "key-1": { - RecursiveMap: { - "key-2": { - RecursiveMap: { - "key-3": { - String: "value", - }, - }, - }, - }, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses the request id from the response - */ -it("parses_the_request_id_from_the_response:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-amzn-requestid": "amazon-uniq-request-id", - "content-type": "application/x-amz-json-1.1", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new KitchenSinkOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Null structure values are dropped - */ -it("AwsJson11StructuresDontSerializeNullValues:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NullOperationCommand({ - string: null, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes null values in maps - */ -it("AwsJson11MapsSerializeNullValues:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NullOperationCommand({ - sparseStringMap: { - foo: null, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseStringMap\": { - \"foo\": null - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes null values in lists - */ -it("AwsJson11ListsSerializeNull:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NullOperationCommand({ - sparseStringList: [null], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseStringList\": [ - null - ] - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Null structure values are dropped - */ -it("AwsJson11StructuresDontDeserializeNullValues:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "string": null - }` - ), - }); - - const params: any = {}; - const command = new NullOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Deserializes null values in maps - */ -it("AwsJson11MapsDeserializeNullValues:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "sparseStringMap": { - "foo": null - } - }` - ), - }); - - const params: any = {}; - const command = new NullOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseStringMap: { - foo: null, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes null values in lists - */ -it("AwsJson11ListsDeserializeNull:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "sparseStringList": [ - null - ] - }` - ), - }); - - const params: any = {}; - const command = new NullOperationCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseStringList: [null], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Can call operations with no input or output - */ -it("can_call_operation_with_no_input_or_output:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OperationWithOptionalInputOutputCommand({} as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.OperationWithOptionalInputOutput"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Can invoke operations with optional input - */ -it("can_call_operation_with_optional_input:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OperationWithOptionalInputOutputCommand({ - Value: "Hi", - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.OperationWithOptionalInputOutput"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"Value\":\"Hi\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes inline documents in a JSON request. - */ -it("PutAndGetInlineDocumentsInput:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new PutAndGetInlineDocumentsCommand({ - inlineDocument: { - foo: "bar", - }, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"inlineDocument\": {\"foo\": \"bar\"} - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes inline documents in a JSON response. - */ -it("PutAndGetInlineDocumentsInput:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "inlineDocument": {"foo": "bar"} - }` - ), - }); - - const params: any = {}; - const command = new PutAndGetInlineDocumentsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - inlineDocument: { - foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float values. - */ -it("AwsJson11SupportsNaNFloatInputs:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: NaN, - - doubleValue: NaN, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"NaN\", - \"doubleValue\": \"NaN\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsJson11SupportsInfinityFloatInputs:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: Infinity, - - doubleValue: Infinity, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"Infinity\", - \"doubleValue\": \"Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsJson11SupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: -Infinity, - - doubleValue: -Infinity, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-amz-json-1.1"); - expect(r.headers["x-amz-target"]).toBeDefined(); - expect(r.headers["x-amz-target"]).toBe("JsonProtocol.SimpleScalarProperties"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"-Infinity\", - \"doubleValue\": \"-Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("AwsJson11SupportsNaNFloatInputs:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "floatValue": "NaN", - "doubleValue": "NaN" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsJson11SupportsInfinityFloatInputs:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "floatValue": "Infinity", - "doubleValue": "Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsJson11SupportsNegativeInfinityFloatInputs:Response", async () => { - const client = new JsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/x-amz-json-1.1", - }, - `{ - "floatValue": "-Infinity", - "doubleValue": "-Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { - const expectedParts = JSON.parse(expectedBody); - const generatedParts = JSON.parse(generatedBody); - - 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-protocoltests-json/tsconfig.es.json b/protocol_tests/aws-protocoltests-json/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-json/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-json/tsconfig.json b/protocol_tests/aws-protocoltests-json/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-json/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-json/tsconfig.types.json b/protocol_tests/aws-protocoltests-json/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-json/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-query/.gitignore b/protocol_tests/aws-protocoltests-query/.gitignore deleted file mode 100644 index bff6121c007d..000000000000 --- a/protocol_tests/aws-protocoltests-query/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-query/CHANGELOG.md b/protocol_tests/aws-protocoltests-query/CHANGELOG.md deleted file mode 100644 index f62cdf43b36b..000000000000 --- a/protocol_tests/aws-protocoltests-query/CHANGELOG.md +++ /dev/null @@ -1,775 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** allow setting path prefix from custom endpoints ([#2722](https://github.com/aws/aws-sdk-js-v3/issues/2722)) ([990ba2f](https://github.com/aws/aws-sdk-js-v3/commit/990ba2fe1c03cf10c3cb345cee4d137af7095f3d)) -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - - -### Bug Fixes - -* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - -### Features - -* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) - - - - - -# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) - - -### Bug Fixes - -* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) - - - - - -# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) - - -### Features - -* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) -* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) - - - - - -# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) - - -### Features - -* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) - - - - - -# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) - - -### Bug Fixes - -* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) - - - - - -# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) - - -### Bug Fixes - -* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) - - - - - -# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) - - -### Bug Fixes - -* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) - - -### Features - -* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) - - - - - -## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) - - -### Features - -* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) - - - - - -# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) - - -### Bug Fixes - -* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) - - -### Features - -* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) - - - - - -# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) - - -### Bug Fixes - -* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) - - - - - -# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) - - -### Features - -* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) - - - - - -# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) - - -### Bug Fixes - -* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) - - - - - -# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) - - -### Bug Fixes - -* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) - - - - - -# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) - - -### Bug Fixes - -* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) - - - - - -# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) - - -### Bug Fixes - -* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) - - - - - -# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) - - -### Features - -* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) -* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) - - - - - -# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) - - -### Bug Fixes - -* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) -* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) - - -### Features - -* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) - - - - - -# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) - - -### Bug Fixes - -* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) - - - - - -# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) - - -### Bug Fixes - -* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) -* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) -* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) -* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) - - -### Features - -* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) - - - - - -# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) - - -### Features - -* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) - - - - - -# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) - - -### Bug Fixes - -* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) - - -### Features - -* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) - - - - - -# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) - - -### Features - -* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) - - - - - -# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) - - -### Bug Fixes - -* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) - - - - - -# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) - - -### Features - -* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) - - - - - -# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) - - -### Bug Fixes - -* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) - - - - - -# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) - - -### Features - -* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) - - - - - -# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.9...@aws-sdk/aws-query@1.0.0-gamma.10) (2020-10-07) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.8...@aws-sdk/aws-query@1.0.0-gamma.9) (2020-09-29) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.7...@aws-sdk/aws-query@1.0.0-gamma.8) (2020-09-15) - - -### Bug Fixes - -* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) -* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) - - - - - -# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.6...@aws-sdk/aws-query@1.0.0-gamma.7) (2020-09-01) - - -### Features - -* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) - - - - - -# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.5...@aws-sdk/aws-query@1.0.0-gamma.6) (2020-08-25) - - -### Features - -* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) -* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) -* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) - - - - - -# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.4...@aws-sdk/aws-query@1.0.0-gamma.5) (2020-08-04) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.3...@aws-sdk/aws-query@1.0.0-gamma.4) (2020-07-21) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-query@1.0.0-gamma.2...@aws-sdk/aws-query@1.0.0-gamma.3) (2020-07-13) - -**Note:** Version bump only for package @aws-sdk/aws-query - - - - - -# 1.0.0-gamma.2 (2020-07-08) - - -### Features - -* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) - - - -# 1.0.0-gamma.2 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.1 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.0 (2020-05-21) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-beta.0 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-query/LICENSE b/protocol_tests/aws-protocoltests-query/LICENSE deleted file mode 100644 index dd65ae06be7a..000000000000 --- a/protocol_tests/aws-protocoltests-query/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-query/README.md b/protocol_tests/aws-protocoltests-query/README.md deleted file mode 100644 index 37361db40487..000000000000 --- a/protocol_tests/aws-protocoltests-query/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# @aws-sdk/aws-protocoltests-query - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-query/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-query) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-query.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-query) - -## Description - -AWS SDK for JavaScript QueryProtocol Client for Node.js, Browser and React Native. - -A query service that sends query requests and XML responses. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-query -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-query` -- `yarn add @aws-sdk/aws-protocoltests-query` -- `pnpm add @aws-sdk/aws-protocoltests-query` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `QueryProtocolClient` and -the commands you need, for example `EmptyInputAndEmptyOutputCommand`: - -```js -// ES5 example -const { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); -``` - -```ts -// ES6+ example -import { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-query"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new QueryProtocolClient({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new EmptyInputAndEmptyOutputCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-query"; -const client = new AWS.QueryProtocol({ region: "REGION" }); - -// async/await. -try { - const data = await client.emptyInputAndEmptyOutput(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .emptyInputAndEmptyOutput(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.emptyInputAndEmptyOutput(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-query` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-query/jest.config.js b/protocol_tests/aws-protocoltests-query/jest.config.js deleted file mode 100644 index a8d1c2e49912..000000000000 --- a/protocol_tests/aws-protocoltests-query/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const base = require("../../jest.config.base.js"); - -module.exports = { - ...base, -}; diff --git a/protocol_tests/aws-protocoltests-query/package.json b/protocol_tests/aws-protocoltests-query/package.json deleted file mode 100644 index 1569ac1e83f0..000000000000 --- a/protocol_tests/aws-protocoltests-query/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-query", - "description": "@aws-sdk/aws-protocoltests-query client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-query", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-query" - } -} diff --git a/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts b/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts deleted file mode 100644 index e5b416d9e6aa..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/QueryProtocol.ts +++ /dev/null @@ -1,1022 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommand, - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - FlattenedXmlMapCommand, - FlattenedXmlMapCommandInput, - FlattenedXmlMapCommandOutput, -} from "./commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommand, - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommand, - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { - GreetingWithErrorsCommand, - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, -} from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommand, - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommand, - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "./commands/IgnoresWrappingXmlNameCommand"; -import { - NestedStructuresCommand, - NestedStructuresCommandInput, - NestedStructuresCommandOutput, -} from "./commands/NestedStructuresCommand"; -import { - NoInputAndNoOutputCommand, - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, -} from "./commands/NoInputAndNoOutputCommand"; -import { - NoInputAndOutputCommand, - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, -} from "./commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommand, - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommand, QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; -import { QueryMapsCommand, QueryMapsCommandInput, QueryMapsCommandOutput } from "./commands/QueryMapsCommand"; -import { - QueryTimestampsCommand, - QueryTimestampsCommandInput, - QueryTimestampsCommandOutput, -} from "./commands/QueryTimestampsCommand"; -import { - RecursiveXmlShapesCommand, - RecursiveXmlShapesCommandInput, - RecursiveXmlShapesCommandOutput, -} from "./commands/RecursiveXmlShapesCommand"; -import { - SimpleInputParamsCommand, - SimpleInputParamsCommandInput, - SimpleInputParamsCommandOutput, -} from "./commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommand, - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "./commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { - XmlEmptyBlobsCommand, - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, -} from "./commands/XmlEmptyBlobsCommand"; -import { - XmlEmptyListsCommand, - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, -} from "./commands/XmlEmptyListsCommand"; -import { - XmlEmptyMapsCommand, - XmlEmptyMapsCommandInput, - XmlEmptyMapsCommandOutput, -} from "./commands/XmlEmptyMapsCommand"; -import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { XmlMapsCommand, XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; -import { - XmlMapsXmlNameCommand, - XmlMapsXmlNameCommandInput, - XmlMapsXmlNameCommandOutput, -} from "./commands/XmlMapsXmlNameCommand"; -import { - XmlNamespacesCommand, - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, -} from "./commands/XmlNamespacesCommand"; -import { - XmlTimestampsCommand, - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, -} from "./commands/XmlTimestampsCommand"; -import { QueryProtocolClient } from "./QueryProtocolClient"; - -/** - * A query service that sends query requests and XML responses. - */ -export class QueryProtocol extends QueryProtocolClient { - /** - * The example tests how requests and responses are serialized when there's - * no request or response members. - * - * While this should be rare, code generators must support this. - */ - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), - cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): Promise | void { - const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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); - } - } - - /** - * Flattened maps - */ - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): void; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): void; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapCommand(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); - } - } - - /** - * Flattened maps with @xmlName - */ - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapWithXmlNameCommand(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); - } - } - - /** - * Flattened maps with @xmlNamespace and @xmlName - */ - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapWithXmlNamespaceCommand(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 has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 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. - * - * The wrapping element is always operation name + "Response", and - * inside of that wrapper is another wrapper named operation name + "Result". - */ - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): void; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): void; - public ignoresWrappingXmlName( - args: IgnoresWrappingXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void), - cb?: (err: any, data?: IgnoresWrappingXmlNameCommandOutput) => void - ): Promise | void { - const command = new IgnoresWrappingXmlNameCommand(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 test serializes nested and recursive structure members. - */ - public nestedStructures( - args: NestedStructuresCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nestedStructures( - args: NestedStructuresCommandInput, - cb: (err: any, data?: NestedStructuresCommandOutput) => void - ): void; - public nestedStructures( - args: NestedStructuresCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NestedStructuresCommandOutput) => void - ): void; - public nestedStructures( - args: NestedStructuresCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedStructuresCommandOutput) => void), - cb?: (err: any, data?: NestedStructuresCommandOutput) => void - ): Promise | void { - const command = new NestedStructuresCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * - * While this should be rare, code generators must support this. - */ - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's - * no request payload or response members. - * - * While this should be rare, code generators must support this. - */ - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndOutputCommand(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); - } - } - - /** - * Automatically adds idempotency tokens. - */ - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), - cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): Promise | void { - const command = new QueryIdempotencyTokenAutoFillCommand(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 test serializes simple and complex lists. - */ - public queryLists(args: QueryListsCommandInput, options?: __HttpHandlerOptions): Promise; - public queryLists(args: QueryListsCommandInput, cb: (err: any, data?: QueryListsCommandOutput) => void): void; - public queryLists( - args: QueryListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryListsCommandOutput) => void - ): void; - public queryLists( - args: QueryListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryListsCommandOutput) => void), - cb?: (err: any, data?: QueryListsCommandOutput) => void - ): Promise | void { - const command = new QueryListsCommand(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 test serializes simple and complex maps. - */ - public queryMaps(args: QueryMapsCommandInput, options?: __HttpHandlerOptions): Promise; - public queryMaps(args: QueryMapsCommandInput, cb: (err: any, data?: QueryMapsCommandOutput) => void): void; - public queryMaps( - args: QueryMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryMapsCommandOutput) => void - ): void; - public queryMaps( - args: QueryMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryMapsCommandOutput) => void), - cb?: (err: any, data?: QueryMapsCommandOutput) => void - ): Promise | void { - const command = new QueryMapsCommand(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 test serializes timestamps. - * - * 1. Timestamps are serialized as RFC 3339 date-time values by default. - * 2. A timestampFormat trait on a member changes the format. - * 3. A timestampFormat trait on the shape targeted by the member changes the format. - */ - public queryTimestamps( - args: QueryTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryTimestamps( - args: QueryTimestampsCommandInput, - cb: (err: any, data?: QueryTimestampsCommandOutput) => void - ): void; - public queryTimestamps( - args: QueryTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryTimestampsCommandOutput) => void - ): void; - public queryTimestamps( - args: QueryTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryTimestampsCommandOutput) => void), - cb?: (err: any, data?: QueryTimestampsCommandOutput) => void - ): Promise | void { - const command = new QueryTimestampsCommand(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); - } - } - - /** - * Recursive shapes - */ - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): void; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): void; - public recursiveXmlShapes( - args: RecursiveXmlShapesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveXmlShapesCommandOutput) => void), - cb?: (err: any, data?: RecursiveXmlShapesCommandOutput) => void - ): Promise | void { - const command = new RecursiveXmlShapesCommand(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 test serializes strings, numbers, and boolean values. - */ - public simpleInputParams( - args: SimpleInputParamsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - cb: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): void; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): void; - public simpleInputParams( - args: SimpleInputParamsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleInputParamsCommandOutput) => void), - cb?: (err: any, data?: SimpleInputParamsCommandOutput) => void - ): Promise | void { - const command = new SimpleInputParamsCommand(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 simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): void; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): void; - public simpleScalarXmlProperties( - args: SimpleScalarXmlPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarXmlPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarXmlPropertiesCommand(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); - } - } - - /** - * Blobs are base64 encoded - */ - public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlBlobsCommandOutput) => void - ): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlBlobsCommand(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 xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyBlobsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyListsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyMaps(args: XmlEmptyMapsCommandInput, cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void): void; - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void - ): void; - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyMapsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyMapsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyMapsCommand(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. - */ - public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; - public xmlEnums( - args: XmlEnumsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEnumsCommandOutput) => void - ): void; - public xmlEnums( - args: XmlEnumsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), - cb?: (err: any, data?: XmlEnumsCommandOutput) => void - ): Promise | void { - const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Lists of structures. - */ - public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; - public xmlLists( - args: XmlListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlListsCommandOutput) => void - ): void; - public xmlLists( - args: XmlListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), - cb?: (err: any, data?: XmlListsCommandOutput) => void - ): Promise | void { - const command = new XmlListsCommand(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 example tests basic map serialization. - */ - public xmlMaps(args: XmlMapsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlMaps(args: XmlMapsCommandInput, cb: (err: any, data?: XmlMapsCommandOutput) => void): void; - public xmlMaps( - args: XmlMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlMapsCommandOutput) => void - ): void; - public xmlMaps( - args: XmlMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsCommandOutput) => void), - cb?: (err: any, data?: XmlMapsCommandOutput) => void - ): Promise | void { - const command = new XmlMapsCommand(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 xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): void; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): void; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsXmlNameCommandOutput) => void), - cb?: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): Promise | void { - const command = new XmlMapsXmlNameCommand(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 xmlNamespaces( - args: XmlNamespacesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), - cb?: (err: any, data?: XmlNamespacesCommandOutput) => void - ): Promise | void { - const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - */ - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), - cb?: (err: any, data?: XmlTimestampsCommandOutput) => void - ): Promise | void { - const command = new XmlTimestampsCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts b/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts deleted file mode 100644 index 11b2e19a4359..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/QueryProtocolClient.ts +++ /dev/null @@ -1,325 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "./commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "./commands/IgnoresWrappingXmlNameCommand"; -import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "./commands/NestedStructuresCommand"; -import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommandInput, QueryListsCommandOutput } from "./commands/QueryListsCommand"; -import { QueryMapsCommandInput, QueryMapsCommandOutput } from "./commands/QueryMapsCommand"; -import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "./commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "./commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "./commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "./commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "./commands/XmlEmptyMapsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | EmptyInputAndEmptyOutputCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | FlattenedXmlMapCommandInput - | FlattenedXmlMapWithXmlNameCommandInput - | FlattenedXmlMapWithXmlNamespaceCommandInput - | GreetingWithErrorsCommandInput - | HostWithPathOperationCommandInput - | IgnoresWrappingXmlNameCommandInput - | NestedStructuresCommandInput - | NoInputAndNoOutputCommandInput - | NoInputAndOutputCommandInput - | QueryIdempotencyTokenAutoFillCommandInput - | QueryListsCommandInput - | QueryMapsCommandInput - | QueryTimestampsCommandInput - | RecursiveXmlShapesCommandInput - | SimpleInputParamsCommandInput - | SimpleScalarXmlPropertiesCommandInput - | XmlBlobsCommandInput - | XmlEmptyBlobsCommandInput - | XmlEmptyListsCommandInput - | XmlEmptyMapsCommandInput - | XmlEnumsCommandInput - | XmlListsCommandInput - | XmlMapsCommandInput - | XmlMapsXmlNameCommandInput - | XmlNamespacesCommandInput - | XmlTimestampsCommandInput; - -export type ServiceOutputTypes = - | EmptyInputAndEmptyOutputCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | FlattenedXmlMapCommandOutput - | FlattenedXmlMapWithXmlNameCommandOutput - | FlattenedXmlMapWithXmlNamespaceCommandOutput - | GreetingWithErrorsCommandOutput - | HostWithPathOperationCommandOutput - | IgnoresWrappingXmlNameCommandOutput - | NestedStructuresCommandOutput - | NoInputAndNoOutputCommandOutput - | NoInputAndOutputCommandOutput - | QueryIdempotencyTokenAutoFillCommandOutput - | QueryListsCommandOutput - | QueryMapsCommandOutput - | QueryTimestampsCommandOutput - | RecursiveXmlShapesCommandOutput - | SimpleInputParamsCommandOutput - | SimpleScalarXmlPropertiesCommandOutput - | XmlBlobsCommandOutput - | XmlEmptyBlobsCommandOutput - | XmlEmptyListsCommandOutput - | XmlEmptyMapsCommandOutput - | XmlEnumsCommandOutput - | XmlListsCommandOutput - | XmlMapsCommandOutput - | XmlMapsXmlNameCommandOutput - | XmlNamespacesCommandOutput - | XmlTimestampsCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; -} - -type QueryProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of QueryProtocolClient class constructor that set the region, credentials and other options. - */ -export interface QueryProtocolClientConfig extends QueryProtocolClientConfigType {} - -type QueryProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of QueryProtocolClient class. This is resolved and normalized from the {@link QueryProtocolClientConfig | constructor configuration interface}. - */ -export interface QueryProtocolClientResolvedConfig extends QueryProtocolClientResolvedConfigType {} - -/** - * A query service that sends query requests and XML responses. - */ -export class QueryProtocolClient extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - QueryProtocolClientResolvedConfig -> { - /** - * The resolved configuration of QueryProtocolClient class. This is resolved and normalized from the {@link QueryProtocolClientConfig | constructor configuration interface}. - */ - readonly config: QueryProtocolClientResolvedConfig; - - constructor(configuration: QueryProtocolClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveUserAgentConfig(_config_4); - super(_config_5); - this.config = _config_5; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts deleted file mode 100644 index 318ef58f52b1..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/EmptyInputAndEmptyOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; -import { - deserializeAws_queryEmptyInputAndEmptyOutputCommand, - serializeAws_queryEmptyInputAndEmptyOutputCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} -export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response members. - * - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new EmptyInputAndEmptyOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. - * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class EmptyInputAndEmptyOutputCommand extends $Command< - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { - // 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 = "EmptyInputAndEmptyOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryEmptyInputAndEmptyOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryEmptyInputAndEmptyOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index 4d9f54896c6c..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_queryEndpointOperationCommand, - serializeAws_queryEndpointOperationCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // 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 = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryEndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryEndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index 030394c78fdc..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_queryEndpointWithHostLabelOperationCommand, - serializeAws_queryEndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // 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 = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_queryEndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_queryEndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts deleted file mode 100644 index 8c92b8f8d673..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { FlattenedXmlMapOutput } from "../models/models_0"; -import { - deserializeAws_queryFlattenedXmlMapCommand, - serializeAws_queryFlattenedXmlMapCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface FlattenedXmlMapCommandInput {} -export interface FlattenedXmlMapCommandOutput extends FlattenedXmlMapOutput, __MetadataBearer {} - -/** - * Flattened maps - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, FlattenedXmlMapCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, FlattenedXmlMapCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new FlattenedXmlMapCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapCommand extends $Command< - FlattenedXmlMapCommandInput, - FlattenedXmlMapCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapCommandInput) { - // 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 = "FlattenedXmlMapCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: FlattenedXmlMapOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: FlattenedXmlMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryFlattenedXmlMapCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryFlattenedXmlMapCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts deleted file mode 100644 index 7abf3e130d74..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNameCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { FlattenedXmlMapWithXmlNameOutput } from "../models/models_0"; -import { - deserializeAws_queryFlattenedXmlMapWithXmlNameCommand, - serializeAws_queryFlattenedXmlMapWithXmlNameCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface FlattenedXmlMapWithXmlNameCommandInput {} -export interface FlattenedXmlMapWithXmlNameCommandOutput extends FlattenedXmlMapWithXmlNameOutput, __MetadataBearer {} - -/** - * Flattened maps with @xmlName - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, FlattenedXmlMapWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, FlattenedXmlMapWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new FlattenedXmlMapWithXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapWithXmlNameCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapWithXmlNameCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapWithXmlNameCommand extends $Command< - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapWithXmlNameCommandInput) { - // 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 = "FlattenedXmlMapWithXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: FlattenedXmlMapWithXmlNameOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: FlattenedXmlMapWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryFlattenedXmlMapWithXmlNameCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_queryFlattenedXmlMapWithXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts deleted file mode 100644 index 2d84a8bfd6e9..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { FlattenedXmlMapWithXmlNamespaceOutput } from "../models/models_0"; -import { - deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand, - serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface FlattenedXmlMapWithXmlNamespaceCommandInput {} -export interface FlattenedXmlMapWithXmlNamespaceCommandOutput - extends FlattenedXmlMapWithXmlNamespaceOutput, - __MetadataBearer {} - -/** - * Flattened maps with @xmlNamespace and @xmlName - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new FlattenedXmlMapWithXmlNamespaceCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapWithXmlNamespaceCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapWithXmlNamespaceCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapWithXmlNamespaceCommand extends $Command< - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapWithXmlNamespaceCommandInput) { - // 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 = "FlattenedXmlMapWithXmlNamespaceCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: FlattenedXmlMapWithXmlNamespaceOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: FlattenedXmlMapWithXmlNamespaceCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index de2403c59feb..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,99 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_queryGreetingWithErrorsCommand, - serializeAws_queryGreetingWithErrorsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // 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 = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryGreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryGreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts deleted file mode 100644 index b6ba334dc844..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/HostWithPathOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts deleted file mode 100644 index a40c05d358f4..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/IgnoresWrappingXmlNameCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { IgnoresWrappingXmlNameOutput } from "../models/models_0"; -import { - deserializeAws_queryIgnoresWrappingXmlNameCommand, - serializeAws_queryIgnoresWrappingXmlNameCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface IgnoresWrappingXmlNameCommandInput {} -export interface IgnoresWrappingXmlNameCommandOutput extends IgnoresWrappingXmlNameOutput, __MetadataBearer {} - -/** - * The xmlName trait on the output structure is ignored in AWS Query. - * - * The wrapping element is always operation name + "Response", and - * inside of that wrapper is another wrapper named operation name + "Result". - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, IgnoresWrappingXmlNameCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, IgnoresWrappingXmlNameCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new IgnoresWrappingXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link IgnoresWrappingXmlNameCommandInput} for command's `input` shape. - * @see {@link IgnoresWrappingXmlNameCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class IgnoresWrappingXmlNameCommand extends $Command< - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: IgnoresWrappingXmlNameCommandInput) { - // 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 = "IgnoresWrappingXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: IgnoresWrappingXmlNameOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: IgnoresWrappingXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryIgnoresWrappingXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryIgnoresWrappingXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts deleted file mode 100644 index ed48c8d719c5..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/NestedStructuresCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { NestedStructuresInput } from "../models/models_0"; -import { - deserializeAws_queryNestedStructuresCommand, - serializeAws_queryNestedStructuresCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface NestedStructuresCommandInput extends NestedStructuresInput {} -export interface NestedStructuresCommandOutput extends __MetadataBearer {} - -/** - * This test serializes nested and recursive structure members. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, NestedStructuresCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, NestedStructuresCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new NestedStructuresCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NestedStructuresCommandInput} for command's `input` shape. - * @see {@link NestedStructuresCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NestedStructuresCommand extends $Command< - NestedStructuresCommandInput, - NestedStructuresCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NestedStructuresCommandInput) { - // 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 = "NestedStructuresCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NestedStructuresInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NestedStructuresCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryNestedStructuresCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryNestedStructuresCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts deleted file mode 100644 index 884284d841d0..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndNoOutputCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -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_queryNoInputAndNoOutputCommand, - serializeAws_queryNoInputAndNoOutputCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface NoInputAndNoOutputCommandInput {} -export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new NoInputAndNoOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndNoOutputCommand extends $Command< - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndNoOutputCommandInput) { - // 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 = "NoInputAndNoOutputCommand"; - 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryNoInputAndNoOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryNoInputAndNoOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts deleted file mode 100644 index 3b00c2f101ac..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/NoInputAndOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NoInputAndOutputOutput } from "../models/models_0"; -import { - deserializeAws_queryNoInputAndOutputCommand, - serializeAws_queryNoInputAndOutputCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface NoInputAndOutputCommandInput extends NoInputAndOutputOutput {} -export interface NoInputAndOutputCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request payload or response members. - * - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new NoInputAndOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndOutputCommand extends $Command< - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndOutputCommandInput) { - // 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 = "NoInputAndOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryNoInputAndOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryNoInputAndOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts deleted file mode 100644 index 514ab9a87df4..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/QueryIdempotencyTokenAutoFillCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; -import { - deserializeAws_queryQueryIdempotencyTokenAutoFillCommand, - serializeAws_queryQueryIdempotencyTokenAutoFillCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} -export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} - -/** - * Automatically adds idempotency tokens. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new QueryIdempotencyTokenAutoFillCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. - * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryIdempotencyTokenAutoFillCommand extends $Command< - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { - // 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 = "QueryIdempotencyTokenAutoFillCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryQueryIdempotencyTokenAutoFillCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_queryQueryIdempotencyTokenAutoFillCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts deleted file mode 100644 index 241e04c0fc53..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/QueryListsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { QueryListsInput } from "../models/models_0"; -import { deserializeAws_queryQueryListsCommand, serializeAws_queryQueryListsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface QueryListsCommandInput extends QueryListsInput {} -export interface QueryListsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes simple and complex lists. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, QueryListsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, QueryListsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new QueryListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryListsCommandInput} for command's `input` shape. - * @see {@link QueryListsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryListsCommand extends $Command< - QueryListsCommandInput, - QueryListsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryListsCommandInput) { - // 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 = "QueryListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryListsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryQueryListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryQueryListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts deleted file mode 100644 index c4a9a70bc505..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/QueryMapsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { QueryMapsInput } from "../models/models_0"; -import { deserializeAws_queryQueryMapsCommand, serializeAws_queryQueryMapsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface QueryMapsCommandInput extends QueryMapsInput {} -export interface QueryMapsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes simple and complex maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, QueryMapsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, QueryMapsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new QueryMapsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryMapsCommandInput} for command's `input` shape. - * @see {@link QueryMapsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryMapsCommand extends $Command< - QueryMapsCommandInput, - QueryMapsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryMapsCommandInput) { - // 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 = "QueryMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryMapsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryQueryMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryQueryMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts deleted file mode 100644 index 21e5be71a42f..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/QueryTimestampsCommand.ts +++ /dev/null @@ -1,99 +0,0 @@ -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 { QueryTimestampsInput } from "../models/models_0"; -import { - deserializeAws_queryQueryTimestampsCommand, - serializeAws_queryQueryTimestampsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface QueryTimestampsCommandInput extends QueryTimestampsInput {} -export interface QueryTimestampsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes timestamps. - * - * 1. Timestamps are serialized as RFC 3339 date-time values by default. - * 2. A timestampFormat trait on a member changes the format. - * 3. A timestampFormat trait on the shape targeted by the member changes the format. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, QueryTimestampsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, QueryTimestampsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new QueryTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryTimestampsCommandInput} for command's `input` shape. - * @see {@link QueryTimestampsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryTimestampsCommand extends $Command< - QueryTimestampsCommandInput, - QueryTimestampsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryTimestampsCommandInput) { - // 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 = "QueryTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryTimestampsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryQueryTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryQueryTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts deleted file mode 100644 index f51e9a6f695a..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/RecursiveXmlShapesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { RecursiveXmlShapesOutput } from "../models/models_0"; -import { - deserializeAws_queryRecursiveXmlShapesCommand, - serializeAws_queryRecursiveXmlShapesCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface RecursiveXmlShapesCommandInput {} -export interface RecursiveXmlShapesCommandOutput extends RecursiveXmlShapesOutput, __MetadataBearer {} - -/** - * Recursive shapes - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, RecursiveXmlShapesCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, RecursiveXmlShapesCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new RecursiveXmlShapesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link RecursiveXmlShapesCommandInput} for command's `input` shape. - * @see {@link RecursiveXmlShapesCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class RecursiveXmlShapesCommand extends $Command< - RecursiveXmlShapesCommandInput, - RecursiveXmlShapesCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: RecursiveXmlShapesCommandInput) { - // 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 = "RecursiveXmlShapesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: RecursiveXmlShapesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: RecursiveXmlShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryRecursiveXmlShapesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryRecursiveXmlShapesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts deleted file mode 100644 index 4d2c4627b52b..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/SimpleInputParamsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { SimpleInputParamsInput } from "../models/models_0"; -import { - deserializeAws_querySimpleInputParamsCommand, - serializeAws_querySimpleInputParamsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface SimpleInputParamsCommandInput extends SimpleInputParamsInput {} -export interface SimpleInputParamsCommandOutput extends __MetadataBearer {} - -/** - * This test serializes strings, numbers, and boolean values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, SimpleInputParamsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, SimpleInputParamsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new SimpleInputParamsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link SimpleInputParamsCommandInput} for command's `input` shape. - * @see {@link SimpleInputParamsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class SimpleInputParamsCommand extends $Command< - SimpleInputParamsCommandInput, - SimpleInputParamsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleInputParamsCommandInput) { - // 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 = "SimpleInputParamsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleInputParamsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleInputParamsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_querySimpleInputParamsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_querySimpleInputParamsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts deleted file mode 100644 index 8d1966a21a97..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/SimpleScalarXmlPropertiesCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { SimpleScalarXmlPropertiesOutput } from "../models/models_0"; -import { - deserializeAws_querySimpleScalarXmlPropertiesCommand, - serializeAws_querySimpleScalarXmlPropertiesCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface SimpleScalarXmlPropertiesCommandInput {} -export interface SimpleScalarXmlPropertiesCommandOutput extends SimpleScalarXmlPropertiesOutput, __MetadataBearer {} - -export class SimpleScalarXmlPropertiesCommand extends $Command< - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarXmlPropertiesCommandInput) { - // 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 = "SimpleScalarXmlPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: SimpleScalarXmlPropertiesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarXmlPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_querySimpleScalarXmlPropertiesCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_querySimpleScalarXmlPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts deleted file mode 100644 index 14b27bf2f7c3..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlBlobsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlBlobsOutput } from "../models/models_0"; -import { deserializeAws_queryXmlBlobsCommand, serializeAws_queryXmlBlobsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlBlobsCommandInput {} -export interface XmlBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} - -/** - * Blobs are base64 encoded - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new XmlBlobsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlBlobsCommandInput} for command's `input` shape. - * @see {@link XmlBlobsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlBlobsCommand extends $Command< - XmlBlobsCommandInput, - XmlBlobsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlBlobsCommandInput) { - // 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 = "XmlBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts deleted file mode 100644 index eee1a33137e2..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyBlobsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlBlobsOutput } from "../models/models_0"; -import { - deserializeAws_queryXmlEmptyBlobsCommand, - serializeAws_queryXmlEmptyBlobsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlEmptyBlobsCommandInput {} -export interface XmlEmptyBlobsCommandOutput extends XmlBlobsOutput, __MetadataBearer {} - -export class XmlEmptyBlobsCommand extends $Command< - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyBlobsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - 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 = "XmlEmptyBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlBlobsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlEmptyBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlEmptyBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts deleted file mode 100644 index 2890e1985ffa..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyListsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlListsOutput } from "../models/models_0"; -import { - deserializeAws_queryXmlEmptyListsCommand, - serializeAws_queryXmlEmptyListsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlEmptyListsCommandInput {} -export interface XmlEmptyListsCommandOutput extends XmlListsOutput, __MetadataBearer {} - -export class XmlEmptyListsCommand extends $Command< - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyListsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - 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 = "XmlEmptyListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlEmptyListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlEmptyListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts deleted file mode 100644 index 3cd053ab9a7a..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlEmptyMapsCommand.ts +++ /dev/null @@ -1,75 +0,0 @@ -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 { XmlMapsOutput } from "../models/models_0"; -import { deserializeAws_queryXmlEmptyMapsCommand, serializeAws_queryXmlEmptyMapsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlEmptyMapsCommandInput {} -export interface XmlEmptyMapsCommandOutput extends XmlMapsOutput, __MetadataBearer {} - -export class XmlEmptyMapsCommand extends $Command< - XmlEmptyMapsCommandInput, - XmlEmptyMapsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyMapsCommandInput) { - // 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 = "XmlEmptyMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlMapsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlEmptyMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlEmptyMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts deleted file mode 100644 index ede4f701b44f..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlEnumsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlEnumsOutput } from "../models/models_0"; -import { deserializeAws_queryXmlEnumsCommand, serializeAws_queryXmlEnumsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlEnumsCommandInput {} -export interface XmlEnumsCommandOutput extends XmlEnumsOutput, __MetadataBearer {} - -/** - * This example serializes enums as top level properties, in lists, sets, and maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new XmlEnumsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlEnumsCommandInput} for command's `input` shape. - * @see {@link XmlEnumsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlEnumsCommand extends $Command< - XmlEnumsCommandInput, - XmlEnumsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEnumsCommandInput) { - // 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 = "XmlEnumsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlEnumsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlEnumsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlEnumsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts deleted file mode 100644 index 6f9dbebbb9fc..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlListsCommand.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 { XmlListsOutput } from "../models/models_0"; -import { deserializeAws_queryXmlListsCommand, serializeAws_queryXmlListsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlListsCommandInput {} -export interface XmlListsCommandOutput extends XmlListsOutput, __MetadataBearer {} - -/** - * This test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Lists of structures. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new XmlListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlListsCommandInput} for command's `input` shape. - * @see {@link XmlListsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlListsCommand extends $Command< - XmlListsCommandInput, - XmlListsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlListsCommandInput) { - // 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 = "XmlListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlListsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts deleted file mode 100644 index 85b53d29fdb6..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlMapsOutput } from "../models/models_0"; -import { deserializeAws_queryXmlMapsCommand, serializeAws_queryXmlMapsCommand } from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlMapsCommandInput {} -export interface XmlMapsCommandOutput extends XmlMapsOutput, __MetadataBearer {} - -/** - * The example tests basic map serialization. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, XmlMapsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, XmlMapsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new XmlMapsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlMapsCommandInput} for command's `input` shape. - * @see {@link XmlMapsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlMapsCommand extends $Command< - XmlMapsCommandInput, - XmlMapsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlMapsCommandInput) { - // 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 = "XmlMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlMapsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts deleted file mode 100644 index d3e38231e644..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlMapsXmlNameCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlMapsXmlNameOutput } from "../models/models_0"; -import { - deserializeAws_queryXmlMapsXmlNameCommand, - serializeAws_queryXmlMapsXmlNameCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlMapsXmlNameCommandInput {} -export interface XmlMapsXmlNameCommandOutput extends XmlMapsXmlNameOutput, __MetadataBearer {} - -export class XmlMapsXmlNameCommand extends $Command< - XmlMapsXmlNameCommandInput, - XmlMapsXmlNameCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlMapsXmlNameCommandInput) { - // 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 = "XmlMapsXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlMapsXmlNameOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlMapsXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlMapsXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlMapsXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts deleted file mode 100644 index 06f63165061d..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlNamespacesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlNamespacesOutput } from "../models/models_0"; -import { - deserializeAws_queryXmlNamespacesCommand, - serializeAws_queryXmlNamespacesCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlNamespacesCommandInput {} -export interface XmlNamespacesCommandOutput extends XmlNamespacesOutput, __MetadataBearer {} - -export class XmlNamespacesCommand extends $Command< - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlNamespacesCommandInput) { - // 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 = "XmlNamespacesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlNamespacesOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlNamespacesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlNamespacesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts deleted file mode 100644 index f293cfddf10e..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/XmlTimestampsCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -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 { XmlTimestampsOutput } from "../models/models_0"; -import { - deserializeAws_queryXmlTimestampsCommand, - serializeAws_queryXmlTimestampsCommand, -} from "../protocols/Aws_query"; -import { QueryProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QueryProtocolClient"; - -export interface XmlTimestampsCommandInput {} -export interface XmlTimestampsCommandOutput extends XmlTimestampsOutput, __MetadataBearer {} - -/** - * This tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { QueryProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-query"; // ES Modules import - * // const { QueryProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-query"); // CommonJS import - * const client = new QueryProtocolClient(config); - * const command = new XmlTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlTimestampsCommandInput} for command's `input` shape. - * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. - * @see {@link QueryProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlTimestampsCommand extends $Command< - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, - QueryProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlTimestampsCommandInput) { - // 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 = "XmlTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: XmlTimestampsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_queryXmlTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_queryXmlTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-query/src/commands/index.ts b/protocol_tests/aws-protocoltests-query/src/commands/index.ts deleted file mode 100644 index 921e253cbe25..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/commands/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -export * from "./EmptyInputAndEmptyOutputCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./FlattenedXmlMapCommand"; -export * from "./FlattenedXmlMapWithXmlNameCommand"; -export * from "./FlattenedXmlMapWithXmlNamespaceCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HostWithPathOperationCommand"; -export * from "./IgnoresWrappingXmlNameCommand"; -export * from "./NestedStructuresCommand"; -export * from "./NoInputAndNoOutputCommand"; -export * from "./NoInputAndOutputCommand"; -export * from "./QueryIdempotencyTokenAutoFillCommand"; -export * from "./QueryListsCommand"; -export * from "./QueryMapsCommand"; -export * from "./QueryTimestampsCommand"; -export * from "./RecursiveXmlShapesCommand"; -export * from "./SimpleInputParamsCommand"; -export * from "./SimpleScalarXmlPropertiesCommand"; -export * from "./XmlBlobsCommand"; -export * from "./XmlEmptyBlobsCommand"; -export * from "./XmlEmptyListsCommand"; -export * from "./XmlEmptyMapsCommand"; -export * from "./XmlEnumsCommand"; -export * from "./XmlListsCommand"; -export * from "./XmlMapsCommand"; -export * from "./XmlMapsXmlNameCommand"; -export * from "./XmlNamespacesCommand"; -export * from "./XmlTimestampsCommand"; diff --git a/protocol_tests/aws-protocoltests-query/src/endpoints.ts b/protocol_tests/aws-protocoltests-query/src/endpoints.ts deleted file mode 100644 index fff1593194be..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "awsquery.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "awsquery.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "awsquery.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "awsquery.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "awsquery.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "awsquery", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-query/src/index.ts b/protocol_tests/aws-protocoltests-query/src/index.ts deleted file mode 100644 index ec389347c03b..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./QueryProtocol"; -export * from "./QueryProtocolClient"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-query/src/models/index.ts b/protocol_tests/aws-protocoltests-query/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-query/src/models/models_0.ts b/protocol_tests/aws-protocoltests-query/src/models/models_0.ts deleted file mode 100644 index 516dade9b080..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/models/models_0.ts +++ /dev/null @@ -1,544 +0,0 @@ -import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; - -export interface EmptyInputAndEmptyOutputInput {} - -export namespace EmptyInputAndEmptyOutputInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputOutput {} - -export namespace EmptyInputAndEmptyOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface FlattenedXmlMapOutput { - myMap?: { [key: string]: FooEnum | string }; -} - -export namespace FlattenedXmlMapOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapOutput): any => ({ - ...obj, - }); -} - -export interface FlattenedXmlMapWithXmlNameOutput { - myMap?: { [key: string]: string }; -} - -export namespace FlattenedXmlMapWithXmlNameOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNameOutput): any => ({ - ...obj, - }); -} - -export interface FlattenedXmlMapWithXmlNamespaceOutput { - myMap?: { [key: string]: string }; -} - -export namespace FlattenedXmlMapWithXmlNamespaceOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNamespaceOutput): any => ({ - ...obj, - }); -} - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface CustomCodeError extends __SmithyException, $MetadataBearer { - name: "CustomCodeError"; - $fault: "client"; - Message?: string; -} - -export namespace CustomCodeError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: CustomCodeError): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export interface IgnoresWrappingXmlNameOutput { - foo?: string; -} - -export namespace IgnoresWrappingXmlNameOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: IgnoresWrappingXmlNameOutput): any => ({ - ...obj, - }); -} - -export interface NoInputAndOutputOutput {} - -export namespace NoInputAndOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ - ...obj, - }); -} - -export interface QueryIdempotencyTokenAutoFillInput { - token?: string; -} - -export namespace QueryIdempotencyTokenAutoFillInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ - ...obj, - }); -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -export interface NestedStructWithList { - ListArg?: string[]; -} - -export namespace NestedStructWithList { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedStructWithList): any => ({ - ...obj, - }); -} - -export interface QueryListsInput { - ListArg?: string[]; - ComplexListArg?: GreetingStruct[]; - FlattenedListArg?: string[]; - ListArgWithXmlNameMember?: string[]; - FlattenedListArgWithXmlName?: string[]; - NestedWithList?: NestedStructWithList; -} - -export namespace QueryListsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryListsInput): any => ({ - ...obj, - }); -} - -export interface NestedStructWithMap { - MapArg?: { [key: string]: string }; -} - -export namespace NestedStructWithMap { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedStructWithMap): any => ({ - ...obj, - }); -} - -export interface QueryMapsInput { - MapArg?: { [key: string]: string }; - RenamedMapArg?: { [key: string]: string }; - ComplexMapArg?: { [key: string]: GreetingStruct }; - MapWithXmlMemberName?: { [key: string]: string }; - FlattenedMap?: { [key: string]: string }; - FlattenedMapWithXmlName?: { [key: string]: string }; - MapOfLists?: { [key: string]: string[] }; - NestedStructWithMap?: NestedStructWithMap; -} - -export namespace QueryMapsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryMapsInput): any => ({ - ...obj, - }); -} - -export interface QueryTimestampsInput { - normalFormat?: Date; - epochMember?: Date; - epochTarget?: Date; -} - -export namespace QueryTimestampsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryTimestampsInput): any => ({ - ...obj, - }); -} - -export interface SimpleInputParamsInput { - Foo?: string; - Bar?: string; - Baz?: boolean; - Bam?: number; - FloatValue?: number; - Boo?: number; - Qux?: Uint8Array; - FooEnum?: FooEnum | string; -} - -export namespace SimpleInputParamsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleInputParamsInput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarXmlPropertiesOutput { - stringValue?: string; - emptyStringValue?: string; - trueBooleanValue?: boolean; - falseBooleanValue?: boolean; - byteValue?: number; - shortValue?: number; - integerValue?: number; - longValue?: number; - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarXmlPropertiesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarXmlPropertiesOutput): any => ({ - ...obj, - }); -} - -export interface XmlBlobsOutput { - data?: Uint8Array; -} - -export namespace XmlBlobsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlBlobsOutput): any => ({ - ...obj, - }); -} - -export interface StructureListMember { - a?: string; - b?: string; -} - -export namespace StructureListMember { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructureListMember): any => ({ - ...obj, - }); -} - -export interface XmlListsOutput { - stringList?: string[]; - stringSet?: string[]; - integerList?: number[]; - booleanList?: boolean[]; - timestampList?: Date[]; - enumList?: (FooEnum | string)[]; - /** - * A list of lists of strings. - */ - nestedStringList?: string[][]; - - renamedListMembers?: string[]; - flattenedList?: string[]; - flattenedList2?: string[]; - flattenedListWithMemberNamespace?: string[]; - flattenedListWithNamespace?: string[]; - structureList?: StructureListMember[]; -} - -export namespace XmlListsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlListsOutput): any => ({ - ...obj, - }); -} - -export interface XmlMapsOutput { - myMap?: { [key: string]: GreetingStruct }; -} - -export namespace XmlMapsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlMapsOutput): any => ({ - ...obj, - }); -} - -export interface XmlEnumsOutput { - fooEnum1?: FooEnum | string; - fooEnum2?: FooEnum | string; - fooEnum3?: FooEnum | string; - fooEnumList?: (FooEnum | string)[]; - fooEnumSet?: (FooEnum | string)[]; - fooEnumMap?: { [key: string]: FooEnum | string }; -} - -export namespace XmlEnumsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlEnumsOutput): any => ({ - ...obj, - }); -} - -export interface XmlMapsXmlNameOutput { - myMap?: { [key: string]: GreetingStruct }; -} - -export namespace XmlMapsXmlNameOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlMapsXmlNameOutput): any => ({ - ...obj, - }); -} - -export interface XmlNamespaceNested { - foo?: string; - values?: string[]; -} - -export namespace XmlNamespaceNested { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ - ...obj, - }); -} - -export interface XmlNamespacesOutput { - nested?: XmlNamespaceNested; -} - -export namespace XmlNamespacesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespacesOutput): any => ({ - ...obj, - }); -} - -export interface XmlTimestampsOutput { - normal?: Date; - dateTime?: Date; - epochSeconds?: Date; - httpDate?: Date; -} - -export namespace XmlTimestampsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlTimestampsOutput): any => ({ - ...obj, - }); -} - -export interface StructArg { - StringArg?: string; - OtherArg?: boolean; - RecursiveArg?: StructArg; -} - -export namespace StructArg { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructArg): any => ({ - ...obj, - }); -} - -export interface NestedStructuresInput { - Nested?: StructArg; -} - -export namespace NestedStructuresInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedStructuresInput): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutputNested1 { - foo?: string; - nested?: RecursiveXmlShapesOutputNested2; -} - -export namespace RecursiveXmlShapesOutputNested1 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested1): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutputNested2 { - bar?: string; - recursiveMember?: RecursiveXmlShapesOutputNested1; -} - -export namespace RecursiveXmlShapesOutputNested2 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutputNested2): any => ({ - ...obj, - }); -} - -export interface RecursiveXmlShapesOutput { - nested?: RecursiveXmlShapesOutputNested1; -} - -export namespace RecursiveXmlShapesOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveXmlShapesOutput): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts b/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts deleted file mode 100644 index 55162a910471..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/protocols/Aws_query.ts +++ /dev/null @@ -1,3103 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - expectNonNull as __expectNonNull, - expectString as __expectString, - extendedEncodeURIComponent as __extendedEncodeURIComponent, - getArrayIfSingleItem as __getArrayIfSingleItem, - getValueFromTextNode as __getValueFromTextNode, - parseBoolean as __parseBoolean, - parseEpochTimestamp as __parseEpochTimestamp, - parseRfc3339DateTime as __parseRfc3339DateTime, - parseRfc7231DateTime as __parseRfc7231DateTime, - serializeFloat as __serializeFloat, - strictParseByte as __strictParseByte, - strictParseFloat as __strictParseFloat, - strictParseInt32 as __strictParseInt32, - strictParseLong as __strictParseLong, - strictParseShort as __strictParseShort, -} from "@aws-sdk/smithy-client"; -import { - Endpoint as __Endpoint, - HeaderBag as __HeaderBag, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "../commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "../commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "../commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "../commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "../commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "../commands/HostWithPathOperationCommand"; -import { - IgnoresWrappingXmlNameCommandInput, - IgnoresWrappingXmlNameCommandOutput, -} from "../commands/IgnoresWrappingXmlNameCommand"; -import { NestedStructuresCommandInput, NestedStructuresCommandOutput } from "../commands/NestedStructuresCommand"; -import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "../commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommandInput, QueryListsCommandOutput } from "../commands/QueryListsCommand"; -import { QueryMapsCommandInput, QueryMapsCommandOutput } from "../commands/QueryMapsCommand"; -import { QueryTimestampsCommandInput, QueryTimestampsCommandOutput } from "../commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommandInput, RecursiveXmlShapesCommandOutput } from "../commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommandInput, SimpleInputParamsCommandOutput } from "../commands/SimpleInputParamsCommand"; -import { - SimpleScalarXmlPropertiesCommandInput, - SimpleScalarXmlPropertiesCommandOutput, -} from "../commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "../commands/XmlEmptyMapsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; -import { XmlMapsCommandInput, XmlMapsCommandOutput } from "../commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "../commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; -import { - ComplexError, - ComplexNestedErrorData, - CustomCodeError, - EmptyInputAndEmptyOutputInput, - EmptyInputAndEmptyOutputOutput, - FlattenedXmlMapOutput, - FlattenedXmlMapWithXmlNameOutput, - FlattenedXmlMapWithXmlNamespaceOutput, - FooEnum, - GreetingStruct, - GreetingWithErrorsOutput, - HostLabelInput, - IgnoresWrappingXmlNameOutput, - InvalidGreeting, - NestedStructuresInput, - NestedStructWithList, - NestedStructWithMap, - NoInputAndOutputOutput, - QueryIdempotencyTokenAutoFillInput, - QueryListsInput, - QueryMapsInput, - QueryTimestampsInput, - RecursiveXmlShapesOutput, - RecursiveXmlShapesOutputNested1, - RecursiveXmlShapesOutputNested2, - SimpleInputParamsInput, - SimpleScalarXmlPropertiesOutput, - StructArg, - StructureListMember, - XmlBlobsOutput, - XmlEnumsOutput, - XmlListsOutput, - XmlMapsOutput, - XmlMapsXmlNameOutput, - XmlNamespaceNested, - XmlNamespacesOutput, - XmlTimestampsOutput, -} from "../models/models_0"; - -export const serializeAws_queryEmptyInputAndEmptyOutputCommand = async ( - input: EmptyInputAndEmptyOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryEmptyInputAndEmptyOutputInput(input, context), - Action: "EmptyInputAndEmptyOutput", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryEndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "EndpointOperation", - Version: "2020-01-08", - }); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_queryEndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryHostLabelInput(input, context), - Action: "EndpointWithHostLabelOperation", - Version: "2020-01-08", - }); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); -}; - -export const serializeAws_queryFlattenedXmlMapCommand = async ( - input: FlattenedXmlMapCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "FlattenedXmlMap", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryFlattenedXmlMapWithXmlNameCommand = async ( - input: FlattenedXmlMapWithXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "FlattenedXmlMapWithXmlName", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryFlattenedXmlMapWithXmlNamespaceCommand = async ( - input: FlattenedXmlMapWithXmlNamespaceCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "FlattenedXmlMapWithXmlNamespace", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryGreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "GreetingWithErrors", - Version: "2020-01-08", - }); - 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 -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "IgnoresWrappingXmlName", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryNestedStructuresCommand = async ( - input: NestedStructuresCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryNestedStructuresInput(input, context), - Action: "NestedStructures", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryNoInputAndNoOutputCommand = async ( - input: NoInputAndNoOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "NoInputAndNoOutput", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryNoInputAndOutputCommand = async ( - input: NoInputAndOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryNoInputAndOutputOutput(input, context), - Action: "NoInputAndOutput", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryQueryIdempotencyTokenAutoFillCommand = async ( - input: QueryIdempotencyTokenAutoFillCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryQueryIdempotencyTokenAutoFillInput(input, context), - Action: "QueryIdempotencyTokenAutoFill", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryQueryListsCommand = async ( - input: QueryListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryQueryListsInput(input, context), - Action: "QueryLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryQueryMapsCommand = async ( - input: QueryMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryQueryMapsInput(input, context), - Action: "QueryMaps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryQueryTimestampsCommand = async ( - input: QueryTimestampsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_queryQueryTimestampsInput(input, context), - Action: "QueryTimestamps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryRecursiveXmlShapesCommand = async ( - input: RecursiveXmlShapesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "RecursiveXmlShapes", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_querySimpleInputParamsCommand = async ( - input: SimpleInputParamsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - let body: any; - body = buildFormUrlencodedString({ - ...serializeAws_querySimpleInputParamsInput(input, context), - Action: "SimpleInputParams", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_querySimpleScalarXmlPropertiesCommand = async ( - input: SimpleScalarXmlPropertiesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "SimpleScalarXmlProperties", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlBlobsCommand = async ( - input: XmlBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlBlobs", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlEmptyBlobsCommand = async ( - input: XmlEmptyBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEmptyBlobs", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlEmptyListsCommand = async ( - input: XmlEmptyListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEmptyLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlEmptyMapsCommand = async ( - input: XmlEmptyMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEmptyMaps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlEnumsCommand = async ( - input: XmlEnumsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlEnums", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlListsCommand = async ( - input: XmlListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlLists", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlMapsCommand = async ( - input: XmlMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlMaps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlMapsXmlNameCommand = async ( - input: XmlMapsXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlMapsXmlName", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlNamespacesCommand = async ( - input: XmlNamespacesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlNamespaces", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const serializeAws_queryXmlTimestampsCommand = async ( - input: XmlTimestampsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const headers: __HeaderBag = { - "content-type": "application/x-www-form-urlencoded", - }; - const body = buildFormUrlencodedString({ - Action: "XmlTimestamps", - Version: "2020-01-08", - }); - return buildHttpRpcRequest(context, headers, "/", undefined, body); -}; - -export const deserializeAws_queryEmptyInputAndEmptyOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryEmptyInputAndEmptyOutputCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryEmptyInputAndEmptyOutputOutput(data.EmptyInputAndEmptyOutputResult, context); - const response: EmptyInputAndEmptyOutputCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryEmptyInputAndEmptyOutputCommandError = 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_queryEndpointOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryEndpointOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryEndpointOperationCommandError = 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_queryEndpointWithHostLabelOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryEndpointWithHostLabelOperationCommandError(output, context); - } - await collectBody(output.body, context); - const response: EndpointWithHostLabelOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryEndpointWithHostLabelOperationCommandError = 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_queryFlattenedXmlMapCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryFlattenedXmlMapCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryFlattenedXmlMapOutput(data.FlattenedXmlMapResult, context); - const response: FlattenedXmlMapCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryFlattenedXmlMapCommandError = 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_queryFlattenedXmlMapWithXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryFlattenedXmlMapWithXmlNameCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryFlattenedXmlMapWithXmlNameOutput(data.FlattenedXmlMapWithXmlNameResult, context); - const response: FlattenedXmlMapWithXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNameCommandError = 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_queryFlattenedXmlMapWithXmlNamespaceCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutput( - data.FlattenedXmlMapWithXmlNamespaceResult, - context - ); - const response: FlattenedXmlMapWithXmlNamespaceCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceCommandError = 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_queryGreetingWithErrorsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryGreetingWithErrorsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryGreetingWithErrorsOutput(data.GreetingWithErrorsResult, context); - const response: GreetingWithErrorsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryGreetingWithErrorsCommandError = 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) { - case "ComplexError": - case "aws.protocoltests.query#ComplexError": - response = { - ...(await deserializeAws_queryComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "CustomCodeError": - case "aws.protocoltests.query#CustomCodeError": - response = { - ...(await deserializeAws_queryCustomCodeErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.query#InvalidGreeting": - response = { - ...(await deserializeAws_queryInvalidGreetingResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - 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_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 -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryIgnoresWrappingXmlNameCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryIgnoresWrappingXmlNameOutput(data.IgnoresWrappingXmlNameResult, context); - const response: IgnoresWrappingXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryIgnoresWrappingXmlNameCommandError = 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_queryNestedStructuresCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryNestedStructuresCommandError(output, context); - } - await collectBody(output.body, context); - const response: NestedStructuresCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryNestedStructuresCommandError = 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_queryNoInputAndNoOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryNoInputAndNoOutputCommandError(output, context); - } - await collectBody(output.body, context); - const response: NoInputAndNoOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryNoInputAndNoOutputCommandError = 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_queryNoInputAndOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryNoInputAndOutputCommandError(output, context); - } - await collectBody(output.body, context); - const response: NoInputAndOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryNoInputAndOutputCommandError = 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_queryQueryIdempotencyTokenAutoFillCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryQueryIdempotencyTokenAutoFillCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryIdempotencyTokenAutoFillCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryQueryIdempotencyTokenAutoFillCommandError = 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_queryQueryListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryQueryListsCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryListsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryQueryListsCommandError = 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_queryQueryMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryQueryMapsCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryMapsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryQueryMapsCommandError = 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_queryQueryTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryQueryTimestampsCommandError(output, context); - } - await collectBody(output.body, context); - const response: QueryTimestampsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryQueryTimestampsCommandError = 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_queryRecursiveXmlShapesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryRecursiveXmlShapesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryRecursiveXmlShapesOutput(data.RecursiveXmlShapesResult, context); - const response: RecursiveXmlShapesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryRecursiveXmlShapesCommandError = 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_querySimpleInputParamsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_querySimpleInputParamsCommandError(output, context); - } - await collectBody(output.body, context); - const response: SimpleInputParamsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - return Promise.resolve(response); -}; - -const deserializeAws_querySimpleInputParamsCommandError = 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_querySimpleScalarXmlPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_querySimpleScalarXmlPropertiesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_querySimpleScalarXmlPropertiesOutput(data.SimpleScalarXmlPropertiesResult, context); - const response: SimpleScalarXmlPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_querySimpleScalarXmlPropertiesCommandError = 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_queryXmlBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlBlobsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlBlobsOutput(data.XmlBlobsResult, context); - const response: XmlBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlBlobsCommandError = 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_queryXmlEmptyBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlEmptyBlobsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlBlobsOutput(data.XmlEmptyBlobsResult, context); - const response: XmlEmptyBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlEmptyBlobsCommandError = 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_queryXmlEmptyListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlEmptyListsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlListsOutput(data.XmlEmptyListsResult, context); - const response: XmlEmptyListsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlEmptyListsCommandError = 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_queryXmlEmptyMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlEmptyMapsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlMapsOutput(data.XmlEmptyMapsResult, context); - const response: XmlEmptyMapsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlEmptyMapsCommandError = 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_queryXmlEnumsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlEnumsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlEnumsOutput(data.XmlEnumsResult, context); - const response: XmlEnumsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlEnumsCommandError = 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_queryXmlListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlListsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlListsOutput(data.XmlListsResult, context); - const response: XmlListsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlListsCommandError = 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_queryXmlMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlMapsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlMapsOutput(data.XmlMapsResult, context); - const response: XmlMapsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlMapsCommandError = 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_queryXmlMapsXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlMapsXmlNameCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlMapsXmlNameOutput(data.XmlMapsXmlNameResult, context); - const response: XmlMapsXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlMapsXmlNameCommandError = 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_queryXmlNamespacesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlNamespacesCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlNamespacesOutput(data.XmlNamespacesResult, context); - const response: XmlNamespacesCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlNamespacesCommandError = 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_queryXmlTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode >= 300) { - return deserializeAws_queryXmlTimestampsCommandError(output, context); - } - const data: any = await parseBody(output.body, context); - let contents: any = {}; - contents = deserializeAws_queryXmlTimestampsOutput(data.XmlTimestampsResult, context); - const response: XmlTimestampsCommandOutput = { - $metadata: deserializeMetadata(output), - ...contents, - }; - return Promise.resolve(response); -}; - -const deserializeAws_queryXmlTimestampsCommandError = 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)); -}; - -const deserializeAws_queryComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_queryComplexError(body.Error, context); - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_queryCustomCodeErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_queryCustomCodeError(body.Error, context); - const contents: CustomCodeError = { - name: "CustomCodeError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const deserializeAws_queryInvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const body = parsedOutput.body; - const deserialized: any = deserializeAws_queryInvalidGreeting(body.Error, context); - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - ...deserialized, - }; - return contents; -}; - -const serializeAws_queryComplexMap = (input: { [key: string]: GreetingStruct }, context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - Object.keys(input) - .filter((key) => input[key] != null) - .forEach((key) => { - entries[`entry.${counter}.key`] = key; - const memberEntries = serializeAws_queryGreetingStruct(input[key], context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`entry.${counter}.value.${key}`] = value; - }); - counter++; - }); - return entries; -}; - -const serializeAws_queryEmptyInputAndEmptyOutputInput = ( - input: EmptyInputAndEmptyOutputInput, - context: __SerdeContext -): any => { - const entries: any = {}; - return entries; -}; - -const serializeAws_queryHostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.label !== undefined && input.label !== null) { - entries["label"] = input.label; - } - return entries; -}; - -const serializeAws_queryListWithXmlName = (input: string[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - entries[`item.${counter}`] = entry; - counter++; - } - return entries; -}; - -const serializeAws_queryMapOfLists = (input: { [key: string]: string[] }, context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - Object.keys(input) - .filter((key) => input[key] != null) - .forEach((key) => { - entries[`entry.${counter}.key`] = key; - const memberEntries = serializeAws_queryStringList(input[key], context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`entry.${counter}.value.${key}`] = value; - }); - counter++; - }); - return entries; -}; - -const serializeAws_queryMapWithXmlName = (input: { [key: string]: string }, context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - Object.keys(input) - .filter((key) => input[key] != null) - .forEach((key) => { - entries[`entry.${counter}.K`] = key; - entries[`entry.${counter}.V`] = input[key]; - counter++; - }); - return entries; -}; - -const serializeAws_queryNestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.Nested !== undefined && input.Nested !== null) { - const memberEntries = serializeAws_queryStructArg(input.Nested, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Nested.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryNestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { - const entries: any = {}; - if (input.ListArg !== undefined && input.ListArg !== null) { - const memberEntries = serializeAws_queryStringList(input.ListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArg.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryNestedStructWithMap = (input: NestedStructWithMap, context: __SerdeContext): any => { - const entries: any = {}; - if (input.MapArg !== undefined && input.MapArg !== null) { - const memberEntries = serializeAws_queryStringMap(input.MapArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `MapArg.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryNoInputAndOutputOutput = (input: NoInputAndOutputOutput, context: __SerdeContext): any => { - const entries: any = {}; - return entries; -}; - -const serializeAws_queryQueryIdempotencyTokenAutoFillInput = ( - input: QueryIdempotencyTokenAutoFillInput, - context: __SerdeContext -): any => { - const entries: any = {}; - if (input.token === undefined) { - input.token = generateIdempotencyToken(); - } - if (input.token !== undefined && input.token !== null) { - entries["token"] = input.token; - } - return entries; -}; - -const serializeAws_queryQueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.ListArg !== undefined && input.ListArg !== null) { - const memberEntries = serializeAws_queryStringList(input.ListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArg.${key}`; - entries[loc] = value; - }); - } - if (input.ComplexListArg !== undefined && input.ComplexListArg !== null) { - const memberEntries = serializeAws_queryGreetingList(input.ComplexListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ComplexListArg.${key}`; - entries[loc] = value; - }); - } - if (input.FlattenedListArg !== undefined && input.FlattenedListArg !== null) { - const memberEntries = serializeAws_queryStringList(input.FlattenedListArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `FlattenedListArg.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.ListArgWithXmlNameMember !== undefined && input.ListArgWithXmlNameMember !== null) { - const memberEntries = serializeAws_queryListWithXmlName(input.ListArgWithXmlNameMember, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ListArgWithXmlNameMember.${key}`; - entries[loc] = value; - }); - } - if (input.FlattenedListArgWithXmlName !== undefined && input.FlattenedListArgWithXmlName !== null) { - const memberEntries = serializeAws_queryListWithXmlName(input.FlattenedListArgWithXmlName, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.NestedWithList !== undefined && input.NestedWithList !== null) { - const memberEntries = serializeAws_queryNestedStructWithList(input.NestedWithList, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `NestedWithList.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryQueryMapsInput = (input: QueryMapsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.MapArg !== undefined && input.MapArg !== null) { - const memberEntries = serializeAws_queryStringMap(input.MapArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `MapArg.${key}`; - entries[loc] = value; - }); - } - if (input.RenamedMapArg !== undefined && input.RenamedMapArg !== null) { - const memberEntries = serializeAws_queryStringMap(input.RenamedMapArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Foo.${key}`; - entries[loc] = value; - }); - } - if (input.ComplexMapArg !== undefined && input.ComplexMapArg !== null) { - const memberEntries = serializeAws_queryComplexMap(input.ComplexMapArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ComplexMapArg.${key}`; - entries[loc] = value; - }); - } - if (input.MapWithXmlMemberName !== undefined && input.MapWithXmlMemberName !== null) { - const memberEntries = serializeAws_queryMapWithXmlName(input.MapWithXmlMemberName, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `MapWithXmlMemberName.${key}`; - entries[loc] = value; - }); - } - if (input.FlattenedMap !== undefined && input.FlattenedMap !== null) { - const memberEntries = serializeAws_queryStringMap(input.FlattenedMap, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `FlattenedMap.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.FlattenedMapWithXmlName !== undefined && input.FlattenedMapWithXmlName !== null) { - const memberEntries = serializeAws_queryMapWithXmlName(input.FlattenedMapWithXmlName, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; - entries[loc] = value; - }); - } - if (input.MapOfLists !== undefined && input.MapOfLists !== null) { - const memberEntries = serializeAws_queryMapOfLists(input.MapOfLists, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `MapOfLists.${key}`; - entries[loc] = value; - }); - } - if (input.NestedStructWithMap !== undefined && input.NestedStructWithMap !== null) { - const memberEntries = serializeAws_queryNestedStructWithMap(input.NestedStructWithMap, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `NestedStructWithMap.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryQueryTimestampsInput = (input: QueryTimestampsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.normalFormat !== undefined && input.normalFormat !== null) { - entries["normalFormat"] = input.normalFormat.toISOString().split(".")[0] + "Z"; - } - if (input.epochMember !== undefined && input.epochMember !== null) { - entries["epochMember"] = Math.round(input.epochMember.getTime() / 1000); - } - if (input.epochTarget !== undefined && input.epochTarget !== null) { - entries["epochTarget"] = Math.round(input.epochTarget.getTime() / 1000); - } - return entries; -}; - -const serializeAws_querySimpleInputParamsInput = (input: SimpleInputParamsInput, context: __SerdeContext): any => { - const entries: any = {}; - if (input.Foo !== undefined && input.Foo !== null) { - entries["Foo"] = input.Foo; - } - if (input.Bar !== undefined && input.Bar !== null) { - entries["Bar"] = input.Bar; - } - if (input.Baz !== undefined && input.Baz !== null) { - entries["Baz"] = input.Baz; - } - if (input.Bam !== undefined && input.Bam !== null) { - entries["Bam"] = input.Bam; - } - if (input.FloatValue !== undefined && input.FloatValue !== null) { - entries["FloatValue"] = __serializeFloat(input.FloatValue); - } - if (input.Boo !== undefined && input.Boo !== null) { - entries["Boo"] = __serializeFloat(input.Boo); - } - if (input.Qux !== undefined && input.Qux !== null) { - entries["Qux"] = context.base64Encoder(input.Qux); - } - if (input.FooEnum !== undefined && input.FooEnum !== null) { - entries["FooEnum"] = input.FooEnum; - } - return entries; -}; - -const serializeAws_queryStructArg = (input: StructArg, context: __SerdeContext): any => { - const entries: any = {}; - if (input.StringArg !== undefined && input.StringArg !== null) { - entries["StringArg"] = input.StringArg; - } - if (input.OtherArg !== undefined && input.OtherArg !== null) { - entries["OtherArg"] = input.OtherArg; - } - if (input.RecursiveArg !== undefined && input.RecursiveArg !== null) { - const memberEntries = serializeAws_queryStructArg(input.RecursiveArg, context); - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `RecursiveArg.${key}`; - entries[loc] = value; - }); - } - return entries; -}; - -const serializeAws_queryGreetingList = (input: GreetingStruct[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - const memberEntries = serializeAws_queryGreetingStruct(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; - }); - counter++; - } - return entries; -}; - -const serializeAws_queryGreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - const entries: any = {}; - if (input.hi !== undefined && input.hi !== null) { - entries["hi"] = input.hi; - } - return entries; -}; - -const serializeAws_queryStringList = (input: string[], context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; - } - entries[`member.${counter}`] = entry; - counter++; - } - return entries; -}; - -const serializeAws_queryStringMap = (input: { [key: string]: string }, context: __SerdeContext): any => { - const entries: any = {}; - let counter = 1; - Object.keys(input) - .filter((key) => input[key] != null) - .forEach((key) => { - entries[`entry.${counter}.key`] = key; - entries[`entry.${counter}.value`] = input[key]; - counter++; - }); - return entries; -}; - -const deserializeAws_queryComplexError = (output: any, context: __SerdeContext): ComplexError => { - const contents: any = { - TopLevel: undefined, - Nested: undefined, - }; - if (output["TopLevel"] !== undefined) { - contents.TopLevel = __expectString(output["TopLevel"]); - } - if (output["Nested"] !== undefined) { - contents.Nested = deserializeAws_queryComplexNestedErrorData(output["Nested"], context); - } - return contents; -}; - -const deserializeAws_queryComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - const contents: any = { - Foo: undefined, - }; - if (output["Foo"] !== undefined) { - contents.Foo = __expectString(output["Foo"]); - } - return contents; -}; - -const deserializeAws_queryCustomCodeError = (output: any, context: __SerdeContext): CustomCodeError => { - const contents: any = { - Message: undefined, - }; - if (output["Message"] !== undefined) { - contents.Message = __expectString(output["Message"]); - } - return contents; -}; - -const deserializeAws_queryEmptyInputAndEmptyOutputOutput = ( - output: any, - context: __SerdeContext -): EmptyInputAndEmptyOutputOutput => { - const contents: any = {}; - return contents; -}; - -const deserializeAws_queryFlattenedXmlMapOutput = (output: any, context: __SerdeContext): FlattenedXmlMapOutput => { - const contents: any = { - myMap: undefined, - }; - if (output.myMap === "") { - contents.myMap = {}; - } - if (output["myMap"] !== undefined) { - contents.myMap = deserializeAws_queryFooEnumMap(__getArrayIfSingleItem(output["myMap"]), context); - } - return contents; -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNameOutput = ( - output: any, - context: __SerdeContext -): FlattenedXmlMapWithXmlNameOutput => { - const contents: any = { - myMap: undefined, - }; - if (output.KVP === "") { - contents.myMap = {}; - } - if (output["KVP"] !== undefined) { - contents.myMap = deserializeAws_queryFlattenedXmlMapWithXmlNameOutputMap( - __getArrayIfSingleItem(output["KVP"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNameOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["V"] === null) { - return acc; - } - return { - ...acc, - [pair["K"]]: __expectString(pair["V"]) as any, - }; - }, {}); -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutput = ( - output: any, - context: __SerdeContext -): FlattenedXmlMapWithXmlNamespaceOutput => { - const contents: any = { - myMap: undefined, - }; - if (output.KVP === "") { - contents.myMap = {}; - } - if (output["KVP"] !== undefined) { - contents.myMap = deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutputMap( - __getArrayIfSingleItem(output["KVP"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryFlattenedXmlMapWithXmlNamespaceOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["V"] === null) { - return acc; - } - return { - ...acc, - [pair["K"]]: __expectString(pair["V"]) as any, - }; - }, {}); -}; - -const deserializeAws_queryGreetingWithErrorsOutput = ( - output: any, - context: __SerdeContext -): GreetingWithErrorsOutput => { - const contents: any = { - greeting: undefined, - }; - if (output["greeting"] !== undefined) { - contents.greeting = __expectString(output["greeting"]); - } - return contents; -}; - -const deserializeAws_queryIgnoresWrappingXmlNameOutput = ( - output: any, - context: __SerdeContext -): IgnoresWrappingXmlNameOutput => { - const contents: any = { - foo: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - return contents; -}; - -const deserializeAws_queryInvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - const contents: any = { - Message: undefined, - }; - if (output["Message"] !== undefined) { - contents.Message = __expectString(output["Message"]); - } - return contents; -}; - -const deserializeAws_queryListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryListWithNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryRecursiveXmlShapesOutput = ( - output: any, - context: __SerdeContext -): RecursiveXmlShapesOutput => { - const contents: any = { - nested: undefined, - }; - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_queryRecursiveXmlShapesOutputNested1(output["nested"], context); - } - return contents; -}; - -const deserializeAws_queryRecursiveXmlShapesOutputNested1 = ( - output: any, - context: __SerdeContext -): RecursiveXmlShapesOutputNested1 => { - const contents: any = { - foo: undefined, - nested: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_queryRecursiveXmlShapesOutputNested2(output["nested"], context); - } - return contents; -}; - -const deserializeAws_queryRecursiveXmlShapesOutputNested2 = ( - output: any, - context: __SerdeContext -): RecursiveXmlShapesOutputNested2 => { - const contents: any = { - bar: undefined, - recursiveMember: undefined, - }; - if (output["bar"] !== undefined) { - contents.bar = __expectString(output["bar"]); - } - if (output["recursiveMember"] !== undefined) { - contents.recursiveMember = deserializeAws_queryRecursiveXmlShapesOutputNested1(output["recursiveMember"], context); - } - return contents; -}; - -const deserializeAws_queryRenamedListMembers = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_querySimpleScalarXmlPropertiesOutput = ( - output: any, - context: __SerdeContext -): SimpleScalarXmlPropertiesOutput => { - const contents: any = { - stringValue: undefined, - emptyStringValue: undefined, - trueBooleanValue: undefined, - falseBooleanValue: undefined, - byteValue: undefined, - shortValue: undefined, - integerValue: undefined, - longValue: undefined, - floatValue: undefined, - doubleValue: undefined, - }; - if (output["stringValue"] !== undefined) { - contents.stringValue = __expectString(output["stringValue"]); - } - if (output["emptyStringValue"] !== undefined) { - contents.emptyStringValue = __expectString(output["emptyStringValue"]); - } - if (output["trueBooleanValue"] !== undefined) { - contents.trueBooleanValue = __parseBoolean(output["trueBooleanValue"]); - } - if (output["falseBooleanValue"] !== undefined) { - contents.falseBooleanValue = __parseBoolean(output["falseBooleanValue"]); - } - if (output["byteValue"] !== undefined) { - contents.byteValue = __strictParseByte(output["byteValue"]) as number; - } - if (output["shortValue"] !== undefined) { - contents.shortValue = __strictParseShort(output["shortValue"]) as number; - } - if (output["integerValue"] !== undefined) { - contents.integerValue = __strictParseInt32(output["integerValue"]) as number; - } - if (output["longValue"] !== undefined) { - contents.longValue = __strictParseLong(output["longValue"]) as number; - } - if (output["floatValue"] !== undefined) { - contents.floatValue = __strictParseFloat(output["floatValue"]) as number; - } - if (output["DoubleDribble"] !== undefined) { - contents.doubleValue = __strictParseFloat(output["DoubleDribble"]) as number; - } - return contents; -}; - -const deserializeAws_queryStructureList = (output: any, context: __SerdeContext): StructureListMember[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_queryStructureListMember(entry, context); - }); -}; - -const deserializeAws_queryStructureListMember = (output: any, context: __SerdeContext): StructureListMember => { - const contents: any = { - a: undefined, - b: undefined, - }; - if (output["value"] !== undefined) { - contents.a = __expectString(output["value"]); - } - if (output["other"] !== undefined) { - contents.b = __expectString(output["other"]); - } - return contents; -}; - -const deserializeAws_queryXmlBlobsOutput = (output: any, context: __SerdeContext): XmlBlobsOutput => { - const contents: any = { - data: undefined, - }; - if (output["data"] !== undefined) { - contents.data = context.base64Decoder(output["data"]); - } - return contents; -}; - -const deserializeAws_queryXmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput => { - const contents: any = { - fooEnum1: undefined, - fooEnum2: undefined, - fooEnum3: undefined, - fooEnumList: undefined, - fooEnumSet: undefined, - fooEnumMap: undefined, - }; - if (output["fooEnum1"] !== undefined) { - contents.fooEnum1 = __expectString(output["fooEnum1"]); - } - if (output["fooEnum2"] !== undefined) { - contents.fooEnum2 = __expectString(output["fooEnum2"]); - } - if (output["fooEnum3"] !== undefined) { - contents.fooEnum3 = __expectString(output["fooEnum3"]); - } - if (output.fooEnumList === "") { - contents.fooEnumList = []; - } - if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = deserializeAws_queryFooEnumList( - __getArrayIfSingleItem(output["fooEnumList"]["member"]), - context - ); - } - if (output.fooEnumSet === "") { - contents.fooEnumSet = []; - } - if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = deserializeAws_queryFooEnumSet( - __getArrayIfSingleItem(output["fooEnumSet"]["member"]), - context - ); - } - if (output.fooEnumMap === "") { - contents.fooEnumMap = {}; - } - if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = deserializeAws_queryFooEnumMap( - __getArrayIfSingleItem(output["fooEnumMap"]["entry"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryXmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput => { - const contents: any = { - stringList: undefined, - stringSet: undefined, - integerList: undefined, - booleanList: undefined, - timestampList: undefined, - enumList: undefined, - nestedStringList: undefined, - renamedListMembers: undefined, - flattenedList: undefined, - flattenedList2: undefined, - flattenedListWithMemberNamespace: undefined, - flattenedListWithNamespace: undefined, - structureList: undefined, - }; - if (output.stringList === "") { - contents.stringList = []; - } - if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { - contents.stringList = deserializeAws_queryStringList( - __getArrayIfSingleItem(output["stringList"]["member"]), - context - ); - } - if (output.stringSet === "") { - contents.stringSet = []; - } - if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { - contents.stringSet = deserializeAws_queryStringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); - } - if (output.integerList === "") { - contents.integerList = []; - } - if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { - contents.integerList = deserializeAws_queryIntegerList( - __getArrayIfSingleItem(output["integerList"]["member"]), - context - ); - } - if (output.booleanList === "") { - contents.booleanList = []; - } - if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { - contents.booleanList = deserializeAws_queryBooleanList( - __getArrayIfSingleItem(output["booleanList"]["member"]), - context - ); - } - if (output.timestampList === "") { - contents.timestampList = []; - } - if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { - contents.timestampList = deserializeAws_queryTimestampList( - __getArrayIfSingleItem(output["timestampList"]["member"]), - context - ); - } - if (output.enumList === "") { - contents.enumList = []; - } - if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { - contents.enumList = deserializeAws_queryFooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); - } - if (output.nestedStringList === "") { - contents.nestedStringList = []; - } - if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { - contents.nestedStringList = deserializeAws_queryNestedStringList( - __getArrayIfSingleItem(output["nestedStringList"]["member"]), - context - ); - } - if (output.renamed === "") { - contents.renamedListMembers = []; - } - if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { - contents.renamedListMembers = deserializeAws_queryRenamedListMembers( - __getArrayIfSingleItem(output["renamed"]["item"]), - context - ); - } - if (output.flattenedList === "") { - contents.flattenedList = []; - } - if (output["flattenedList"] !== undefined) { - contents.flattenedList = deserializeAws_queryRenamedListMembers( - __getArrayIfSingleItem(output["flattenedList"]), - context - ); - } - if (output.customName === "") { - contents.flattenedList2 = []; - } - if (output["customName"] !== undefined) { - contents.flattenedList2 = deserializeAws_queryRenamedListMembers( - __getArrayIfSingleItem(output["customName"]), - context - ); - } - if (output.flattenedListWithMemberNamespace === "") { - contents.flattenedListWithMemberNamespace = []; - } - if (output["flattenedListWithMemberNamespace"] !== undefined) { - contents.flattenedListWithMemberNamespace = deserializeAws_queryListWithMemberNamespace( - __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), - context - ); - } - if (output.flattenedListWithNamespace === "") { - contents.flattenedListWithNamespace = []; - } - if (output["flattenedListWithNamespace"] !== undefined) { - contents.flattenedListWithNamespace = deserializeAws_queryListWithNamespace( - __getArrayIfSingleItem(output["flattenedListWithNamespace"]), - context - ); - } - if (output.myStructureList === "") { - contents.structureList = []; - } - if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { - contents.structureList = deserializeAws_queryStructureList( - __getArrayIfSingleItem(output["myStructureList"]["item"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryXmlMapsOutput = (output: any, context: __SerdeContext): XmlMapsOutput => { - const contents: any = { - myMap: undefined, - }; - if (output.myMap === "") { - contents.myMap = {}; - } - if (output["myMap"] !== undefined && output["myMap"]["entry"] !== undefined) { - contents.myMap = deserializeAws_queryXmlMapsOutputMap(__getArrayIfSingleItem(output["myMap"]["entry"]), context); - } - return contents; -}; - -const deserializeAws_queryXmlMapsOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return output.reduce((acc: any, pair: any) => { - if (pair["value"] === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: deserializeAws_queryGreetingStruct(pair["value"], context), - }; - }, {}); -}; - -const deserializeAws_queryXmlMapsXmlNameOutput = (output: any, context: __SerdeContext): XmlMapsXmlNameOutput => { - const contents: any = { - myMap: undefined, - }; - if (output.myMap === "") { - contents.myMap = {}; - } - if (output["myMap"] !== undefined && output["myMap"]["entry"] !== undefined) { - contents.myMap = deserializeAws_queryXmlMapsXmlNameOutputMap( - __getArrayIfSingleItem(output["myMap"]["entry"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryXmlMapsXmlNameOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return output.reduce((acc: any, pair: any) => { - if (pair["Setting"] === null) { - return acc; - } - return { - ...acc, - [pair["Attribute"]]: deserializeAws_queryGreetingStruct(pair["Setting"], context), - }; - }, {}); -}; - -const deserializeAws_queryXmlNamespacedList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryXmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { - const contents: any = { - foo: undefined, - values: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output.values === "") { - contents.values = []; - } - if (output["values"] !== undefined && output["values"]["member"] !== undefined) { - contents.values = deserializeAws_queryXmlNamespacedList( - __getArrayIfSingleItem(output["values"]["member"]), - context - ); - } - return contents; -}; - -const deserializeAws_queryXmlNamespacesOutput = (output: any, context: __SerdeContext): XmlNamespacesOutput => { - const contents: any = { - nested: undefined, - }; - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_queryXmlNamespaceNested(output["nested"], context); - } - return contents; -}; - -const deserializeAws_queryXmlTimestampsOutput = (output: any, context: __SerdeContext): XmlTimestampsOutput => { - const contents: any = { - normal: undefined, - dateTime: undefined, - epochSeconds: undefined, - httpDate: undefined, - }; - if (output["normal"] !== undefined) { - contents.normal = __expectNonNull(__parseRfc3339DateTime(output["normal"])); - } - if (output["dateTime"] !== undefined) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTime(output["dateTime"])); - } - if (output["epochSeconds"] !== undefined) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(output["epochSeconds"])); - } - if (output["httpDate"] !== undefined) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(output["httpDate"])); - } - return contents; -}; - -const deserializeAws_queryBooleanList = (output: any, context: __SerdeContext): boolean[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __parseBoolean(entry); - }); -}; - -const deserializeAws_queryFooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryFooEnumMap = (output: any, context: __SerdeContext): { [key: string]: FooEnum | string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["value"] === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: __expectString(pair["value"]) as any, - }; - }, {}); -}; - -const deserializeAws_queryFooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryGreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - const contents: any = { - hi: undefined, - }; - if (output["hi"] !== undefined) { - contents.hi = __expectString(output["hi"]); - } - return contents; -}; - -const deserializeAws_queryIntegerList = (output: any, context: __SerdeContext): number[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __strictParseInt32(entry) as number; - }); -}; - -const deserializeAws_queryNestedStringList = (output: any, context: __SerdeContext): string[][] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_queryStringList(__getArrayIfSingleItem(entry["member"]), context); - }); -}; - -const deserializeAws_queryStringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryStringSet = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_queryTimestampList = (output: any, context: __SerdeContext): Date[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectNonNull(__parseRfc3339DateTime(entry)); - }); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const buildHttpRpcRequest = async ( - context: __SerdeContext, - headers: __HeaderBag, - path: string, - resolvedHostname: string | undefined, - body: any -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents: any = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers, - }; - if (resolvedHostname !== undefined) { - contents.hostname = resolvedHostname; - } - if (body !== undefined) { - contents.body = body; - } - return new __HttpRequest(contents); -}; - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - const parsedObj = xmlParse(encoded, { - attributeNamePrefix: "", - ignoreAttributes: false, - parseNodeValue: false, - trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; - } - return __getValueFromTextNode(parsedObjToReturn); - } - return {}; - }); - -const buildFormUrlencodedString = (formEntries: { [key: string]: string }): string => - Object.entries(formEntries) - .map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value)) - .join("&"); - -const loadQueryErrorCode = (output: __HttpResponse, data: any): string => { - if (data.Error.Code !== undefined) { - return data.Error.Code; - } - if (output.statusCode == 404) { - return "NotFound"; - } - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts deleted file mode 100644 index 2caa43a22cee..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { QueryProtocolClientConfig } from "./QueryProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts deleted file mode 100644 index e68b530389ac..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { QueryProtocolClientConfig } from "./QueryProtocolClient"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts deleted file mode 100644 index 3a4d67ebddde..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { defaultRegionInfoProvider } from "./endpoints"; -import { QueryProtocolClientConfig } from "./QueryProtocolClient"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: QueryProtocolClientConfig) => ({ - apiVersion: "2020-01-08", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "Query Protocol", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts deleted file mode 100644 index 95c1994a9e2b..000000000000 --- a/protocol_tests/aws-protocoltests-query/src/runtimeConfig.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Hash } from "@aws-sdk/hash-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { QueryProtocolClientConfig } from "./QueryProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts b/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts deleted file mode 100644 index 661bd311f114..000000000000 --- a/protocol_tests/aws-protocoltests-query/test/functional/awsquery.spec.ts +++ /dev/null @@ -1,3117 +0,0 @@ -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"; - -import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; -import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommand } from "../../src/commands/FlattenedXmlMapCommand"; -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"; -import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; -import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryListsCommand } from "../../src/commands/QueryListsCommand"; -import { QueryMapsCommand } from "../../src/commands/QueryMapsCommand"; -import { QueryTimestampsCommand } from "../../src/commands/QueryTimestampsCommand"; -import { RecursiveXmlShapesCommand } from "../../src/commands/RecursiveXmlShapesCommand"; -import { SimpleInputParamsCommand } from "../../src/commands/SimpleInputParamsCommand"; -import { SimpleScalarXmlPropertiesCommand } from "../../src/commands/SimpleScalarXmlPropertiesCommand"; -import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommand } from "../../src/commands/XmlEmptyMapsCommand"; -import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; -import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; -import { XmlMapsCommand } from "../../src/commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommand } from "../../src/commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; -import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; -import { ComplexError, CustomCodeError, InvalidGreeting } from "../../src/models/models_0"; -import { QueryProtocolClient } from "../../src/QueryProtocolClient"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Empty input serializes no extra query params - */ -it("QueryEmptyInputAndEmptyOutput:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyInputAndEmptyOutputCommand({} as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EmptyInputAndEmptyOutput&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output - */ -it("QueryEmptyInputAndEmptyOutput:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("AwsQueryEndpointTrait:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EndpointOperation&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("AwsQueryEndpointTraitWithHostLabel:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=EndpointWithHostLabelOperation&Version=2020-01-08&label=bar`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened XML maps in responses - */ -it("QueryQueryFlattenedXmlMap:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - foo - Foo - - - baz - Baz - - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: "Foo", - - baz: "Baz", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes flattened XML maps in responses that have xmlName on members - */ -it("QueryQueryFlattenedXmlMapWithXmlName:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - a - A - - - b - B - - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapWithXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - a: "A", - - b: "B", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes flattened XML maps in responses that have xmlNamespace and xmlName on members - */ -it("QueryQueryFlattenedXmlMapWithXmlNamespace:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - a - A - - - b - B - - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapWithXmlNamespaceCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - a: "A", - - b: "B", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that operations with errors successfully know how to deserialize the successful response - */ -it("QueryGreetingWithErrors:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - Hello - - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - greeting: "Hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses simple XML errors - */ -it("QueryInvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "text/xml", - }, - ` - - Sender - InvalidGreeting - Hi - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Parses customized XML errors - */ -it.skip("QueryCustomizedError:Error:GreetingWithErrors", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 402, - { - "content-type": "text/xml", - }, - ` - - Sender - Customized - Hi - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "CustomCodeError") { - console.log(err); - fail(`Expected a CustomCodeError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(402); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -it("QueryComplexError:Error:GreetingWithErrors", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "text/xml", - }, - ` - - Sender - ComplexError - Top level - - bar - - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - 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 - */ -it("QueryIgnoresWrappingXmlName:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - bar - - - ` - ), - }); - - const params: any = {}; - const command = new IgnoresWrappingXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "bar", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes nested structures using dots - */ -it("NestedStructures:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NestedStructuresCommand({ - Nested: { - StringArg: "foo", - - OtherArg: true, - - RecursiveArg: { - StringArg: "baz", - } as any, - } as any, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=NestedStructures&Version=2020-01-08&Nested.StringArg=foo&Nested.OtherArg=true&Nested.RecursiveArg.StringArg=baz`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * No input serializes no additional query params - */ -it("QueryNoInputAndNoOutput:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndNoOutputCommand({}); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=NoInputAndNoOutput&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output. Note that no assertion is made on the output body itself. - */ -it("QueryNoInputAndNoOutput:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * No input serializes no payload - */ -it("QueryNoInputAndOutput:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndOutputCommand({} as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=NoInputAndOutput&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Empty output - */ -it("QueryNoInputAndOutput:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Automatically adds idempotency token when not set - */ -it("QueryProtocolIdempotencyTokenAutoFill:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&token=00000000-0000-4000-8000-000000000000`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Uses the given idempotency token as-is - */ -it("QueryProtocolIdempotencyTokenAutoFillIsSet:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000123", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&token=00000000-0000-4000-8000-000000000123`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query lists - */ -it("QueryLists:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArg: ["foo", "bar", "baz"], - - ComplexListArg: [ - { - hi: "hello", - } as any, - - { - hi: "hola", - } as any, - ], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&ComplexListArg.member.1.hi=hello&ComplexListArg.member.2.hi=hola`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Does not serialize empty query lists - */ -it("EmptyQueryLists:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArg: [], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Flattens query lists by repeating the member name and removing the member element - */ -it("FlattenedQueryLists:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - FlattenedListArg: ["A", "B"], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&FlattenedListArg.1=A&FlattenedListArg.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Changes the member of lists using xmlName trait - */ -it("QueryListArgWithXmlNameMember:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - ListArgWithXmlNameMember: ["A", "B"], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&ListArgWithXmlNameMember.item.1=A&ListArgWithXmlNameMember.item.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Changes the name of flattened lists using xmlName trait on the structure member - */ -it("QueryFlattenedListArgWithXmlName:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - FlattenedListArgWithXmlName: ["A", "B"], - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&Hi.1=A&Hi.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Nested structure with a list member - */ -it("QueryNestedStructWithList:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryListsCommand({ - NestedWithList: { - ListArg: ["A", "B"], - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.member.1=A&NestedWithList.ListArg.member.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query maps - */ -it("QuerySimpleQueryMaps:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - MapArg: { - bar: "Bar", - - foo: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&MapArg.entry.1.key=bar&MapArg.entry.1.value=Bar&MapArg.entry.2.key=foo&MapArg.entry.2.value=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query maps and uses xmlName - */ -it("QuerySimpleQueryMapsWithXmlName:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - RenamedMapArg: { - foo: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&Foo.entry.1.key=foo&Foo.entry.1.value=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes complex query maps - */ -it("QueryComplexQueryMaps:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - ComplexMapArg: { - bar: { - hi: "Bar", - } as any, - - foo: { - hi: "Foo", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&ComplexMapArg.entry.1.key=bar&ComplexMapArg.entry.1.value.hi=Bar&ComplexMapArg.entry.2.key=foo&ComplexMapArg.entry.2.value.hi=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Does not serialize empty query maps - */ -it("QueryEmptyQueryMaps:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - MapArg: {} as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query maps where the member has an xmlName trait - */ -it("QueryQueryMapWithMemberXmlName:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - MapWithXmlMemberName: { - bar: "Bar", - - foo: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&MapWithXmlMemberName.entry.1.K=bar&MapWithXmlMemberName.entry.1.V=Bar&MapWithXmlMemberName.entry.2.K=foo&MapWithXmlMemberName.entry.2.V=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened query maps - */ -it("QueryFlattenedQueryMaps:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - FlattenedMap: { - bar: "Bar", - - foo: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&FlattenedMap.1.key=bar&FlattenedMap.1.value=Bar&FlattenedMap.2.key=foo&FlattenedMap.2.value=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened query maps that use an xmlName - */ -it("QueryFlattenedQueryMapsWithXmlName:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - FlattenedMapWithXmlName: { - bar: "Bar", - - foo: "Foo", - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&Hi.1.K=bar&Hi.1.V=Bar&Hi.2.K=foo&Hi.2.V=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes query map of lists - */ -it("QueryQueryMapOfLists:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - MapOfLists: { - bar: ["C", "D"], - - foo: ["A", "B"], - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&MapOfLists.entry.1.key=bar&MapOfLists.entry.1.value.member.1=C&MapOfLists.entry.1.value.member.2=D&MapOfLists.entry.2.key=foo&MapOfLists.entry.2.value.member.1=A&MapOfLists.entry.2.value.member.2=B`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes nested struct with map member - */ -it("QueryNestedStructWithMap:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryMapsCommand({ - NestedStructWithMap: { - MapArg: { - bar: "Bar", - - foo: "Foo", - } as any, - } as any, - } as any); - 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("/"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryMaps&Version=2020-01-08&NestedStructWithMap.MapArg.entry.1.key=bar&NestedStructWithMap.MapArg.entry.1.value=Bar&NestedStructWithMap.MapArg.entry.2.key=foo&NestedStructWithMap.MapArg.entry.2.value=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes timestamps - */ -it("QueryTimestampsInput:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryTimestampsCommand({ - normalFormat: new Date(1422172800000), - - epochMember: new Date(1422172800000), - - epochTarget: new Date(1422172800000), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=QueryTimestamps&Version=2020-01-08&normalFormat=2015-01-25T08%3A00%3A00Z&epochMember=1422172800&epochTarget=1422172800`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes recursive structures - */ -it("QueryRecursiveShapes:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - Foo1 - - Bar1 - - Foo2 - - Bar2 - - - - - - - ` - ), - }); - - const params: any = {}; - const command = new RecursiveXmlShapesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - }, - }, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes strings - */ -it("QuerySimpleInputParamsStrings:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Foo: "val1", - - Bar: "val2", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Bar=val2`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes booleans that are true - */ -it("QuerySimpleInputParamsStringAndBooleanTrue:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Foo: "val1", - - Baz: true, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Foo=val1&Baz=true`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes booleans that are false - */ -it("QuerySimpleInputParamsStringsAndBooleanFalse:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Baz: false, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Baz=false`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes integers - */ -it("QuerySimpleInputParamsInteger:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Bam: 10, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Bam=10`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes floats - */ -it("QuerySimpleInputParamsFloat:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Boo: 10.8, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Boo=10.8`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Blobs are base64 encoded in the query string - */ -it("QuerySimpleInputParamsBlob:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - Qux: Uint8Array.from("value", (c) => c.charCodeAt(0)), - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&Qux=dmFsdWU%3D`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes enums in the query string - */ -it("QueryEnums:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FooEnum: "Foo", - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FooEnum=Foo`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("AwsQuerySupportsNaNFloatInputs:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: NaN, - - Boo: NaN, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=NaN&Boo=NaN`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsQuerySupportsInfinityFloatInputs:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: Infinity, - - Boo: Infinity, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=Infinity&Boo=Infinity`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsQuerySupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleInputParamsCommand({ - FloatValue: -Infinity, - - Boo: -Infinity, - } as any); - 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("/"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/x-www-form-urlencoded"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Action=SimpleInputParams&Version=2020-01-08&FloatValue=-Infinity&Boo=-Infinity`; - const unequalParts: any = compareEquivalentFormUrlencodedBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("QuerySimpleScalarProperties:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - string - - true - false - 1 - 2 - 3 - 4 - 5.5 - 6.5 - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - emptyStringValue: "", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float values. - */ -it("AwsQuerySupportsNaNFloatOutputs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - NaN - NaN - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("AwsQuerySupportsInfinityFloatOutputs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - Infinity - Infinity - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("AwsQuerySupportsNegativeInfinityFloatOutputs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - -Infinity - -Infinity - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarXmlPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Blobs are base64 encoded - */ -it("QueryXmlBlobs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - dmFsdWU= - - - ` - ), - }); - - const params: any = {}; - const command = new XmlBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty blobs are deserialized as empty string - */ -it("QueryXmlEmptyBlobs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty self closed blobs are deserialized as empty string - */ -it("QueryXmlEmptySelfClosedBlobs:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes empty XML lists - */ -it("QueryXmlEmptyLists:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: [], - - stringSet: [], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes Empty XML maps - */ -it("QueryXmlEmptyMaps:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: {}, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes Self-Closed XML maps - */ -it("QueryXmlEmptySelfClosedMaps:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: {}, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("QueryXmlEnums:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - Foo - 0 - 1 - - Foo - 0 - - - Foo - 0 - - - - hi - Foo - - - zero - 0 - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEnumsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests for XML list serialization - */ -it("QueryXmlLists:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - foo - bar - - - foo - bar - - - 1 - 2 - - - true - false - - - 2014-04-29T18:30:38Z - 2014-04-29T18:30:38Z - - - Foo - 0 - - - - foo - bar - - - baz - qux - - - - foo - bar - - hi - bye - yep - nope - a - b - a - b - - - 1 - 2 - - - 3 - 4 - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - renamedListMembers: ["foo", "bar"], - - flattenedList: ["hi", "bye"], - - flattenedList2: ["yep", "nope"], - - flattenedListWithMemberNamespace: ["a", "b"], - - flattenedListWithNamespace: ["a", "b"], - - structureList: [ - { - a: "1", - - b: "2", - }, - - { - a: "3", - - b: "4", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests for XML map serialization - */ -it("QueryXmlMaps:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - foo - - there - - - - baz - - bye - - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML lists - */ -it("QueryQueryXmlMapsXmlName:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - - foo - - there - - - - baz - - bye - - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlMapsXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML namespaces - */ -it("QueryXmlNamespaces:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - - Foo - - Bar - Baz - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlNamespacesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo", - - values: ["Bar", "Baz"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests how normal timestamps are serialized - */ -it("QueryXmlTimestamps:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - 2014-04-29T18:30:38Z - - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - normal: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("QueryXmlTimestampsWithDateTimeFormat:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - 2014-04-29T18:30:38Z - - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - dateTime: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("QueryXmlTimestampsWithEpochSecondsFormat:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - 1398796238 - - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - epochSeconds: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("QueryXmlTimestampsWithHttpDateFormat:Response", async () => { - const client = new QueryProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "text/xml", - }, - ` - - Tue, 29 Apr 2014 18:30:38 GMT - - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - httpDate: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentFormUrlencodedBodies = (expectedBody: string, generatedBody: string): Object => { - const fromEntries = (components: string[][]): { [key: string]: string } => { - const parts: { [key: string]: string } = {}; - - components.forEach((component) => { - parts[component[0]] = component[1]; - }); - - return parts; - }; - - // Generate to k:v maps from query components - const expectedParts = fromEntries(expectedBody.split("&").map((part) => part.trim().split("="))); - const generatedParts = fromEntries(generatedBody.split("&").map((part) => part.trim().split("="))); - - 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-protocoltests-query/tsconfig.es.json b/protocol_tests/aws-protocoltests-query/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-query/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-query/tsconfig.json b/protocol_tests/aws-protocoltests-query/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-query/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-query/tsconfig.types.json b/protocol_tests/aws-protocoltests-query/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-query/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-restjson/.gitignore b/protocol_tests/aws-protocoltests-restjson/.gitignore deleted file mode 100644 index bff6121c007d..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md b/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md deleted file mode 100644 index 8a1f0c0a9dee..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/CHANGELOG.md +++ /dev/null @@ -1,784 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - - -### Features - -* **codegen:** assert sets have no duplicates ([#2764](https://github.com/aws/aws-sdk-js-v3/issues/2764)) ([aa62fc3](https://github.com/aws/aws-sdk-js-v3/commit/aa62fc3eda48e9a57753cea6fc5896b65f2dbe3b)) - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - - -### Features - -* **clients:** update clients as of 08/13/2021 ([#2674](https://github.com/aws/aws-sdk-js-v3/issues/2674)) ([de45580](https://github.com/aws/aws-sdk-js-v3/commit/de45580769f70d5db409204f5196da5221c23d99)) - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - -### Features - -* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - - -### Features - -* **clients:** update clients as of 07/08/2021 ([#2565](https://github.com/aws/aws-sdk-js-v3/issues/2565)) ([c9bd983](https://github.com/aws/aws-sdk-js-v3/commit/c9bd98328765c540b778f9085d0ec8870e5af6c9)) - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) - - - - - -# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) - - -### Bug Fixes - -* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) - - - - - -# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) - - -### Features - -* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) -* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) - - - - - -# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) - - -### Features - -* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) - - - - - -# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) - - -### Bug Fixes - -* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) - - - - - -# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) - - -### Bug Fixes - -* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) - - -### Features - -* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) - - - - - -## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) - - -### Features - -* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) - - - - - -# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) - - -### Bug Fixes - -* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) - - -### Features - -* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) - - - - - -# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) - - -### Features - -* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) - - - - - -# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) - - -### Bug Fixes - -* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) - - - - - -# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) - - -### Bug Fixes - -* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) - - - - - -# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) - - -### Bug Fixes - -* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) - - - - - -# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) - - -### Features - -* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) -* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) - - - - - -# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) - - -### Bug Fixes - -* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) -* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) -* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) - - -### Features - -* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) - - - - - -# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) - - -### Bug Fixes - -* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) - - - - - -# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) - - -### Bug Fixes - -* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) -* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) -* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) -* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) - - -### Features - -* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) - - - - - -# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) - - -### Features - -* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) - - - - - -# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) - - -### Features - -* update clients as of 12/12/2020 ([#1771](https://github.com/aws/aws-sdk-js-v3/issues/1771)) ([f69ff44](https://github.com/aws/aws-sdk-js-v3/commit/f69ff440a79018ad69fcb26ad46e3db65b23ce71)) - - - - - -# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) - - -### Bug Fixes - -* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) - - -### Features - -* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) - - - - - -# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) - - -### Features - -* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) - - - - - -# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) - - -### Bug Fixes - -* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) - - - - - -# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) - - -### Features - -* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) - - - - - -# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) - - -### Bug Fixes - -* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) - - - - - -# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) - - -### Features - -* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) - - - - - -# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.9...@aws-sdk/aws-restjson@1.0.0-gamma.10) (2020-10-07) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.8...@aws-sdk/aws-restjson@1.0.0-gamma.9) (2020-09-29) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.7...@aws-sdk/aws-restjson@1.0.0-gamma.8) (2020-09-15) - - -### Bug Fixes - -* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) -* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) - - - - - -# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.6...@aws-sdk/aws-restjson@1.0.0-gamma.7) (2020-09-01) - - -### Features - -* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) - - - - - -# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.5...@aws-sdk/aws-restjson@1.0.0-gamma.6) (2020-08-25) - - -### Features - -* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) -* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) -* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) - - - - - -# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.4...@aws-sdk/aws-restjson@1.0.0-gamma.5) (2020-08-04) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.3...@aws-sdk/aws-restjson@1.0.0-gamma.4) (2020-07-21) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restjson@1.0.0-gamma.2...@aws-sdk/aws-restjson@1.0.0-gamma.3) (2020-07-13) - -**Note:** Version bump only for package @aws-sdk/aws-restjson - - - - - -# 1.0.0-gamma.2 (2020-07-08) - - -### Features - -* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) - - - -# 1.0.0-gamma.2 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.1 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.0 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-beta.0 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-restjson/LICENSE b/protocol_tests/aws-protocoltests-restjson/LICENSE deleted file mode 100644 index dd65ae06be7a..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-restjson/README.md b/protocol_tests/aws-protocoltests-restjson/README.md deleted file mode 100644 index da75b669b9ad..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# @aws-sdk/aws-protocoltests-restjson - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-restjson/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restjson) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-restjson.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restjson) - -## Description - -AWS SDK for JavaScript RestJsonProtocol Client for Node.js, Browser and React Native. - -A REST JSON service that sends JSON requests and responses. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-restjson -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-restjson` -- `yarn add @aws-sdk/aws-protocoltests-restjson` -- `pnpm add @aws-sdk/aws-protocoltests-restjson` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `RestJsonProtocolClient` and -the commands you need, for example `AllQueryStringTypesCommand`: - -```js -// ES5 example -const { RestJsonProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); -``` - -```ts -// ES6+ example -import { RestJsonProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restjson"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new RestJsonProtocolClient({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new AllQueryStringTypesCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-restjson"; -const client = new AWS.RestJsonProtocol({ region: "REGION" }); - -// async/await. -try { - const data = await client.allQueryStringTypes(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .allQueryStringTypes(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.allQueryStringTypes(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-restjson` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-restjson/jest.config.js b/protocol_tests/aws-protocoltests-restjson/jest.config.js deleted file mode 100644 index a8d1c2e49912..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const base = require("../../jest.config.base.js"); - -module.exports = { - ...base, -}; diff --git a/protocol_tests/aws-protocoltests-restjson/package.json b/protocol_tests/aws-protocoltests-restjson/package.json deleted file mode 100644 index 5631187b9631..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-restjson", - "description": "@aws-sdk/aws-protocoltests-restjson client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-blob-browser": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/hash-stream-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/md5-js": "3.38.0", - "@aws-sdk/middleware-apply-body-checksum": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/querystring-builder": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-restjson", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-restjson" - } -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts deleted file mode 100644 index d1dbf27965a8..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocol.ts +++ /dev/null @@ -1,2796 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - AllQueryStringTypesCommand, - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "./commands/AllQueryStringTypesCommand"; -import { - ConstantAndVariableQueryStringCommand, - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "./commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommand, - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "./commands/ConstantQueryStringCommand"; -import { - DocumentTypeAsPayloadCommand, - DocumentTypeAsPayloadCommandInput, - DocumentTypeAsPayloadCommandOutput, -} from "./commands/DocumentTypeAsPayloadCommand"; -import { - DocumentTypeCommand, - DocumentTypeCommandInput, - DocumentTypeCommandOutput, -} from "./commands/DocumentTypeCommand"; -import { - EmptyInputAndEmptyOutputCommand, - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - GreetingWithErrorsCommand, - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, -} from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommand, - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - HttpChecksumRequiredCommand, - HttpChecksumRequiredCommandInput, - HttpChecksumRequiredCommandOutput, -} from "./commands/HttpChecksumRequiredCommand"; -import { - HttpEnumPayloadCommand, - HttpEnumPayloadCommandInput, - HttpEnumPayloadCommandOutput, -} from "./commands/HttpEnumPayloadCommand"; -import { - HttpPayloadTraitsCommand, - HttpPayloadTraitsCommandInput, - HttpPayloadTraitsCommandOutput, -} from "./commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommand, - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithStructureCommand, - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "./commands/HttpPayloadWithStructureCommand"; -import { - HttpPrefixHeadersCommand, - HttpPrefixHeadersCommandInput, - HttpPrefixHeadersCommandOutput, -} from "./commands/HttpPrefixHeadersCommand"; -import { - HttpPrefixHeadersResponseCommand, - HttpPrefixHeadersResponseCommandInput, - HttpPrefixHeadersResponseCommandOutput, -} from "./commands/HttpPrefixHeadersResponseCommand"; -import { - HttpRequestWithFloatLabelsCommand, - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "./commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommand, - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommand, - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommand, - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "./commands/HttpRequestWithLabelsCommand"; -import { - HttpResponseCodeCommand, - HttpResponseCodeCommandInput, - HttpResponseCodeCommandOutput, -} from "./commands/HttpResponseCodeCommand"; -import { - HttpStringPayloadCommand, - HttpStringPayloadCommandInput, - HttpStringPayloadCommandOutput, -} from "./commands/HttpStringPayloadCommand"; -import { - IgnoreQueryParamsInResponseCommand, - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "./commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommand, - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "./commands/InputAndOutputWithHeadersCommand"; -import { JsonBlobsCommand, JsonBlobsCommandInput, JsonBlobsCommandOutput } from "./commands/JsonBlobsCommand"; -import { JsonEnumsCommand, JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; -import { JsonListsCommand, JsonListsCommandInput, JsonListsCommandOutput } from "./commands/JsonListsCommand"; -import { JsonMapsCommand, JsonMapsCommandInput, JsonMapsCommandOutput } from "./commands/JsonMapsCommand"; -import { - JsonTimestampsCommand, - JsonTimestampsCommandInput, - 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, - MediaTypeHeaderCommandOutput, -} from "./commands/MediaTypeHeaderCommand"; -import { - NoInputAndNoOutputCommand, - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, -} from "./commands/NoInputAndNoOutputCommand"; -import { - NoInputAndOutputCommand, - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, -} from "./commands/NoInputAndOutputCommand"; -import { - NullAndEmptyHeadersClientCommand, - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "./commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommand, - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "./commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommand, - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "./commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommand, - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommand, - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "./commands/QueryParamsAsStringListMapCommand"; -import { - QueryPrecedenceCommand, - QueryPrecedenceCommandInput, - QueryPrecedenceCommandOutput, -} from "./commands/QueryPrecedenceCommand"; -import { - RecursiveShapesCommand, - RecursiveShapesCommandInput, - RecursiveShapesCommandOutput, -} from "./commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommand, - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { - StreamingTraitsCommand, - StreamingTraitsCommandInput, - StreamingTraitsCommandOutput, -} from "./commands/StreamingTraitsCommand"; -import { - StreamingTraitsRequireLengthCommand, - StreamingTraitsRequireLengthCommandInput, - StreamingTraitsRequireLengthCommandOutput, -} from "./commands/StreamingTraitsRequireLengthCommand"; -import { - StreamingTraitsWithMediaTypeCommand, - StreamingTraitsWithMediaTypeCommandInput, - StreamingTraitsWithMediaTypeCommandOutput, -} from "./commands/StreamingTraitsWithMediaTypeCommand"; -import { - TimestampFormatHeadersCommand, - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "./commands/TimestampFormatHeadersCommand"; -import { RestJsonProtocolClient } from "./RestJsonProtocolClient"; - -/** - * A REST JSON service that sends JSON requests and responses. - */ -export class RestJsonProtocol extends RestJsonProtocolClient { - /** - * This example uses all query string types. - */ - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): void; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): void; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AllQueryStringTypesCommandOutput) => void), - cb?: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): Promise | void { - const command = new AllQueryStringTypesCommand(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 uses fixed query string params and variable query string params. - * The fixed query string parameters and variable parameters must both be - * serialized (implementations may need to merge them together). - */ - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): void; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): void; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void), - cb?: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): Promise | void { - const command = new ConstantAndVariableQueryStringCommand(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 uses a constant query string parameters and a label. - * This simply tests that labels and query string parameters are - * compatible. The fixed query string parameter named "hello" should - * in no way conflict with the label, `{hello}`. - */ - public constantQueryString( - args: ConstantQueryStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public constantQueryString( - args: ConstantQueryStringCommandInput, - cb: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): void; - public constantQueryString( - args: ConstantQueryStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): void; - public constantQueryString( - args: ConstantQueryStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantQueryStringCommandOutput) => void), - cb?: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): Promise | void { - const command = new ConstantQueryStringCommand(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 a document as part of the payload. - */ - public documentType( - args: DocumentTypeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public documentType(args: DocumentTypeCommandInput, cb: (err: any, data?: DocumentTypeCommandOutput) => void): void; - public documentType( - args: DocumentTypeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: DocumentTypeCommandOutput) => void - ): void; - public documentType( - args: DocumentTypeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DocumentTypeCommandOutput) => void), - cb?: (err: any, data?: DocumentTypeCommandOutput) => void - ): Promise | void { - const command = new DocumentTypeCommand(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 a document as the entire HTTP payload. - */ - public documentTypeAsPayload( - args: DocumentTypeAsPayloadCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public documentTypeAsPayload( - args: DocumentTypeAsPayloadCommandInput, - cb: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void - ): void; - public documentTypeAsPayload( - args: DocumentTypeAsPayloadCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void - ): void; - public documentTypeAsPayload( - args: DocumentTypeAsPayloadCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DocumentTypeAsPayloadCommandOutput) => void), - cb?: (err: any, data?: DocumentTypeAsPayloadCommandOutput) => void - ): Promise | void { - const command = new DocumentTypeAsPayloadCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - */ - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), - cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): Promise | void { - const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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 has four possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * 4. A FooError. - * - * Implementations must be able to successfully take a response and - * properly (de)serialize successful and error responses based on the - * the presence of the - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 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 tests httpChecksumRequired trait - */ - public httpChecksumRequired( - args: HttpChecksumRequiredCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpChecksumRequired( - args: HttpChecksumRequiredCommandInput, - cb: (err: any, data?: HttpChecksumRequiredCommandOutput) => void - ): void; - public httpChecksumRequired( - args: HttpChecksumRequiredCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpChecksumRequiredCommandOutput) => void - ): void; - public httpChecksumRequired( - args: HttpChecksumRequiredCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpChecksumRequiredCommandOutput) => void), - cb?: (err: any, data?: HttpChecksumRequiredCommandOutput) => void - ): Promise | void { - const command = new HttpChecksumRequiredCommand(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 httpEnumPayload( - args: HttpEnumPayloadCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpEnumPayload( - args: HttpEnumPayloadCommandInput, - cb: (err: any, data?: HttpEnumPayloadCommandOutput) => void - ): void; - public httpEnumPayload( - args: HttpEnumPayloadCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpEnumPayloadCommandOutput) => void - ): void; - public httpEnumPayload( - args: HttpEnumPayloadCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpEnumPayloadCommandOutput) => void), - cb?: (err: any, data?: HttpEnumPayloadCommandOutput) => void - ): Promise | void { - const command = new HttpEnumPayloadCommand(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 examples serializes a blob shape in the payload. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - */ - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): void; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): void; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadTraitsCommand(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 examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - */ - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): void; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): void; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadTraitsWithMediaTypeCommand(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 examples serializes a structure in the payload. - * - * Note that serializing a structure changes the wrapper element name - * to match the targeted structure. - */ - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): void; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): void; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithStructureCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithStructureCommand(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 examples adds headers to the input of a request and response by prefix. - */ - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): void; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): void; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersCommandOutput) => void), - cb?: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): Promise | void { - const command = new HttpPrefixHeadersCommand(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); - } - } - - /** - * Clients that perform this test extract all headers from the response. - */ - public httpPrefixHeadersResponse( - args: HttpPrefixHeadersResponseCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPrefixHeadersResponse( - args: HttpPrefixHeadersResponseCommandInput, - cb: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void - ): void; - public httpPrefixHeadersResponse( - args: HttpPrefixHeadersResponseCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void - ): void; - public httpPrefixHeadersResponse( - args: HttpPrefixHeadersResponseCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void), - cb?: (err: any, data?: HttpPrefixHeadersResponseCommandOutput) => void - ): Promise | void { - const command = new HttpPrefixHeadersResponseCommand(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 httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): void; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): void; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithFloatLabelsCommand(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 httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): void; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): void; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithGreedyLabelInPathCommand(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 example tests how requests are serialized when there's no input - * payload but there are HTTP labels. - */ - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): void; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): void; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithLabelsCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithLabelsCommand(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 example tests how requests serialize different timestamp formats in the - * URI path. - */ - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): void; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): void; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - optionsOrCb?: - | __HttpHandlerOptions - | ((err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithLabelsAndTimestampFormatCommand(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 httpResponseCode( - args: HttpResponseCodeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - cb: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): void; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): void; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpResponseCodeCommandOutput) => void), - cb?: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): Promise | void { - const command = new HttpResponseCodeCommand(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 httpStringPayload( - args: HttpStringPayloadCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpStringPayload( - args: HttpStringPayloadCommandInput, - cb: (err: any, data?: HttpStringPayloadCommandOutput) => void - ): void; - public httpStringPayload( - args: HttpStringPayloadCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpStringPayloadCommandOutput) => void - ): void; - public httpStringPayload( - args: HttpStringPayloadCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpStringPayloadCommandOutput) => void), - cb?: (err: any, data?: HttpStringPayloadCommandOutput) => void - ): Promise | void { - const command = new HttpStringPayloadCommand(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 query string bound request parameters are - * serialized in the body of responses if the structure is used in both - * the request and response. - */ - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): void; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): void; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void), - cb?: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): Promise | void { - const command = new IgnoreQueryParamsInResponseCommand(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 example tests how requests and responses are serialized when there is - * no input or output payload but there are HTTP header bindings. - */ - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): void; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): void; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: InputAndOutputWithHeadersCommandOutput) => void), - cb?: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): Promise | void { - const command = new InputAndOutputWithHeadersCommand(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); - } - } - - /** - * Blobs are base64 encoded - */ - public jsonBlobs(args: JsonBlobsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonBlobs(args: JsonBlobsCommandInput, cb: (err: any, data?: JsonBlobsCommandOutput) => void): void; - public jsonBlobs( - args: JsonBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonBlobsCommandOutput) => void - ): void; - public jsonBlobs( - args: JsonBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonBlobsCommandOutput) => void), - cb?: (err: any, data?: JsonBlobsCommandOutput) => void - ): Promise | void { - const command = new JsonBlobsCommand(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. - */ - public jsonEnums(args: JsonEnumsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonEnums(args: JsonEnumsCommandInput, cb: (err: any, data?: JsonEnumsCommandOutput) => void): void; - public jsonEnums( - args: JsonEnumsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonEnumsCommandOutput) => void - ): void; - public jsonEnums( - args: JsonEnumsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonEnumsCommandOutput) => void), - cb?: (err: any, data?: JsonEnumsCommandOutput) => void - ): Promise | void { - const command = new JsonEnumsCommand(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 test case serializes JSON lists for the following cases for both - * input and output: - * - * 1. Normal JSON lists. - * 2. Normal JSON sets. - * 3. JSON lists of lists. - * 4. Lists of structures. - */ - public jsonLists(args: JsonListsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonLists(args: JsonListsCommandInput, cb: (err: any, data?: JsonListsCommandOutput) => void): void; - public jsonLists( - args: JsonListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonListsCommandOutput) => void - ): void; - public jsonLists( - args: JsonListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonListsCommandOutput) => void), - cb?: (err: any, data?: JsonListsCommandOutput) => void - ): Promise | void { - const command = new JsonListsCommand(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 example tests basic map serialization. - */ - public jsonMaps(args: JsonMapsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonMaps(args: JsonMapsCommandInput, cb: (err: any, data?: JsonMapsCommandOutput) => void): void; - public jsonMaps( - args: JsonMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonMapsCommandOutput) => void - ): void; - public jsonMaps( - args: JsonMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonMapsCommandOutput) => void), - cb?: (err: any, data?: JsonMapsCommandOutput) => void - ): Promise | void { - const command = new JsonMapsCommand(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 tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - */ - public jsonTimestamps( - args: JsonTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public jsonTimestamps( - args: JsonTimestampsCommandInput, - cb: (err: any, data?: JsonTimestampsCommandOutput) => void - ): void; - public jsonTimestamps( - args: JsonTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonTimestampsCommandOutput) => void - ): void; - public jsonTimestamps( - args: JsonTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonTimestampsCommandOutput) => void), - cb?: (err: any, data?: JsonTimestampsCommandOutput) => void - ): Promise | void { - const command = new JsonTimestampsCommand(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. - */ - public jsonUnions(args: JsonUnionsCommandInput, options?: __HttpHandlerOptions): Promise; - public jsonUnions(args: JsonUnionsCommandInput, cb: (err: any, data?: JsonUnionsCommandOutput) => void): void; - public jsonUnions( - args: JsonUnionsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: JsonUnionsCommandOutput) => void - ): void; - public jsonUnions( - args: JsonUnionsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: JsonUnionsCommandOutput) => void), - cb?: (err: any, data?: JsonUnionsCommandOutput) => void - ): Promise | void { - const command = new JsonUnionsCommand(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 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. - */ - public mediaTypeHeader( - args: MediaTypeHeaderCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public mediaTypeHeader( - args: MediaTypeHeaderCommandInput, - cb: (err: any, data?: MediaTypeHeaderCommandOutput) => void - ): void; - public mediaTypeHeader( - args: MediaTypeHeaderCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: MediaTypeHeaderCommandOutput) => void - ): void; - public mediaTypeHeader( - args: MediaTypeHeaderCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: MediaTypeHeaderCommandOutput) => void), - cb?: (err: any, data?: MediaTypeHeaderCommandOutput) => void - ): Promise | void { - const command = new MediaTypeHeaderCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - */ - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - */ - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndOutputCommand(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); - } - } - - /** - * Null and empty headers are not sent over the wire. - */ - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): void; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): void; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void), - cb?: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): Promise | void { - const command = new NullAndEmptyHeadersClientCommand(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); - } - } - - /** - * Null and empty headers are not sent over the wire. - */ - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): void; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): void; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void), - cb?: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): Promise | void { - const command = new NullAndEmptyHeadersServerCommand(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); - } - } - - /** - * Omits null, but serializes empty string value. - */ - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): void; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): void; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void), - cb?: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): Promise | void { - const command = new OmitsNullSerializesEmptyStringCommand(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); - } - } - - /** - * Automatically adds idempotency tokens. - */ - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), - cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): Promise | void { - const command = new QueryIdempotencyTokenAutoFillCommand(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 queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): void; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): void; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryParamsAsStringListMapCommandOutput) => void), - cb?: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): Promise | void { - const command = new QueryParamsAsStringListMapCommand(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 queryPrecedence( - args: QueryPrecedenceCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - cb: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): void; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): void; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryPrecedenceCommandOutput) => void), - cb?: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): Promise | void { - const command = new QueryPrecedenceCommand(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); - } - } - - /** - * Recursive shapes - */ - public recursiveShapes( - args: RecursiveShapesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public recursiveShapes( - args: RecursiveShapesCommandInput, - cb: (err: any, data?: RecursiveShapesCommandOutput) => void - ): void; - public recursiveShapes( - args: RecursiveShapesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: RecursiveShapesCommandOutput) => void - ): void; - public recursiveShapes( - args: RecursiveShapesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveShapesCommandOutput) => void), - cb?: (err: any, data?: RecursiveShapesCommandOutput) => void - ): Promise | void { - const command = new RecursiveShapesCommand(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 simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarPropertiesCommand(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 examples serializes a streaming blob shape in the request body. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - */ - public streamingTraits( - args: StreamingTraitsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public streamingTraits( - args: StreamingTraitsCommandInput, - cb: (err: any, data?: StreamingTraitsCommandOutput) => void - ): void; - public streamingTraits( - args: StreamingTraitsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: StreamingTraitsCommandOutput) => void - ): void; - public streamingTraits( - args: StreamingTraitsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsCommandOutput) => void), - cb?: (err: any, data?: StreamingTraitsCommandOutput) => void - ): Promise | void { - const command = new StreamingTraitsCommand(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 examples serializes a streaming blob shape with a required content - * length in the request body. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - */ - public streamingTraitsRequireLength( - args: StreamingTraitsRequireLengthCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public streamingTraitsRequireLength( - args: StreamingTraitsRequireLengthCommandInput, - cb: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void - ): void; - public streamingTraitsRequireLength( - args: StreamingTraitsRequireLengthCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void - ): void; - public streamingTraitsRequireLength( - args: StreamingTraitsRequireLengthCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void), - cb?: (err: any, data?: StreamingTraitsRequireLengthCommandOutput) => void - ): Promise | void { - const command = new StreamingTraitsRequireLengthCommand(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 examples serializes a streaming media-typed blob shape in the request body. - * - * This examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - */ - public streamingTraitsWithMediaType( - args: StreamingTraitsWithMediaTypeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public streamingTraitsWithMediaType( - args: StreamingTraitsWithMediaTypeCommandInput, - cb: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void - ): void; - public streamingTraitsWithMediaType( - args: StreamingTraitsWithMediaTypeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void - ): void; - public streamingTraitsWithMediaType( - args: StreamingTraitsWithMediaTypeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void), - cb?: (err: any, data?: StreamingTraitsWithMediaTypeCommandOutput) => void - ): Promise | void { - const command = new StreamingTraitsWithMediaTypeCommand(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 tests how timestamp request and response headers are serialized. - */ - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): void; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): void; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TimestampFormatHeadersCommandOutput) => void), - cb?: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): Promise | void { - const command = new TimestampFormatHeadersCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts b/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts deleted file mode 100644 index c59738cacb33..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts +++ /dev/null @@ -1,605 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - StreamHasher as __StreamHasher, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; -import { Readable } from "stream"; - -import { - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "./commands/AllQueryStringTypesCommand"; -import { - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "./commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "./commands/ConstantQueryStringCommand"; -import { - DocumentTypeAsPayloadCommandInput, - DocumentTypeAsPayloadCommandOutput, -} from "./commands/DocumentTypeAsPayloadCommand"; -import { DocumentTypeCommandInput, DocumentTypeCommandOutput } from "./commands/DocumentTypeCommand"; -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "./commands/HostWithPathOperationCommand"; -import { - HttpChecksumRequiredCommandInput, - HttpChecksumRequiredCommandOutput, -} from "./commands/HttpChecksumRequiredCommand"; -import { HttpEnumPayloadCommandInput, HttpEnumPayloadCommandOutput } from "./commands/HttpEnumPayloadCommand"; -import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "./commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "./commands/HttpPayloadWithStructureCommand"; -import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "./commands/HttpPrefixHeadersCommand"; -import { - HttpPrefixHeadersResponseCommandInput, - HttpPrefixHeadersResponseCommandOutput, -} from "./commands/HttpPrefixHeadersResponseCommand"; -import { - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "./commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "./commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "./commands/HttpResponseCodeCommand"; -import { HttpStringPayloadCommandInput, HttpStringPayloadCommandOutput } from "./commands/HttpStringPayloadCommand"; -import { - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "./commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "./commands/InputAndOutputWithHeadersCommand"; -import { JsonBlobsCommandInput, JsonBlobsCommandOutput } from "./commands/JsonBlobsCommand"; -import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "./commands/JsonEnumsCommand"; -import { JsonListsCommandInput, JsonListsCommandOutput } from "./commands/JsonListsCommand"; -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"; -import { - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "./commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "./commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "./commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "./commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "./commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "./commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { StreamingTraitsCommandInput, StreamingTraitsCommandOutput } from "./commands/StreamingTraitsCommand"; -import { - StreamingTraitsRequireLengthCommandInput, - StreamingTraitsRequireLengthCommandOutput, -} from "./commands/StreamingTraitsRequireLengthCommand"; -import { - StreamingTraitsWithMediaTypeCommandInput, - StreamingTraitsWithMediaTypeCommandOutput, -} from "./commands/StreamingTraitsWithMediaTypeCommand"; -import { - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "./commands/TimestampFormatHeadersCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | AllQueryStringTypesCommandInput - | ConstantAndVariableQueryStringCommandInput - | ConstantQueryStringCommandInput - | DocumentTypeAsPayloadCommandInput - | DocumentTypeCommandInput - | EmptyInputAndEmptyOutputCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | GreetingWithErrorsCommandInput - | HostWithPathOperationCommandInput - | HttpChecksumRequiredCommandInput - | HttpEnumPayloadCommandInput - | HttpPayloadTraitsCommandInput - | HttpPayloadTraitsWithMediaTypeCommandInput - | HttpPayloadWithStructureCommandInput - | HttpPrefixHeadersCommandInput - | HttpPrefixHeadersResponseCommandInput - | HttpRequestWithFloatLabelsCommandInput - | HttpRequestWithGreedyLabelInPathCommandInput - | HttpRequestWithLabelsAndTimestampFormatCommandInput - | HttpRequestWithLabelsCommandInput - | HttpResponseCodeCommandInput - | HttpStringPayloadCommandInput - | IgnoreQueryParamsInResponseCommandInput - | InputAndOutputWithHeadersCommandInput - | JsonBlobsCommandInput - | JsonEnumsCommandInput - | JsonListsCommandInput - | 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 - | NullAndEmptyHeadersClientCommandInput - | NullAndEmptyHeadersServerCommandInput - | OmitsNullSerializesEmptyStringCommandInput - | QueryIdempotencyTokenAutoFillCommandInput - | QueryParamsAsStringListMapCommandInput - | QueryPrecedenceCommandInput - | RecursiveShapesCommandInput - | SimpleScalarPropertiesCommandInput - | StreamingTraitsCommandInput - | StreamingTraitsRequireLengthCommandInput - | StreamingTraitsWithMediaTypeCommandInput - | TimestampFormatHeadersCommandInput; - -export type ServiceOutputTypes = - | AllQueryStringTypesCommandOutput - | ConstantAndVariableQueryStringCommandOutput - | ConstantQueryStringCommandOutput - | DocumentTypeAsPayloadCommandOutput - | DocumentTypeCommandOutput - | EmptyInputAndEmptyOutputCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | GreetingWithErrorsCommandOutput - | HostWithPathOperationCommandOutput - | HttpChecksumRequiredCommandOutput - | HttpEnumPayloadCommandOutput - | HttpPayloadTraitsCommandOutput - | HttpPayloadTraitsWithMediaTypeCommandOutput - | HttpPayloadWithStructureCommandOutput - | HttpPrefixHeadersCommandOutput - | HttpPrefixHeadersResponseCommandOutput - | HttpRequestWithFloatLabelsCommandOutput - | HttpRequestWithGreedyLabelInPathCommandOutput - | HttpRequestWithLabelsAndTimestampFormatCommandOutput - | HttpRequestWithLabelsCommandOutput - | HttpResponseCodeCommandOutput - | HttpStringPayloadCommandOutput - | IgnoreQueryParamsInResponseCommandOutput - | InputAndOutputWithHeadersCommandOutput - | JsonBlobsCommandOutput - | JsonEnumsCommandOutput - | JsonListsCommandOutput - | 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 - | NullAndEmptyHeadersClientCommandOutput - | NullAndEmptyHeadersServerCommandOutput - | OmitsNullSerializesEmptyStringCommandOutput - | QueryIdempotencyTokenAutoFillCommandOutput - | QueryParamsAsStringListMapCommandOutput - | QueryPrecedenceCommandOutput - | RecursiveShapesCommandOutput - | SimpleScalarPropertiesCommandOutput - | StreamingTraitsCommandOutput - | StreamingTraitsRequireLengthCommandOutput - | StreamingTraitsWithMediaTypeCommandOutput - | TimestampFormatHeadersCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; - - /** - * A function that, given a hash constructor and a stream, calculates the - * hash of the streamed value. - * @internal - */ - streamHasher?: __StreamHasher | __StreamHasher; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes MD5 hashes. - * @internal - */ - md5?: __HashConstructor; -} - -type RestJsonProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of RestJsonProtocolClient class constructor that set the region, credentials and other options. - */ -export interface RestJsonProtocolClientConfig extends RestJsonProtocolClientConfigType {} - -type RestJsonProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of RestJsonProtocolClient class. This is resolved and normalized from the {@link RestJsonProtocolClientConfig | constructor configuration interface}. - */ -export interface RestJsonProtocolClientResolvedConfig extends RestJsonProtocolClientResolvedConfigType {} - -/** - * A REST JSON service that sends JSON requests and responses. - */ -export class RestJsonProtocolClient extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - RestJsonProtocolClientResolvedConfig -> { - /** - * The resolved configuration of RestJsonProtocolClient class. This is resolved and normalized from the {@link RestJsonProtocolClientConfig | constructor configuration interface}. - */ - readonly config: RestJsonProtocolClientResolvedConfig; - - constructor(configuration: RestJsonProtocolClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveUserAgentConfig(_config_4); - super(_config_5); - this.config = _config_5; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts deleted file mode 100644 index 086e9d19fe4c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/AllQueryStringTypesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { AllQueryStringTypesInput } from "../models/models_0"; -import { - deserializeAws_restJson1AllQueryStringTypesCommand, - serializeAws_restJson1AllQueryStringTypesCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface AllQueryStringTypesCommandInput extends AllQueryStringTypesInput {} -export interface AllQueryStringTypesCommandOutput extends __MetadataBearer {} - -/** - * This example uses all query string types. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new AllQueryStringTypesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link AllQueryStringTypesCommandInput} for command's `input` shape. - * @see {@link AllQueryStringTypesCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class AllQueryStringTypesCommand extends $Command< - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: AllQueryStringTypesCommandInput) { - // 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 = "AllQueryStringTypesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: AllQueryStringTypesInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: AllQueryStringTypesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1AllQueryStringTypesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1AllQueryStringTypesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts deleted file mode 100644 index 9fa021d052b2..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantAndVariableQueryStringCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { ConstantAndVariableQueryStringInput } from "../models/models_0"; -import { - deserializeAws_restJson1ConstantAndVariableQueryStringCommand, - serializeAws_restJson1ConstantAndVariableQueryStringCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface ConstantAndVariableQueryStringCommandInput extends ConstantAndVariableQueryStringInput {} -export interface ConstantAndVariableQueryStringCommandOutput extends __MetadataBearer {} - -/** - * This example uses fixed query string params and variable query string params. - * The fixed query string parameters and variable parameters must both be - * serialized (implementations may need to merge them together). - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, ConstantAndVariableQueryStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, ConstantAndVariableQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new ConstantAndVariableQueryStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link ConstantAndVariableQueryStringCommandInput} for command's `input` shape. - * @see {@link ConstantAndVariableQueryStringCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class ConstantAndVariableQueryStringCommand extends $Command< - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: ConstantAndVariableQueryStringCommandInput) { - // 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 = "ConstantAndVariableQueryStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: ConstantAndVariableQueryStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: ConstantAndVariableQueryStringCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1ConstantAndVariableQueryStringCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1ConstantAndVariableQueryStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts deleted file mode 100644 index 67e82e6ab301..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/ConstantQueryStringCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { ConstantQueryStringInput } from "../models/models_0"; -import { - deserializeAws_restJson1ConstantQueryStringCommand, - serializeAws_restJson1ConstantQueryStringCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface ConstantQueryStringCommandInput extends ConstantQueryStringInput {} -export interface ConstantQueryStringCommandOutput extends __MetadataBearer {} - -/** - * This example uses a constant query string parameters and a label. - * This simply tests that labels and query string parameters are - * compatible. The fixed query string parameter named "hello" should - * in no way conflict with the label, `{hello}`. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, ConstantQueryStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, ConstantQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new ConstantQueryStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link ConstantQueryStringCommandInput} for command's `input` shape. - * @see {@link ConstantQueryStringCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class ConstantQueryStringCommand extends $Command< - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: ConstantQueryStringCommandInput) { - // 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 = "ConstantQueryStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: ConstantQueryStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: ConstantQueryStringCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1ConstantQueryStringCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1ConstantQueryStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts deleted file mode 100644 index 5b8751cdf867..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeAsPayloadCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { DocumentTypeAsPayloadInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1DocumentTypeAsPayloadCommand, - serializeAws_restJson1DocumentTypeAsPayloadCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface DocumentTypeAsPayloadCommandInput extends DocumentTypeAsPayloadInputOutput {} -export interface DocumentTypeAsPayloadCommandOutput extends DocumentTypeAsPayloadInputOutput, __MetadataBearer {} - -/** - * This example serializes a document as the entire HTTP payload. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, DocumentTypeAsPayloadCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, DocumentTypeAsPayloadCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new DocumentTypeAsPayloadCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link DocumentTypeAsPayloadCommandInput} for command's `input` shape. - * @see {@link DocumentTypeAsPayloadCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class DocumentTypeAsPayloadCommand extends $Command< - DocumentTypeAsPayloadCommandInput, - DocumentTypeAsPayloadCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: DocumentTypeAsPayloadCommandInput) { - // 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 = "DocumentTypeAsPayloadCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: DocumentTypeAsPayloadInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: DocumentTypeAsPayloadInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: DocumentTypeAsPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1DocumentTypeAsPayloadCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1DocumentTypeAsPayloadCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts deleted file mode 100644 index 0f1352469230..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/DocumentTypeCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { DocumentTypeInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1DocumentTypeCommand, - serializeAws_restJson1DocumentTypeCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface DocumentTypeCommandInput extends DocumentTypeInputOutput {} -export interface DocumentTypeCommandOutput extends DocumentTypeInputOutput, __MetadataBearer {} - -/** - * This example serializes a document as part of the payload. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, DocumentTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, DocumentTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new DocumentTypeCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link DocumentTypeCommandInput} for command's `input` shape. - * @see {@link DocumentTypeCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class DocumentTypeCommand extends $Command< - DocumentTypeCommandInput, - DocumentTypeCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: DocumentTypeCommandInput) { - // 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 = "DocumentTypeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: DocumentTypeInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: DocumentTypeInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: DocumentTypeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1DocumentTypeCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1DocumentTypeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts deleted file mode 100644 index 24f726b44100..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/EmptyInputAndEmptyOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1EmptyInputAndEmptyOutputCommand, - serializeAws_restJson1EmptyInputAndEmptyOutputCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} -export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new EmptyInputAndEmptyOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. - * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class EmptyInputAndEmptyOutputCommand extends $Command< - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { - // 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 = "EmptyInputAndEmptyOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1EmptyInputAndEmptyOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1EmptyInputAndEmptyOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index f334f5451db5..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_restJson1EndpointOperationCommand, - serializeAws_restJson1EndpointOperationCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // 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 = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1EndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1EndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index 0e06aa0d5fbc..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_restJson1EndpointWithHostLabelOperationCommand, - serializeAws_restJson1EndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // 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 = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1EndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1EndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index d752fcf6af4b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,104 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_restJson1GreetingWithErrorsCommand, - serializeAws_restJson1GreetingWithErrorsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has four possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * 4. A FooError. - * - * Implementations must be able to successfully take a response and - * properly (de)serialize successful and error responses based on the - * the presence of the - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // 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 = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1GreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1GreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts deleted file mode 100644 index f21860180d6b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HostWithPathOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_restJson1HostWithPathOperationCommand, - serializeAws_restJson1HostWithPathOperationCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HostWithPathOperationCommandInput {} -export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} - -export class HostWithPathOperationCommand extends $Command< - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // 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: 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 = "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_restJson1HostWithPathOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HostWithPathOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts deleted file mode 100644 index b36be66e0461..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpChecksumRequiredCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { getApplyMd5BodyChecksumPlugin } from "@aws-sdk/middleware-apply-body-checksum"; -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 { HttpChecksumRequiredInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpChecksumRequiredCommand, - serializeAws_restJson1HttpChecksumRequiredCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpChecksumRequiredCommandInput extends HttpChecksumRequiredInputOutput {} -export interface HttpChecksumRequiredCommandOutput extends HttpChecksumRequiredInputOutput, __MetadataBearer {} - -/** - * This example tests httpChecksumRequired trait - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpChecksumRequiredCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpChecksumRequiredCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpChecksumRequiredCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpChecksumRequiredCommandInput} for command's `input` shape. - * @see {@link HttpChecksumRequiredCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpChecksumRequiredCommand extends $Command< - HttpChecksumRequiredCommandInput, - HttpChecksumRequiredCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpChecksumRequiredCommandInput) { - // 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)); - this.middlewareStack.use(getApplyMd5BodyChecksumPlugin(configuration)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestJsonProtocolClient"; - const commandName = "HttpChecksumRequiredCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpChecksumRequiredInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpChecksumRequiredInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpChecksumRequiredCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpChecksumRequiredCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpChecksumRequiredCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts deleted file mode 100644 index 53f57c4ddc6a..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpEnumPayloadCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { EnumPayloadInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpEnumPayloadCommand, - serializeAws_restJson1HttpEnumPayloadCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpEnumPayloadCommandInput extends EnumPayloadInput {} -export interface HttpEnumPayloadCommandOutput extends EnumPayloadInput, __MetadataBearer {} - -export class HttpEnumPayloadCommand extends $Command< - HttpEnumPayloadCommandInput, - HttpEnumPayloadCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpEnumPayloadCommandInput) { - // 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 = "HttpEnumPayloadCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EnumPayloadInput.filterSensitiveLog, - outputFilterSensitiveLog: EnumPayloadInput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpEnumPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpEnumPayloadCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpEnumPayloadCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts deleted file mode 100644 index e92db52fc102..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { HttpPayloadTraitsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpPayloadTraitsCommand, - serializeAws_restJson1HttpPayloadTraitsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpPayloadTraitsCommandInput extends HttpPayloadTraitsInputOutput {} -export interface HttpPayloadTraitsCommandOutput extends HttpPayloadTraitsInputOutput, __MetadataBearer {} - -/** - * This examples serializes a blob shape in the payload. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpPayloadTraitsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpPayloadTraitsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpPayloadTraitsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadTraitsCommandInput} for command's `input` shape. - * @see {@link HttpPayloadTraitsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadTraitsCommand extends $Command< - HttpPayloadTraitsCommandInput, - HttpPayloadTraitsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadTraitsCommandInput) { - // 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 = "HttpPayloadTraitsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpPayloadTraitsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpPayloadTraitsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts deleted file mode 100644 index 2b8bd6eba142..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts +++ /dev/null @@ -1,104 +0,0 @@ -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 { HttpPayloadTraitsWithMediaTypeInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand, - serializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpPayloadTraitsWithMediaTypeCommandInput extends HttpPayloadTraitsWithMediaTypeInputOutput {} -export interface HttpPayloadTraitsWithMediaTypeCommandOutput - extends HttpPayloadTraitsWithMediaTypeInputOutput, - __MetadataBearer {} - -/** - * This examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpPayloadTraitsWithMediaTypeCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadTraitsWithMediaTypeCommandInput} for command's `input` shape. - * @see {@link HttpPayloadTraitsWithMediaTypeCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadTraitsWithMediaTypeCommand extends $Command< - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadTraitsWithMediaTypeCommandInput) { - // 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 = "HttpPayloadTraitsWithMediaTypeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpPayloadTraitsWithMediaTypeCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts deleted file mode 100644 index 1128967853b9..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPayloadWithStructureCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { HttpPayloadWithStructureInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpPayloadWithStructureCommand, - serializeAws_restJson1HttpPayloadWithStructureCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpPayloadWithStructureCommandInput extends HttpPayloadWithStructureInputOutput {} -export interface HttpPayloadWithStructureCommandOutput extends HttpPayloadWithStructureInputOutput, __MetadataBearer {} - -/** - * This examples serializes a structure in the payload. - * - * Note that serializing a structure changes the wrapper element name - * to match the targeted structure. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpPayloadWithStructureCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpPayloadWithStructureCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpPayloadWithStructureCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithStructureCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithStructureCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithStructureCommand extends $Command< - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithStructureCommandInput) { - // 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 = "HttpPayloadWithStructureCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadWithStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpPayloadWithStructureCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpPayloadWithStructureCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts deleted file mode 100644 index 26f4f0e3616c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { HttpPrefixHeadersInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpPrefixHeadersCommand, - serializeAws_restJson1HttpPrefixHeadersCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpPrefixHeadersCommandInput extends HttpPrefixHeadersInputOutput {} -export interface HttpPrefixHeadersCommandOutput extends HttpPrefixHeadersInputOutput, __MetadataBearer {} - -/** - * This examples adds headers to the input of a request and response by prefix. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpPrefixHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpPrefixHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpPrefixHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPrefixHeadersCommandInput} for command's `input` shape. - * @see {@link HttpPrefixHeadersCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPrefixHeadersCommand extends $Command< - HttpPrefixHeadersCommandInput, - HttpPrefixHeadersCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPrefixHeadersCommandInput) { - // 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 = "HttpPrefixHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPrefixHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpPrefixHeadersCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpPrefixHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts deleted file mode 100644 index 4aa93c192d3c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpPrefixHeadersResponseCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { HttpPrefixHeadersResponseOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpPrefixHeadersResponseCommand, - serializeAws_restJson1HttpPrefixHeadersResponseCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpPrefixHeadersResponseCommandInput {} -export interface HttpPrefixHeadersResponseCommandOutput extends HttpPrefixHeadersResponseOutput, __MetadataBearer {} - -/** - * Clients that perform this test extract all headers from the response. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpPrefixHeadersResponseCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpPrefixHeadersResponseCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpPrefixHeadersResponseCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPrefixHeadersResponseCommandInput} for command's `input` shape. - * @see {@link HttpPrefixHeadersResponseCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPrefixHeadersResponseCommand extends $Command< - HttpPrefixHeadersResponseCommandInput, - HttpPrefixHeadersResponseCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPrefixHeadersResponseCommandInput) { - // 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 = "HttpPrefixHeadersResponseCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: HttpPrefixHeadersResponseOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPrefixHeadersResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpPrefixHeadersResponseCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1HttpPrefixHeadersResponseCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts deleted file mode 100644 index 0bf39efae04c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithFloatLabelsCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { HttpRequestWithFloatLabelsInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpRequestWithFloatLabelsCommand, - serializeAws_restJson1HttpRequestWithFloatLabelsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpRequestWithFloatLabelsCommandInput extends HttpRequestWithFloatLabelsInput {} -export interface HttpRequestWithFloatLabelsCommandOutput extends __MetadataBearer {} - -export class HttpRequestWithFloatLabelsCommand extends $Command< - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithFloatLabelsCommandInput) { - // 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 = "HttpRequestWithFloatLabelsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithFloatLabelsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpRequestWithFloatLabelsCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1HttpRequestWithFloatLabelsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts deleted file mode 100644 index 8dbe6577af22..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HttpRequestWithGreedyLabelInPathInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand, - serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpRequestWithGreedyLabelInPathCommandInput extends HttpRequestWithGreedyLabelInPathInput {} -export interface HttpRequestWithGreedyLabelInPathCommandOutput extends __MetadataBearer {} - -export class HttpRequestWithGreedyLabelInPathCommand extends $Command< - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithGreedyLabelInPathCommandInput) { - // 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 = "HttpRequestWithGreedyLabelInPathCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithGreedyLabelInPathInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpRequestWithGreedyLabelInPathCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts deleted file mode 100644 index b0e0d8641556..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts +++ /dev/null @@ -1,106 +0,0 @@ -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 { HttpRequestWithLabelsAndTimestampFormatInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand, - serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpRequestWithLabelsAndTimestampFormatCommandInput - extends HttpRequestWithLabelsAndTimestampFormatInput {} -export interface HttpRequestWithLabelsAndTimestampFormatCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests serialize different timestamp formats in the - * URI path. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpRequestWithLabelsAndTimestampFormatCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandInput} for command's `input` shape. - * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpRequestWithLabelsAndTimestampFormatCommand extends $Command< - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithLabelsAndTimestampFormatCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestJsonProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler< - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput - > { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestJsonProtocolClient"; - const commandName = "HttpRequestWithLabelsAndTimestampFormatCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithLabelsAndTimestampFormatInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpRequestWithLabelsAndTimestampFormatCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts deleted file mode 100644 index 7b1a5282170a..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpRequestWithLabelsCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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 { HttpRequestWithLabelsInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpRequestWithLabelsCommand, - serializeAws_restJson1HttpRequestWithLabelsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpRequestWithLabelsCommandInput extends HttpRequestWithLabelsInput {} -export interface HttpRequestWithLabelsCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests are serialized when there's no input - * payload but there are HTTP labels. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, HttpRequestWithLabelsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, HttpRequestWithLabelsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new HttpRequestWithLabelsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpRequestWithLabelsCommandInput} for command's `input` shape. - * @see {@link HttpRequestWithLabelsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpRequestWithLabelsCommand extends $Command< - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithLabelsCommandInput) { - // 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 = "HttpRequestWithLabelsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithLabelsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpRequestWithLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpRequestWithLabelsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpRequestWithLabelsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts deleted file mode 100644 index 92230590ce55..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpResponseCodeCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { HttpResponseCodeOutput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpResponseCodeCommand, - serializeAws_restJson1HttpResponseCodeCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpResponseCodeCommandInput {} -export interface HttpResponseCodeCommandOutput extends HttpResponseCodeOutput, __MetadataBearer {} - -export class HttpResponseCodeCommand extends $Command< - HttpResponseCodeCommandInput, - HttpResponseCodeCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpResponseCodeCommandInput) { - // 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 = "HttpResponseCodeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: HttpResponseCodeOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpResponseCodeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpResponseCodeCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpResponseCodeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts deleted file mode 100644 index 38a7c30b64d0..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/HttpStringPayloadCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { StringPayloadInput } from "../models/models_0"; -import { - deserializeAws_restJson1HttpStringPayloadCommand, - serializeAws_restJson1HttpStringPayloadCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface HttpStringPayloadCommandInput extends StringPayloadInput {} -export interface HttpStringPayloadCommandOutput extends StringPayloadInput, __MetadataBearer {} - -export class HttpStringPayloadCommand extends $Command< - HttpStringPayloadCommandInput, - HttpStringPayloadCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpStringPayloadCommandInput) { - // 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 = "HttpStringPayloadCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: StringPayloadInput.filterSensitiveLog, - outputFilterSensitiveLog: StringPayloadInput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpStringPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1HttpStringPayloadCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1HttpStringPayloadCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts deleted file mode 100644 index 1bab8868204b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/IgnoreQueryParamsInResponseCommand.ts +++ /dev/null @@ -1,100 +0,0 @@ -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 { IgnoreQueryParamsInResponseOutput } from "../models/models_0"; -import { - deserializeAws_restJson1IgnoreQueryParamsInResponseCommand, - serializeAws_restJson1IgnoreQueryParamsInResponseCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface IgnoreQueryParamsInResponseCommandInput {} -export interface IgnoreQueryParamsInResponseCommandOutput extends IgnoreQueryParamsInResponseOutput, __MetadataBearer {} - -/** - * This example ensures that query string bound request parameters are - * serialized in the body of responses if the structure is used in both - * the request and response. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, IgnoreQueryParamsInResponseCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, IgnoreQueryParamsInResponseCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new IgnoreQueryParamsInResponseCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link IgnoreQueryParamsInResponseCommandInput} for command's `input` shape. - * @see {@link IgnoreQueryParamsInResponseCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class IgnoreQueryParamsInResponseCommand extends $Command< - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: IgnoreQueryParamsInResponseCommandInput) { - // 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 = "IgnoreQueryParamsInResponseCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: IgnoreQueryParamsInResponseOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1IgnoreQueryParamsInResponseCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1IgnoreQueryParamsInResponseCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts deleted file mode 100644 index 46ddf56ab33b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/InputAndOutputWithHeadersCommand.ts +++ /dev/null @@ -1,99 +0,0 @@ -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 { InputAndOutputWithHeadersIO } from "../models/models_0"; -import { - deserializeAws_restJson1InputAndOutputWithHeadersCommand, - serializeAws_restJson1InputAndOutputWithHeadersCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface InputAndOutputWithHeadersCommandInput extends InputAndOutputWithHeadersIO {} -export interface InputAndOutputWithHeadersCommandOutput extends InputAndOutputWithHeadersIO, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there is - * no input or output payload but there are HTTP header bindings. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, InputAndOutputWithHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, InputAndOutputWithHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new InputAndOutputWithHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link InputAndOutputWithHeadersCommandInput} for command's `input` shape. - * @see {@link InputAndOutputWithHeadersCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class InputAndOutputWithHeadersCommand extends $Command< - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: InputAndOutputWithHeadersCommandInput) { - // 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 = "InputAndOutputWithHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1InputAndOutputWithHeadersCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1InputAndOutputWithHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts deleted file mode 100644 index 9c0d0d1c3033..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonBlobsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { JsonBlobsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonBlobsCommand, - serializeAws_restJson1JsonBlobsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonBlobsCommandInput extends JsonBlobsInputOutput {} -export interface JsonBlobsCommandOutput extends JsonBlobsInputOutput, __MetadataBearer {} - -/** - * Blobs are base64 encoded - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonBlobsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonBlobsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonBlobsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonBlobsCommandInput} for command's `input` shape. - * @see {@link JsonBlobsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonBlobsCommand extends $Command< - JsonBlobsCommandInput, - JsonBlobsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonBlobsCommandInput) { - // 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 = "JsonBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonBlobsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonBlobsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts deleted file mode 100644 index b07445bb5a5e..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonEnumsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { JsonEnumsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonEnumsCommand, - serializeAws_restJson1JsonEnumsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonEnumsCommandInput extends JsonEnumsInputOutput {} -export interface JsonEnumsCommandOutput extends JsonEnumsInputOutput, __MetadataBearer {} - -/** - * This example serializes enums as top level properties, in lists, sets, and maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonEnumsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonEnumsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonEnumsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonEnumsCommandInput} for command's `input` shape. - * @see {@link JsonEnumsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonEnumsCommand extends $Command< - JsonEnumsCommandInput, - JsonEnumsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonEnumsCommandInput) { - // 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 = "JsonEnumsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonEnumsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonEnumsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonEnumsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts deleted file mode 100644 index 610e9df3866d..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonListsCommand.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 { JsonListsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonListsCommand, - serializeAws_restJson1JsonListsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonListsCommandInput extends JsonListsInputOutput {} -export interface JsonListsCommandOutput extends JsonListsInputOutput, __MetadataBearer {} - -/** - * This test case serializes JSON lists for the following cases for both - * input and output: - * - * 1. Normal JSON lists. - * 2. Normal JSON sets. - * 3. JSON lists of lists. - * 4. Lists of structures. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonListsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonListsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonListsCommandInput} for command's `input` shape. - * @see {@link JsonListsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonListsCommand extends $Command< - JsonListsCommandInput, - JsonListsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonListsCommandInput) { - // 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 = "JsonListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonListsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonListsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts deleted file mode 100644 index 757bd2b6883c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonMapsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { JsonMapsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonMapsCommand, - serializeAws_restJson1JsonMapsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonMapsCommandInput extends JsonMapsInputOutput {} -export interface JsonMapsCommandOutput extends JsonMapsInputOutput, __MetadataBearer {} - -/** - * The example tests basic map serialization. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonMapsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonMapsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonMapsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonMapsCommandInput} for command's `input` shape. - * @see {@link JsonMapsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonMapsCommand extends $Command< - JsonMapsCommandInput, - JsonMapsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonMapsCommandInput) { - // 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 = "JsonMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonMapsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonMapsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts deleted file mode 100644 index 5f97b5df8189..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonTimestampsCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -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 { JsonTimestampsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonTimestampsCommand, - serializeAws_restJson1JsonTimestampsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonTimestampsCommandInput extends JsonTimestampsInputOutput {} -export interface JsonTimestampsCommandOutput extends JsonTimestampsInputOutput, __MetadataBearer {} - -/** - * This tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonTimestampsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonTimestampsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonTimestampsCommandInput} for command's `input` shape. - * @see {@link JsonTimestampsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonTimestampsCommand extends $Command< - JsonTimestampsCommandInput, - JsonTimestampsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonTimestampsCommandInput) { - // 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 = "JsonTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: JsonTimestampsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: JsonTimestampsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts deleted file mode 100644 index 60c0b1989814..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/JsonUnionsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { UnionInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1JsonUnionsCommand, - serializeAws_restJson1JsonUnionsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface JsonUnionsCommandInput extends UnionInputOutput {} -export interface JsonUnionsCommandOutput extends UnionInputOutput, __MetadataBearer {} - -/** - * This operation uses unions for inputs and outputs. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, JsonUnionsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, JsonUnionsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new JsonUnionsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link JsonUnionsCommandInput} for command's `input` shape. - * @see {@link JsonUnionsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class JsonUnionsCommand extends $Command< - JsonUnionsCommandInput, - JsonUnionsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: JsonUnionsCommandInput) { - // 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 = "JsonUnionsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: UnionInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: JsonUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1JsonUnionsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1JsonUnionsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts deleted file mode 100644 index 5924cd4115f6..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithBodyCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts deleted file mode 100644 index 4c1c26c29af6..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithGenericStringCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts deleted file mode 100644 index f35ceeefbb7f..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedAcceptWithPayloadCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedBlobCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBlobCommand.ts deleted file mode 100644 index 3e6965af7561..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBlobCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts deleted file mode 100644 index 98a5aad1d3ea..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedBooleanCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedByteCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedByteCommand.ts deleted file mode 100644 index 9f8fb7a12cba..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedByteCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts deleted file mode 100644 index 13a2d1722b92..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithBodyCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts deleted file mode 100644 index ffd29dc98f01..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithGenericStringCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts deleted file mode 100644 index 3a01c271afdd..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithPayloadCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts deleted file mode 100644 index 30771b24accd..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedContentTypeWithoutBodyCommand.ts +++ /dev/null @@ -1,83 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts deleted file mode 100644 index fd616d073aff..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedDoubleCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedFloatCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedFloatCommand.ts deleted file mode 100644 index 848f2f385de0..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedFloatCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts deleted file mode 100644 index 245c7ac610db..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedIntegerCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedListCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedListCommand.ts deleted file mode 100644 index bd83dc11d480..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedListCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedLongCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedLongCommand.ts deleted file mode 100644 index 684fbe6741af..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedLongCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedMapCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedMapCommand.ts deleted file mode 100644 index 080b8be8cb49..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedMapCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts deleted file mode 100644 index 82d284ed749e..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedRequestBodyCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedSetCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedSetCommand.ts deleted file mode 100644 index 22d543ddf07e..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedSetCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedShortCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedShortCommand.ts deleted file mode 100644 index f769c8fc8155..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedShortCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedStringCommand.ts deleted file mode 100644 index b3f509c7404b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedStringCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts deleted file mode 100644 index 3b90e4391dcd..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDateTimeCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts deleted file mode 100644 index a591ad5eaeca..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyDefaultCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts deleted file mode 100644 index 13a80d458cb0..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampBodyHttpDateCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts deleted file mode 100644 index 4001c1250f31..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDateTimeCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts deleted file mode 100644 index f13adc566c26..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderDefaultCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts deleted file mode 100644 index 2e39dadfdd7b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampHeaderEpochCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts deleted file mode 100644 index 5314c67f55dc..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathDefaultCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts deleted file mode 100644 index 70eb25fbe197..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathEpochCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts deleted file mode 100644 index 4b9f3ed93a8b..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampPathHttpDateCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts deleted file mode 100644 index eebe83963a5f..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryDefaultCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts deleted file mode 100644 index 5473b9e4ce03..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryEpochCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts deleted file mode 100644 index 6b60c4f74eaf..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedTimestampQueryHttpDateCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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-protocoltests-restjson/src/commands/MalformedUnionCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedUnionCommand.ts deleted file mode 100644 index 9741bee2f504..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MalformedUnionCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts deleted file mode 100644 index 613815066734..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/MediaTypeHeaderCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { MediaTypeHeaderInput, MediaTypeHeaderOutput } from "../models/models_0"; -import { - deserializeAws_restJson1MediaTypeHeaderCommand, - serializeAws_restJson1MediaTypeHeaderCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface MediaTypeHeaderCommandInput extends MediaTypeHeaderInput {} -export interface MediaTypeHeaderCommandOutput extends MediaTypeHeaderOutput, __MetadataBearer {} - -/** - * This example ensures that mediaType strings are base64 encoded in headers. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, MediaTypeHeaderCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, MediaTypeHeaderCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new MediaTypeHeaderCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link MediaTypeHeaderCommandInput} for command's `input` shape. - * @see {@link MediaTypeHeaderCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class MediaTypeHeaderCommand extends $Command< - MediaTypeHeaderCommandInput, - MediaTypeHeaderCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: MediaTypeHeaderCommandInput) { - // 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 = "MediaTypeHeaderCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: MediaTypeHeaderInput.filterSensitiveLog, - outputFilterSensitiveLog: MediaTypeHeaderOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: MediaTypeHeaderCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1MediaTypeHeaderCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1MediaTypeHeaderCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts deleted file mode 100644 index 44653767c903..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndNoOutputCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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_restJson1NoInputAndNoOutputCommand, - serializeAws_restJson1NoInputAndNoOutputCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface NoInputAndNoOutputCommandInput {} -export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new NoInputAndNoOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndNoOutputCommand extends $Command< - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndNoOutputCommandInput) { - // 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 = "NoInputAndNoOutputCommand"; - 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1NoInputAndNoOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1NoInputAndNoOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts deleted file mode 100644 index b834e6b635b1..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/NoInputAndOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NoInputAndOutputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1NoInputAndOutputCommand, - serializeAws_restJson1NoInputAndOutputCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface NoInputAndOutputCommandInput {} -export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new NoInputAndOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndOutputCommand extends $Command< - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndOutputCommandInput) { - // 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 = "NoInputAndOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1NoInputAndOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1NoInputAndOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts deleted file mode 100644 index 7aa96cdebc02..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersClientCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NullAndEmptyHeadersIO } from "../models/models_0"; -import { - deserializeAws_restJson1NullAndEmptyHeadersClientCommand, - serializeAws_restJson1NullAndEmptyHeadersClientCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface NullAndEmptyHeadersClientCommandInput extends NullAndEmptyHeadersIO {} -export interface NullAndEmptyHeadersClientCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} - -/** - * Null and empty headers are not sent over the wire. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, NullAndEmptyHeadersClientCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, NullAndEmptyHeadersClientCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new NullAndEmptyHeadersClientCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NullAndEmptyHeadersClientCommandInput} for command's `input` shape. - * @see {@link NullAndEmptyHeadersClientCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NullAndEmptyHeadersClientCommand extends $Command< - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NullAndEmptyHeadersClientCommandInput) { - // 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 = "NullAndEmptyHeadersClientCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1NullAndEmptyHeadersClientCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1NullAndEmptyHeadersClientCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts deleted file mode 100644 index 62b9054a838d..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/NullAndEmptyHeadersServerCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NullAndEmptyHeadersIO } from "../models/models_0"; -import { - deserializeAws_restJson1NullAndEmptyHeadersServerCommand, - serializeAws_restJson1NullAndEmptyHeadersServerCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface NullAndEmptyHeadersServerCommandInput extends NullAndEmptyHeadersIO {} -export interface NullAndEmptyHeadersServerCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} - -/** - * Null and empty headers are not sent over the wire. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, NullAndEmptyHeadersServerCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, NullAndEmptyHeadersServerCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new NullAndEmptyHeadersServerCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NullAndEmptyHeadersServerCommandInput} for command's `input` shape. - * @see {@link NullAndEmptyHeadersServerCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NullAndEmptyHeadersServerCommand extends $Command< - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NullAndEmptyHeadersServerCommandInput) { - // 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 = "NullAndEmptyHeadersServerCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1NullAndEmptyHeadersServerCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1NullAndEmptyHeadersServerCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts deleted file mode 100644 index 908e58db5275..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/OmitsNullSerializesEmptyStringCommand.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 { OmitsNullSerializesEmptyStringInput } from "../models/models_0"; -import { - deserializeAws_restJson1OmitsNullSerializesEmptyStringCommand, - serializeAws_restJson1OmitsNullSerializesEmptyStringCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface OmitsNullSerializesEmptyStringCommandInput extends OmitsNullSerializesEmptyStringInput {} -export interface OmitsNullSerializesEmptyStringCommandOutput extends __MetadataBearer {} - -/** - * Omits null, but serializes empty string value. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, OmitsNullSerializesEmptyStringCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, OmitsNullSerializesEmptyStringCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new OmitsNullSerializesEmptyStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link OmitsNullSerializesEmptyStringCommandInput} for command's `input` shape. - * @see {@link OmitsNullSerializesEmptyStringCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class OmitsNullSerializesEmptyStringCommand extends $Command< - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: OmitsNullSerializesEmptyStringCommandInput) { - // 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 = "OmitsNullSerializesEmptyStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: OmitsNullSerializesEmptyStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: OmitsNullSerializesEmptyStringCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restJson1OmitsNullSerializesEmptyStringCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1OmitsNullSerializesEmptyStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts deleted file mode 100644 index dc694a7ba03d..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryIdempotencyTokenAutoFillCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; -import { - deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommand, - serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} -export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} - -/** - * Automatically adds idempotency tokens. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new QueryIdempotencyTokenAutoFillCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. - * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryIdempotencyTokenAutoFillCommand extends $Command< - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { - // 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 = "QueryIdempotencyTokenAutoFillCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts deleted file mode 100644 index 9567e56735ec..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryParamsAsStringListMapCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { QueryParamsAsStringListMapInput } from "../models/models_0"; -import { - deserializeAws_restJson1QueryParamsAsStringListMapCommand, - serializeAws_restJson1QueryParamsAsStringListMapCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface QueryParamsAsStringListMapCommandInput extends QueryParamsAsStringListMapInput {} -export interface QueryParamsAsStringListMapCommandOutput extends __MetadataBearer {} - -export class QueryParamsAsStringListMapCommand extends $Command< - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryParamsAsStringListMapCommandInput) { - // 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 = "QueryParamsAsStringListMapCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryParamsAsStringListMapInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1QueryParamsAsStringListMapCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1QueryParamsAsStringListMapCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts deleted file mode 100644 index 1b65575ecf2e..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/QueryPrecedenceCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { QueryPrecedenceInput } from "../models/models_0"; -import { - deserializeAws_restJson1QueryPrecedenceCommand, - serializeAws_restJson1QueryPrecedenceCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface QueryPrecedenceCommandInput extends QueryPrecedenceInput {} -export interface QueryPrecedenceCommandOutput extends __MetadataBearer {} - -export class QueryPrecedenceCommand extends $Command< - QueryPrecedenceCommandInput, - QueryPrecedenceCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryPrecedenceCommandInput) { - // 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 = "QueryPrecedenceCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryPrecedenceInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryPrecedenceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1QueryPrecedenceCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1QueryPrecedenceCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts deleted file mode 100644 index a1e7027b2bbd..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/RecursiveShapesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { RecursiveShapesInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1RecursiveShapesCommand, - serializeAws_restJson1RecursiveShapesCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface RecursiveShapesCommandInput extends RecursiveShapesInputOutput {} -export interface RecursiveShapesCommandOutput extends RecursiveShapesInputOutput, __MetadataBearer {} - -/** - * Recursive shapes - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, RecursiveShapesCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, RecursiveShapesCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new RecursiveShapesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link RecursiveShapesCommandInput} for command's `input` shape. - * @see {@link RecursiveShapesCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class RecursiveShapesCommand extends $Command< - RecursiveShapesCommandInput, - RecursiveShapesCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: RecursiveShapesCommandInput) { - // 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 = "RecursiveShapesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: RecursiveShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1RecursiveShapesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1RecursiveShapesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts deleted file mode 100644 index a736cd75da0f..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/SimpleScalarPropertiesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1SimpleScalarPropertiesCommand, - serializeAws_restJson1SimpleScalarPropertiesCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} -export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} - -export class SimpleScalarPropertiesCommand extends $Command< - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarPropertiesCommandInput) { - // 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 = "SimpleScalarPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1SimpleScalarPropertiesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1SimpleScalarPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts deleted file mode 100644 index ffcc824a5c08..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts +++ /dev/null @@ -1,107 +0,0 @@ -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 { StreamingTraitsInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1StreamingTraitsCommand, - serializeAws_restJson1StreamingTraitsCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -type StreamingTraitsCommandInputType = Omit & { - /** - * For *`StreamingTraitsInputOutput["blob"]`*, see {@link StreamingTraitsInputOutput.blob}. - */ - blob?: StreamingTraitsInputOutput["blob"] | string | Uint8Array | Buffer; -}; -/** - * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} - */ -export interface StreamingTraitsCommandInput extends StreamingTraitsCommandInputType {} -export interface StreamingTraitsCommandOutput extends StreamingTraitsInputOutput, __MetadataBearer {} - -/** - * This examples serializes a streaming blob shape in the request body. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, StreamingTraitsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, StreamingTraitsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new StreamingTraitsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link StreamingTraitsCommandInput} for command's `input` shape. - * @see {@link StreamingTraitsCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class StreamingTraitsCommand extends $Command< - StreamingTraitsCommandInput, - StreamingTraitsCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: StreamingTraitsCommandInput) { - // 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 = "StreamingTraitsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: StreamingTraitsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: StreamingTraitsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: StreamingTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1StreamingTraitsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1StreamingTraitsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts deleted file mode 100644 index 2a5ebb003a22..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsRequireLengthCommand.ts +++ /dev/null @@ -1,113 +0,0 @@ -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 { StreamingTraitsRequireLengthInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1StreamingTraitsRequireLengthCommand, - serializeAws_restJson1StreamingTraitsRequireLengthCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -type StreamingTraitsRequireLengthCommandInputType = Omit & { - /** - * For *`StreamingTraitsRequireLengthInputOutput["blob"]`*, see {@link StreamingTraitsRequireLengthInputOutput.blob}. - */ - blob?: StreamingTraitsRequireLengthInputOutput["blob"] | string | Uint8Array | Buffer; -}; -/** - * This interface extends from `StreamingTraitsRequireLengthInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsRequireLengthInputOutput} - */ -export interface StreamingTraitsRequireLengthCommandInput extends StreamingTraitsRequireLengthCommandInputType {} -export interface StreamingTraitsRequireLengthCommandOutput - extends StreamingTraitsRequireLengthInputOutput, - __MetadataBearer {} - -/** - * This examples serializes a streaming blob shape with a required content - * length in the request body. - * - * In this example, no JSON document is synthesized because the payload is - * not a structure or a union type. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, StreamingTraitsRequireLengthCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, StreamingTraitsRequireLengthCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new StreamingTraitsRequireLengthCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link StreamingTraitsRequireLengthCommandInput} for command's `input` shape. - * @see {@link StreamingTraitsRequireLengthCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class StreamingTraitsRequireLengthCommand extends $Command< - StreamingTraitsRequireLengthCommandInput, - StreamingTraitsRequireLengthCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: StreamingTraitsRequireLengthCommandInput) { - // 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 = "StreamingTraitsRequireLengthCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: StreamingTraitsRequireLengthInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: StreamingTraitsRequireLengthInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: StreamingTraitsRequireLengthCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1StreamingTraitsRequireLengthCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1StreamingTraitsRequireLengthCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts deleted file mode 100644 index 857f60e33124..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts +++ /dev/null @@ -1,112 +0,0 @@ -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 { StreamingTraitsWithMediaTypeInputOutput } from "../models/models_0"; -import { - deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand, - serializeAws_restJson1StreamingTraitsWithMediaTypeCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -type StreamingTraitsWithMediaTypeCommandInputType = Omit & { - /** - * For *`StreamingTraitsWithMediaTypeInputOutput["blob"]`*, see {@link StreamingTraitsWithMediaTypeInputOutput.blob}. - */ - blob?: StreamingTraitsWithMediaTypeInputOutput["blob"] | string | Uint8Array | Buffer; -}; -/** - * This interface extends from `StreamingTraitsWithMediaTypeInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsWithMediaTypeInputOutput} - */ -export interface StreamingTraitsWithMediaTypeCommandInput extends StreamingTraitsWithMediaTypeCommandInputType {} -export interface StreamingTraitsWithMediaTypeCommandOutput - extends StreamingTraitsWithMediaTypeInputOutput, - __MetadataBearer {} - -/** - * This examples serializes a streaming media-typed blob shape in the request body. - * - * This examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, StreamingTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, StreamingTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new StreamingTraitsWithMediaTypeCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link StreamingTraitsWithMediaTypeCommandInput} for command's `input` shape. - * @see {@link StreamingTraitsWithMediaTypeCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class StreamingTraitsWithMediaTypeCommand extends $Command< - StreamingTraitsWithMediaTypeCommandInput, - StreamingTraitsWithMediaTypeCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: StreamingTraitsWithMediaTypeCommandInput) { - // 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 = "StreamingTraitsWithMediaTypeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: StreamingTraitsWithMediaTypeInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: StreamingTraitsWithMediaTypeInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: StreamingTraitsWithMediaTypeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1StreamingTraitsWithMediaTypeCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts deleted file mode 100644 index ea9fb44629ee..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/TimestampFormatHeadersCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { TimestampFormatHeadersIO } from "../models/models_0"; -import { - deserializeAws_restJson1TimestampFormatHeadersCommand, - serializeAws_restJson1TimestampFormatHeadersCommand, -} from "../protocols/Aws_restJson1"; -import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; - -export interface TimestampFormatHeadersCommandInput extends TimestampFormatHeadersIO {} -export interface TimestampFormatHeadersCommandOutput extends TimestampFormatHeadersIO, __MetadataBearer {} - -/** - * This example tests how timestamp request and response headers are serialized. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestJsonProtocolClient, TimestampFormatHeadersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import - * // const { RestJsonProtocolClient, TimestampFormatHeadersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import - * const client = new RestJsonProtocolClient(config); - * const command = new TimestampFormatHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link TimestampFormatHeadersCommandInput} for command's `input` shape. - * @see {@link TimestampFormatHeadersCommandOutput} for command's `response` shape. - * @see {@link RestJsonProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class TimestampFormatHeadersCommand extends $Command< - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, - RestJsonProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: TimestampFormatHeadersCommandInput) { - // 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 = "TimestampFormatHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: TimestampFormatHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restJson1TimestampFormatHeadersCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restJson1TimestampFormatHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts b/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts deleted file mode 100644 index 039dfc6816fc..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/commands/index.ts +++ /dev/null @@ -1,79 +0,0 @@ -export * from "./AllQueryStringTypesCommand"; -export * from "./ConstantAndVariableQueryStringCommand"; -export * from "./ConstantQueryStringCommand"; -export * from "./DocumentTypeAsPayloadCommand"; -export * from "./DocumentTypeCommand"; -export * from "./EmptyInputAndEmptyOutputCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HostWithPathOperationCommand"; -export * from "./HttpChecksumRequiredCommand"; -export * from "./HttpEnumPayloadCommand"; -export * from "./HttpPayloadTraitsCommand"; -export * from "./HttpPayloadTraitsWithMediaTypeCommand"; -export * from "./HttpPayloadWithStructureCommand"; -export * from "./HttpPrefixHeadersCommand"; -export * from "./HttpPrefixHeadersResponseCommand"; -export * from "./HttpRequestWithFloatLabelsCommand"; -export * from "./HttpRequestWithGreedyLabelInPathCommand"; -export * from "./HttpRequestWithLabelsAndTimestampFormatCommand"; -export * from "./HttpRequestWithLabelsCommand"; -export * from "./HttpResponseCodeCommand"; -export * from "./HttpStringPayloadCommand"; -export * from "./IgnoreQueryParamsInResponseCommand"; -export * from "./InputAndOutputWithHeadersCommand"; -export * from "./JsonBlobsCommand"; -export * from "./JsonEnumsCommand"; -export * from "./JsonListsCommand"; -export * from "./JsonMapsCommand"; -export * from "./JsonTimestampsCommand"; -export * from "./JsonUnionsCommand"; -export * from "./MalformedAcceptWithBodyCommand"; -export * from "./MalformedAcceptWithGenericStringCommand"; -export * from "./MalformedAcceptWithPayloadCommand"; -export * from "./MalformedBlobCommand"; -export * from "./MalformedBooleanCommand"; -export * from "./MalformedByteCommand"; -export * from "./MalformedContentTypeWithBodyCommand"; -export * from "./MalformedContentTypeWithGenericStringCommand"; -export * from "./MalformedContentTypeWithPayloadCommand"; -export * from "./MalformedContentTypeWithoutBodyCommand"; -export * from "./MalformedDoubleCommand"; -export * from "./MalformedFloatCommand"; -export * from "./MalformedIntegerCommand"; -export * from "./MalformedListCommand"; -export * from "./MalformedLongCommand"; -export * from "./MalformedMapCommand"; -export * from "./MalformedRequestBodyCommand"; -export * from "./MalformedSetCommand"; -export * from "./MalformedShortCommand"; -export * from "./MalformedStringCommand"; -export * from "./MalformedTimestampBodyDateTimeCommand"; -export * from "./MalformedTimestampBodyDefaultCommand"; -export * from "./MalformedTimestampBodyHttpDateCommand"; -export * from "./MalformedTimestampHeaderDateTimeCommand"; -export * from "./MalformedTimestampHeaderDefaultCommand"; -export * from "./MalformedTimestampHeaderEpochCommand"; -export * from "./MalformedTimestampPathDefaultCommand"; -export * from "./MalformedTimestampPathEpochCommand"; -export * from "./MalformedTimestampPathHttpDateCommand"; -export * from "./MalformedTimestampQueryDefaultCommand"; -export * from "./MalformedTimestampQueryEpochCommand"; -export * from "./MalformedTimestampQueryHttpDateCommand"; -export * from "./MalformedUnionCommand"; -export * from "./MediaTypeHeaderCommand"; -export * from "./NoInputAndNoOutputCommand"; -export * from "./NoInputAndOutputCommand"; -export * from "./NullAndEmptyHeadersClientCommand"; -export * from "./NullAndEmptyHeadersServerCommand"; -export * from "./OmitsNullSerializesEmptyStringCommand"; -export * from "./QueryIdempotencyTokenAutoFillCommand"; -export * from "./QueryParamsAsStringListMapCommand"; -export * from "./QueryPrecedenceCommand"; -export * from "./RecursiveShapesCommand"; -export * from "./SimpleScalarPropertiesCommand"; -export * from "./StreamingTraitsCommand"; -export * from "./StreamingTraitsRequireLengthCommand"; -export * from "./StreamingTraitsWithMediaTypeCommand"; -export * from "./TimestampFormatHeadersCommand"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts b/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts deleted file mode 100644 index cb7b16a70f63..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "restjson.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "restjson.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "restjson.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "restjson.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "restjson.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "restjson", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-restjson/src/index.ts b/protocol_tests/aws-protocoltests-restjson/src/index.ts deleted file mode 100644 index e397b549b73c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./RestJsonProtocol"; -export * from "./RestJsonProtocolClient"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/models/index.ts b/protocol_tests/aws-protocoltests-restjson/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts b/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts deleted file mode 100644 index bfe279dd3bec..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/models/models_0.ts +++ /dev/null @@ -1,1530 +0,0 @@ -import { LazyJsonString as __LazyJsonString } from "@aws-sdk/smithy-client"; -import { - DocumentType as __DocumentType, - MetadataBearer as $MetadataBearer, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { Readable } from "stream"; - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface AllQueryStringTypesInput { - queryString?: string; - queryStringList?: string[]; - queryStringSet?: string[]; - queryByte?: number; - queryShort?: number; - queryInteger?: number; - queryIntegerList?: number[]; - queryIntegerSet?: number[]; - queryLong?: number; - queryFloat?: number; - queryDouble?: number; - queryDoubleList?: number[]; - queryBoolean?: boolean; - queryBooleanList?: boolean[]; - queryTimestamp?: Date; - queryTimestampList?: Date[]; - queryEnum?: FooEnum | string; - queryEnumList?: (FooEnum | string)[]; - queryParamsMapOfStringList?: { [key: string]: string[] }; -} - -export namespace AllQueryStringTypesInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: AllQueryStringTypesInput): any => ({ - ...obj, - }); -} - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - Header?: string; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface ConstantAndVariableQueryStringInput { - baz?: string; - maybeSet?: string; -} - -export namespace ConstantAndVariableQueryStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ConstantAndVariableQueryStringInput): any => ({ - ...obj, - }); -} - -export interface ConstantQueryStringInput { - hello: string | undefined; -} - -export namespace ConstantQueryStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ConstantQueryStringInput): any => ({ - ...obj, - }); -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -export interface DocumentTypeInputOutput { - stringValue?: string; - documentValue?: __DocumentType; -} - -export namespace DocumentTypeInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: DocumentTypeInputOutput): any => ({ - ...obj, - }); -} - -export interface DocumentTypeAsPayloadInputOutput { - documentValue?: __DocumentType; -} - -export namespace DocumentTypeAsPayloadInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: DocumentTypeAsPayloadInputOutput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputInput {} - -export namespace EmptyInputAndEmptyOutputInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputOutput {} - -export namespace EmptyInputAndEmptyOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -export enum StringEnum { - V = "enumvalue", -} - -export interface EnumPayloadInput { - payload?: StringEnum | string; -} - -export namespace EnumPayloadInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EnumPayloadInput): any => ({ - ...obj, - }); -} - -/** - * This error has test cases that test some of the dark corners of Amazon service - * framework history. It should only be implemented by clients. - */ -export interface FooError extends __SmithyException, $MetadataBearer { - name: "FooError"; - $fault: "server"; -} - -export namespace FooError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FooError): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export interface HttpChecksumRequiredInputOutput { - foo?: string; -} - -export namespace HttpChecksumRequiredInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpChecksumRequiredInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPayloadTraitsInputOutput { - foo?: string; - blob?: Uint8Array; -} - -export namespace HttpPayloadTraitsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadTraitsInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPayloadTraitsWithMediaTypeInputOutput { - foo?: string; - blob?: Uint8Array; -} - -export namespace HttpPayloadTraitsWithMediaTypeInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadTraitsWithMediaTypeInputOutput): any => ({ - ...obj, - }); -} - -export interface NestedPayload { - greeting?: string; - name?: string; -} - -export namespace NestedPayload { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedPayload): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithStructureInputOutput { - nested?: NestedPayload; -} - -export namespace HttpPayloadWithStructureInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithStructureInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPrefixHeadersInputOutput { - foo?: string; - fooMap?: { [key: string]: string }; -} - -export namespace HttpPrefixHeadersInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPrefixHeadersInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPrefixHeadersResponseOutput { - prefixHeaders?: { [key: string]: string }; -} - -export namespace HttpPrefixHeadersResponseOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPrefixHeadersResponseOutput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithFloatLabelsInput { - float: number | undefined; - double: number | undefined; -} - -export namespace HttpRequestWithFloatLabelsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithFloatLabelsInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithGreedyLabelInPathInput { - foo: string | undefined; - baz: string | undefined; -} - -export namespace HttpRequestWithGreedyLabelInPathInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithGreedyLabelInPathInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithLabelsInput { - string: string | undefined; - short: number | undefined; - integer: number | undefined; - long: number | undefined; - float: number | undefined; - double: number | undefined; - /** - * Serialized in the path as true or false. - */ - boolean: boolean | undefined; - - /** - * Note that this member has no format, so it's serialized as an RFC 3399 date-time. - */ - timestamp: Date | undefined; -} - -export namespace HttpRequestWithLabelsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithLabelsInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithLabelsAndTimestampFormatInput { - memberEpochSeconds: Date | undefined; - memberHttpDate: Date | undefined; - memberDateTime: Date | undefined; - defaultFormat: Date | undefined; - targetEpochSeconds: Date | undefined; - targetHttpDate: Date | undefined; - targetDateTime: Date | undefined; -} - -export namespace HttpRequestWithLabelsAndTimestampFormatInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithLabelsAndTimestampFormatInput): any => ({ - ...obj, - }); -} - -export interface HttpResponseCodeOutput { - Status?: number; -} - -export namespace HttpResponseCodeOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpResponseCodeOutput): any => ({ - ...obj, - }); -} - -export interface StringPayloadInput { - payload?: string; -} - -export namespace StringPayloadInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StringPayloadInput): any => ({ - ...obj, - }); -} - -export interface IgnoreQueryParamsInResponseOutput { - baz?: string; -} - -export namespace IgnoreQueryParamsInResponseOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: IgnoreQueryParamsInResponseOutput): any => ({ - ...obj, - }); -} - -export interface InputAndOutputWithHeadersIO { - headerString?: string; - headerByte?: number; - headerShort?: number; - headerInteger?: number; - headerLong?: number; - headerFloat?: number; - headerDouble?: number; - headerTrueBool?: boolean; - headerFalseBool?: boolean; - headerStringList?: string[]; - headerStringSet?: string[]; - headerIntegerList?: number[]; - headerBooleanList?: boolean[]; - headerTimestampList?: Date[]; - headerEnum?: FooEnum | string; - headerEnumList?: (FooEnum | string)[]; -} - -export namespace InputAndOutputWithHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InputAndOutputWithHeadersIO): any => ({ - ...obj, - }); -} - -export interface JsonBlobsInputOutput { - data?: Uint8Array; -} - -export namespace JsonBlobsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonBlobsInputOutput): any => ({ - ...obj, - }); -} - -export interface JsonEnumsInputOutput { - fooEnum1?: FooEnum | string; - fooEnum2?: FooEnum | string; - fooEnum3?: FooEnum | string; - fooEnumList?: (FooEnum | string)[]; - fooEnumSet?: (FooEnum | string)[]; - fooEnumMap?: { [key: string]: FooEnum | string }; -} - -export namespace JsonEnumsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonEnumsInputOutput): any => ({ - ...obj, - }); -} - -export interface StructureListMember { - a?: string; - b?: string; -} - -export namespace StructureListMember { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructureListMember): any => ({ - ...obj, - }); -} - -export interface JsonListsInputOutput { - stringList?: string[]; - sparseStringList?: string[]; - stringSet?: string[]; - integerList?: number[]; - booleanList?: boolean[]; - timestampList?: Date[]; - enumList?: (FooEnum | string)[]; - /** - * A list of lists of strings. - */ - nestedStringList?: string[][]; - - structureList?: StructureListMember[]; -} - -export namespace JsonListsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonListsInputOutput): any => ({ - ...obj, - }); -} - -export interface JsonMapsInputOutput { - denseStructMap?: { [key: string]: GreetingStruct }; - sparseStructMap?: { [key: string]: GreetingStruct }; - denseNumberMap?: { [key: string]: number }; - denseBooleanMap?: { [key: string]: boolean }; - denseStringMap?: { [key: string]: string }; - sparseNumberMap?: { [key: string]: number }; - sparseBooleanMap?: { [key: string]: boolean }; - sparseStringMap?: { [key: string]: string }; - denseSetMap?: { [key: string]: string[] }; - sparseSetMap?: { [key: string]: string[] }; -} - -export namespace JsonMapsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonMapsInputOutput): any => ({ - ...obj, - }); -} - -export interface JsonTimestampsInputOutput { - normal?: Date; - dateTime?: Date; - epochSeconds?: Date; - httpDate?: Date; -} - -export namespace JsonTimestampsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: JsonTimestampsInputOutput): any => ({ - ...obj, - }); -} - -export interface RenamedGreeting { - salutation?: string; -} - -export namespace RenamedGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RenamedGreeting): any => ({ - ...obj, - }); -} - -/** - * A union with a representative set of types for members. - */ -export type MyUnion = - | MyUnion.BlobValueMember - | MyUnion.BooleanValueMember - | MyUnion.EnumValueMember - | MyUnion.ListValueMember - | MyUnion.MapValueMember - | MyUnion.NumberValueMember - | MyUnion.RenamedStructureValueMember - | MyUnion.StringValueMember - | MyUnion.StructureValueMember - | MyUnion.TimestampValueMember - | MyUnion.$UnknownMember; - -export namespace MyUnion { - export interface StringValueMember { - stringValue: string; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface BooleanValueMember { - stringValue?: never; - booleanValue: boolean; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface NumberValueMember { - stringValue?: never; - booleanValue?: never; - numberValue: number; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface BlobValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue: Uint8Array; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface TimestampValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue: Date; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface EnumValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue: FooEnum | string; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface ListValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue: string[]; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface MapValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue: { [key: string]: string }; - structureValue?: never; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface StructureValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue: GreetingStruct; - renamedStructureValue?: never; - $unknown?: never; - } - - export interface RenamedStructureValueMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue: RenamedGreeting; - $unknown?: never; - } - - export interface $UnknownMember { - stringValue?: never; - booleanValue?: never; - numberValue?: never; - blobValue?: never; - timestampValue?: never; - enumValue?: never; - listValue?: never; - mapValue?: never; - structureValue?: never; - renamedStructureValue?: never; - $unknown: [string, any]; - } - - export interface Visitor { - stringValue: (value: string) => T; - booleanValue: (value: boolean) => T; - numberValue: (value: number) => T; - blobValue: (value: Uint8Array) => T; - timestampValue: (value: Date) => T; - enumValue: (value: FooEnum | string) => T; - listValue: (value: string[]) => T; - mapValue: (value: { [key: string]: string }) => T; - structureValue: (value: GreetingStruct) => T; - renamedStructureValue: (value: RenamedGreeting) => T; - _: (name: string, value: any) => T; - } - - export const visit = (value: MyUnion, visitor: Visitor): T => { - if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); - if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); - if (value.numberValue !== undefined) return visitor.numberValue(value.numberValue); - if (value.blobValue !== undefined) return visitor.blobValue(value.blobValue); - if (value.timestampValue !== undefined) return visitor.timestampValue(value.timestampValue); - if (value.enumValue !== undefined) return visitor.enumValue(value.enumValue); - if (value.listValue !== undefined) return visitor.listValue(value.listValue); - if (value.mapValue !== undefined) return visitor.mapValue(value.mapValue); - if (value.structureValue !== undefined) return visitor.structureValue(value.structureValue); - if (value.renamedStructureValue !== undefined) return visitor.renamedStructureValue(value.renamedStructureValue); - return visitor._(value.$unknown[0], value.$unknown[1]); - }; - - /** - * @internal - */ - export const filterSensitiveLog = (obj: MyUnion): any => { - if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; - if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; - if (obj.numberValue !== undefined) return { numberValue: obj.numberValue }; - if (obj.blobValue !== undefined) return { blobValue: obj.blobValue }; - if (obj.timestampValue !== undefined) return { timestampValue: obj.timestampValue }; - if (obj.enumValue !== undefined) return { enumValue: obj.enumValue }; - if (obj.listValue !== undefined) return { listValue: obj.listValue }; - if (obj.mapValue !== undefined) return { mapValue: obj.mapValue }; - if (obj.structureValue !== undefined) - return { structureValue: GreetingStruct.filterSensitiveLog(obj.structureValue) }; - if (obj.renamedStructureValue !== undefined) - return { renamedStructureValue: RenamedGreeting.filterSensitiveLog(obj.renamedStructureValue) }; - if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; - }; -} - -/** - * A shared structure that contains a single union member. - */ -export interface UnionInputOutput { - /** - * A union with a representative set of types for members. - */ - contents?: MyUnion; -} - -export namespace UnionInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: UnionInputOutput): any => ({ - ...obj, - ...(obj.contents && { contents: MyUnion.filterSensitiveLog(obj.contents) }), - }); -} - -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; -} - -export namespace MediaTypeHeaderInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: MediaTypeHeaderInput): any => ({ - ...obj, - }); -} - -export interface MediaTypeHeaderOutput { - json?: __LazyJsonString | string; -} - -export namespace MediaTypeHeaderOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: MediaTypeHeaderOutput): any => ({ - ...obj, - }); -} - -export interface NoInputAndOutputOutput {} - -export namespace NoInputAndOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ - ...obj, - }); -} - -export interface NullAndEmptyHeadersIO { - a?: string; - b?: string; - c?: string[]; -} - -export namespace NullAndEmptyHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NullAndEmptyHeadersIO): any => ({ - ...obj, - }); -} - -export interface OmitsNullSerializesEmptyStringInput { - nullValue?: string; - emptyString?: string; -} - -export namespace OmitsNullSerializesEmptyStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: OmitsNullSerializesEmptyStringInput): any => ({ - ...obj, - }); -} - -export interface QueryIdempotencyTokenAutoFillInput { - token?: string; -} - -export namespace QueryIdempotencyTokenAutoFillInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ - ...obj, - }); -} - -export interface QueryParamsAsStringListMapInput { - qux?: string; - foo?: { [key: string]: string[] }; -} - -export namespace QueryParamsAsStringListMapInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryParamsAsStringListMapInput): any => ({ - ...obj, - }); -} - -export interface QueryPrecedenceInput { - foo?: string; - baz?: { [key: string]: string }; -} - -export namespace QueryPrecedenceInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryPrecedenceInput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarPropertiesInputOutput { - foo?: string; - stringValue?: string; - trueBooleanValue?: boolean; - falseBooleanValue?: boolean; - byteValue?: number; - shortValue?: number; - integerValue?: number; - longValue?: number; - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarPropertiesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ - ...obj, - }); -} - -export interface StreamingTraitsInputOutput { - foo?: string; - blob?: Readable | ReadableStream | Blob; -} - -export namespace StreamingTraitsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StreamingTraitsInputOutput): any => ({ - ...obj, - }); -} - -export interface StreamingTraitsRequireLengthInputOutput { - foo?: string; - blob?: Readable | ReadableStream | Blob; -} - -export namespace StreamingTraitsRequireLengthInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StreamingTraitsRequireLengthInputOutput): any => ({ - ...obj, - }); -} - -export interface StreamingTraitsWithMediaTypeInputOutput { - foo?: string; - blob?: Readable | ReadableStream | Blob; -} - -export namespace StreamingTraitsWithMediaTypeInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StreamingTraitsWithMediaTypeInputOutput): any => ({ - ...obj, - }); -} - -export interface TimestampFormatHeadersIO { - memberEpochSeconds?: Date; - memberHttpDate?: Date; - memberDateTime?: Date; - defaultFormat?: Date; - targetEpochSeconds?: Date; - targetHttpDate?: Date; - targetDateTime?: Date; -} - -export namespace TimestampFormatHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: TimestampFormatHeadersIO): any => ({ - ...obj, - }); -} - -export interface RecursiveShapesInputOutputNested1 { - foo?: string; - nested?: RecursiveShapesInputOutputNested2; -} - -export namespace RecursiveShapesInputOutputNested1 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested1): any => ({ - ...obj, - }); -} - -export interface RecursiveShapesInputOutputNested2 { - bar?: string; - recursiveMember?: RecursiveShapesInputOutputNested1; -} - -export namespace RecursiveShapesInputOutputNested2 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested2): any => ({ - ...obj, - }); -} - -export interface RecursiveShapesInputOutput { - nested?: RecursiveShapesInputOutputNested1; -} - -export namespace RecursiveShapesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutput): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts b/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts deleted file mode 100644 index 8b5b7e8f07a2..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts +++ /dev/null @@ -1,7387 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - dateToUtcString as __dateToUtcString, - expectBoolean as __expectBoolean, - expectByte as __expectByte, - expectInt32 as __expectInt32, - expectLong as __expectLong, - expectNonNull as __expectNonNull, - expectNumber as __expectNumber, - expectObject as __expectObject, - expectShort as __expectShort, - expectString as __expectString, - expectUnion as __expectUnion, - extendedEncodeURIComponent as __extendedEncodeURIComponent, - LazyJsonString as __LazyJsonString, - limitedParseDouble as __limitedParseDouble, - limitedParseFloat32 as __limitedParseFloat32, - parseBoolean as __parseBoolean, - parseEpochTimestamp as __parseEpochTimestamp, - parseRfc3339DateTime as __parseRfc3339DateTime, - parseRfc7231DateTime as __parseRfc7231DateTime, - serializeFloat as __serializeFloat, - splitEvery as __splitEvery, - strictParseByte as __strictParseByte, - strictParseDouble as __strictParseDouble, - strictParseFloat as __strictParseFloat, - strictParseInt32 as __strictParseInt32, - strictParseLong as __strictParseLong, - strictParseShort as __strictParseShort, -} from "@aws-sdk/smithy-client"; -import { - DocumentType as __DocumentType, - Endpoint as __Endpoint, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "../commands/AllQueryStringTypesCommand"; -import { - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "../commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "../commands/ConstantQueryStringCommand"; -import { - DocumentTypeAsPayloadCommandInput, - DocumentTypeAsPayloadCommandOutput, -} from "../commands/DocumentTypeAsPayloadCommand"; -import { DocumentTypeCommandInput, DocumentTypeCommandOutput } from "../commands/DocumentTypeCommand"; -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "../commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "../commands/EndpointWithHostLabelOperationCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; -import { - HostWithPathOperationCommandInput, - HostWithPathOperationCommandOutput, -} from "../commands/HostWithPathOperationCommand"; -import { - HttpChecksumRequiredCommandInput, - HttpChecksumRequiredCommandOutput, -} from "../commands/HttpChecksumRequiredCommand"; -import { HttpEnumPayloadCommandInput, HttpEnumPayloadCommandOutput } from "../commands/HttpEnumPayloadCommand"; -import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "../commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "../commands/HttpPayloadWithStructureCommand"; -import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "../commands/HttpPrefixHeadersCommand"; -import { - HttpPrefixHeadersResponseCommandInput, - HttpPrefixHeadersResponseCommandOutput, -} from "../commands/HttpPrefixHeadersResponseCommand"; -import { - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "../commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "../commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "../commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "../commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "../commands/HttpResponseCodeCommand"; -import { HttpStringPayloadCommandInput, HttpStringPayloadCommandOutput } from "../commands/HttpStringPayloadCommand"; -import { - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "../commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "../commands/InputAndOutputWithHeadersCommand"; -import { JsonBlobsCommandInput, JsonBlobsCommandOutput } from "../commands/JsonBlobsCommand"; -import { JsonEnumsCommandInput, JsonEnumsCommandOutput } from "../commands/JsonEnumsCommand"; -import { JsonListsCommandInput, JsonListsCommandOutput } from "../commands/JsonListsCommand"; -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"; -import { - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "../commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "../commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "../commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "../commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "../commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "../commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "../commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "../commands/SimpleScalarPropertiesCommand"; -import { StreamingTraitsCommandInput, StreamingTraitsCommandOutput } from "../commands/StreamingTraitsCommand"; -import { - StreamingTraitsRequireLengthCommandInput, - StreamingTraitsRequireLengthCommandOutput, -} from "../commands/StreamingTraitsRequireLengthCommand"; -import { - StreamingTraitsWithMediaTypeCommandInput, - StreamingTraitsWithMediaTypeCommandOutput, -} from "../commands/StreamingTraitsWithMediaTypeCommand"; -import { - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "../commands/TimestampFormatHeadersCommand"; -import { - ComplexError, - ComplexNestedErrorData, - FooEnum, - FooError, - GreetingStruct, - InvalidGreeting, - MyUnion, - NestedPayload, - RecursiveShapesInputOutputNested1, - RecursiveShapesInputOutputNested2, - RenamedGreeting, - SimpleUnion, - StructureListMember, -} from "../models/models_0"; - -export const serializeAws_restJson1AllQueryStringTypesCommand = async ( - input: AllQueryStringTypesCommandInput, - 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 || ""}` + "/AllQueryStringTypesInput"; - const query: any = { - ...(input.queryParamsMapOfStringList !== undefined && input.queryParamsMapOfStringList), - ...(input.queryString !== undefined && { String: input.queryString }), - ...(input.queryStringList !== undefined && { - StringList: (input.queryStringList || []).map((_entry) => _entry as any), - }), - ...(input.queryStringSet !== undefined && { - StringSet: (Array.from(input.queryStringSet.values()) || []).map((_entry) => _entry as any), - }), - ...(input.queryByte !== undefined && { Byte: input.queryByte.toString() }), - ...(input.queryShort !== undefined && { Short: input.queryShort.toString() }), - ...(input.queryInteger !== undefined && { Integer: input.queryInteger.toString() }), - ...(input.queryIntegerList !== undefined && { - IntegerList: (input.queryIntegerList || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryIntegerSet !== undefined && { - IntegerSet: (Array.from(input.queryIntegerSet.values()) || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryLong !== undefined && { Long: input.queryLong.toString() }), - ...(input.queryFloat !== undefined && { - Float: input.queryFloat % 1 == 0 ? input.queryFloat + ".0" : input.queryFloat.toString(), - }), - ...(input.queryDouble !== undefined && { - Double: input.queryDouble % 1 == 0 ? input.queryDouble + ".0" : input.queryDouble.toString(), - }), - ...(input.queryDoubleList !== undefined && { - DoubleList: (input.queryDoubleList || []).map( - (_entry) => (_entry % 1 == 0 ? _entry + ".0" : _entry.toString()) as any - ), - }), - ...(input.queryBoolean !== undefined && { Boolean: input.queryBoolean.toString() }), - ...(input.queryBooleanList !== undefined && { - BooleanList: (input.queryBooleanList || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryTimestamp !== undefined && { - Timestamp: (input.queryTimestamp.toISOString().split(".")[0] + "Z").toString(), - }), - ...(input.queryTimestampList !== undefined && { - TimestampList: (input.queryTimestampList || []).map( - (_entry) => (_entry.toISOString().split(".")[0] + "Z").toString() as any - ), - }), - ...(input.queryEnum !== undefined && { Enum: input.queryEnum }), - ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry as any) }), - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1ConstantAndVariableQueryStringCommand = async ( - input: ConstantAndVariableQueryStringCommandInput, - 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 || ""}` + "/ConstantAndVariableQueryString"; - const query: any = { - foo: "bar", - ...(input.baz !== undefined && { baz: input.baz }), - ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1ConstantQueryStringCommand = async ( - input: ConstantQueryStringCommandInput, - 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 || ""}` + "/ConstantQueryString/{hello}"; - if (input.hello !== undefined) { - const labelValue: string = input.hello; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: hello."); - } - resolvedPath = resolvedPath.replace("{hello}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: hello."); - } - const query: any = { - foo: "bar", - hello: "", - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1DocumentTypeCommand = async ( - input: DocumentTypeCommandInput, - 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 || ""}` + "/DocumentType"; - let body: any; - body = JSON.stringify({ - ...(input.documentValue !== undefined && - input.documentValue !== null && { documentValue: serializeAws_restJson1Document(input.documentValue, context) }), - ...(input.stringValue !== undefined && input.stringValue !== null && { stringValue: input.stringValue }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1DocumentTypeAsPayloadCommand = async ( - input: DocumentTypeAsPayloadCommandInput, - 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 || ""}` + "/DocumentTypeAsPayload"; - let body: any; - if (input.documentValue !== undefined) { - if (input.documentValue === null) { - body = "null"; - } else { - body = input.documentValue; - } - } - body = JSON.stringify(body); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1EmptyInputAndEmptyOutputCommand = async ( - input: EmptyInputAndEmptyOutputCommandInput, - 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 || ""}` + "/EmptyInputAndEmptyOutput"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1EndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - 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 || ""}` + "/EndpointOperation"; - let body: any; - body = ""; - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return new __HttpRequest({ - protocol, - hostname: resolvedHostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1EndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - 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 || ""}` + "/EndpointWithHostLabelOperation"; - let body: any; - body = JSON.stringify({ - ...(input.label !== undefined && input.label !== null && { label: input.label }), - }); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return new __HttpRequest({ - protocol, - hostname: resolvedHostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1GreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - 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 || ""}` + "/GreetingWithErrors"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HostWithPathOperationCommand = async ( - input: HostWithPathOperationCommandInput, - 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 || ""}` + "/HostWithPathOperation"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpChecksumRequiredCommand = async ( - input: HttpChecksumRequiredCommandInput, - 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 || ""}` + "/HttpChecksumRequired"; - let body: any; - body = JSON.stringify({ - ...(input.foo !== undefined && input.foo !== null && { foo: input.foo }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpEnumPayloadCommand = async ( - input: HttpEnumPayloadCommandInput, - 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 || ""}` + "/EnumPayload"; - let body: any; - if (input.payload !== undefined) { - body = input.payload; - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpPayloadTraitsCommand = async ( - input: HttpPayloadTraitsCommandInput, - 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 || ""}` + "/HttpPayloadTraits"; - 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_restJson1HttpPayloadTraitsWithMediaTypeCommand = async ( - input: HttpPayloadTraitsWithMediaTypeCommandInput, - 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 || ""}` + "/HttpPayloadTraitsWithMediaType"; - 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_restJson1HttpPayloadWithStructureCommand = async ( - input: HttpPayloadWithStructureCommandInput, - 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 || ""}` + "/HttpPayloadWithStructure"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restJson1NestedPayload(input.nested, context); - } - if (body === undefined) { - body = {}; - } - body = JSON.stringify(body); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpPrefixHeadersCommand = async ( - input: HttpPrefixHeadersCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), - ...(input.fooMap !== undefined && - Object.keys(input.fooMap).reduce( - (acc: any, suffix: string) => ({ - ...acc, - [`x-foo-${suffix.toLowerCase()}`]: input.fooMap![suffix], - }), - {} - )), - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpPrefixHeadersResponseCommand = async ( - input: HttpPrefixHeadersResponseCommandInput, - 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 || ""}` + "/HttpPrefixHeadersResponse"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( - input: HttpRequestWithFloatLabelsCommandInput, - 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 || ""}` + "/FloatHttpLabels/{float}/{double}"; - if (input.float !== undefined) { - const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: float."); - } - resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: float."); - } - if (input.double !== undefined) { - const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: double."); - } - resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: double."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = async ( - input: HttpRequestWithGreedyLabelInPathCommandInput, - 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 || ""}` + - "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; - if (input.foo !== undefined) { - const labelValue: string = input.foo; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: foo."); - } - resolvedPath = resolvedPath.replace("{foo}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: foo."); - } - if (input.baz !== undefined) { - const labelValue: string = input.baz; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: baz."); - } - resolvedPath = resolvedPath.replace( - "{baz+}", - labelValue - .split("/") - .map((segment) => __extendedEncodeURIComponent(segment)) - .join("/") - ); - } else { - throw new Error("No value provided for input HTTP label: baz."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpRequestWithLabelsCommand = async ( - input: HttpRequestWithLabelsCommandInput, - 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 || ""}` + - "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; - if (input.string !== undefined) { - const labelValue: string = input.string; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: string."); - } - resolvedPath = resolvedPath.replace("{string}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: string."); - } - if (input.short !== undefined) { - const labelValue: string = input.short.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: short."); - } - resolvedPath = resolvedPath.replace("{short}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: short."); - } - if (input.integer !== undefined) { - const labelValue: string = input.integer.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: integer."); - } - resolvedPath = resolvedPath.replace("{integer}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: integer."); - } - if (input.long !== undefined) { - const labelValue: string = input.long.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: long."); - } - resolvedPath = resolvedPath.replace("{long}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: long."); - } - if (input.float !== undefined) { - const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: float."); - } - resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: float."); - } - if (input.double !== undefined) { - const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: double."); - } - resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: double."); - } - if (input.boolean !== undefined) { - const labelValue: string = input.boolean.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: boolean."); - } - resolvedPath = resolvedPath.replace("{boolean}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: boolean."); - } - 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: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatCommand = async ( - input: HttpRequestWithLabelsAndTimestampFormatCommandInput, - 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 || ""}` + - "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; - if (input.memberEpochSeconds !== undefined) { - const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberEpochSeconds."); - } - resolvedPath = resolvedPath.replace("{memberEpochSeconds}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberEpochSeconds."); - } - if (input.memberHttpDate !== undefined) { - const labelValue: string = __dateToUtcString(input.memberHttpDate).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberHttpDate."); - } - resolvedPath = resolvedPath.replace("{memberHttpDate}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberHttpDate."); - } - if (input.memberDateTime !== undefined) { - const labelValue: string = (input.memberDateTime.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberDateTime."); - } - resolvedPath = resolvedPath.replace("{memberDateTime}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberDateTime."); - } - if (input.defaultFormat !== undefined) { - const labelValue: string = (input.defaultFormat.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: defaultFormat."); - } - resolvedPath = resolvedPath.replace("{defaultFormat}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: defaultFormat."); - } - if (input.targetEpochSeconds !== undefined) { - const labelValue: string = Math.round(input.targetEpochSeconds.getTime() / 1000).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetEpochSeconds."); - } - resolvedPath = resolvedPath.replace("{targetEpochSeconds}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetEpochSeconds."); - } - if (input.targetHttpDate !== undefined) { - const labelValue: string = __dateToUtcString(input.targetHttpDate).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetHttpDate."); - } - resolvedPath = resolvedPath.replace("{targetHttpDate}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetHttpDate."); - } - if (input.targetDateTime !== undefined) { - const labelValue: string = (input.targetDateTime.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetDateTime."); - } - resolvedPath = resolvedPath.replace("{targetDateTime}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetDateTime."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpResponseCodeCommand = async ( - input: HttpResponseCodeCommandInput, - 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 || ""}` + "/HttpResponseCode"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1HttpStringPayloadCommand = async ( - input: HttpStringPayloadCommandInput, - 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 || ""}` + "/StringPayload"; - let body: any; - if (input.payload !== undefined) { - body = input.payload; - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1IgnoreQueryParamsInResponseCommand = async ( - input: IgnoreQueryParamsInResponseCommandInput, - 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 || ""}` + "/IgnoreQueryParamsInResponse"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1InputAndOutputWithHeadersCommand = async ( - input: InputAndOutputWithHeadersCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), - ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), - ...(isSerializableHeaderValue(input.headerShort) && { "x-short": input.headerShort!.toString() }), - ...(isSerializableHeaderValue(input.headerInteger) && { "x-integer": input.headerInteger!.toString() }), - ...(isSerializableHeaderValue(input.headerLong) && { "x-long": input.headerLong!.toString() }), - ...(isSerializableHeaderValue(input.headerFloat) && { - "x-float": input.headerFloat! % 1 == 0 ? input.headerFloat! + ".0" : input.headerFloat!.toString(), - }), - ...(isSerializableHeaderValue(input.headerDouble) && { - "x-double": input.headerDouble! % 1 == 0 ? input.headerDouble! + ".0" : input.headerDouble!.toString(), - }), - ...(isSerializableHeaderValue(input.headerTrueBool) && { "x-boolean1": input.headerTrueBool!.toString() }), - ...(isSerializableHeaderValue(input.headerFalseBool) && { "x-boolean2": input.headerFalseBool!.toString() }), - ...(isSerializableHeaderValue(input.headerStringList) && { - "x-stringlist": (input.headerStringList! || []).map((_entry) => _entry as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerStringSet) && { - "x-stringset": (Array.from(input.headerStringSet!.values()) || []).map((_entry) => _entry as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerIntegerList) && { - "x-integerlist": (input.headerIntegerList! || []).map((_entry) => _entry.toString() as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerBooleanList) && { - "x-booleanlist": (input.headerBooleanList! || []).map((_entry) => _entry.toString() as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerTimestampList) && { - "x-timestamplist": (input.headerTimestampList! || []) - .map((_entry) => __dateToUtcString(_entry).toString() as any) - .join(", "), - }), - ...(isSerializableHeaderValue(input.headerEnum) && { "x-enum": input.headerEnum! }), - ...(isSerializableHeaderValue(input.headerEnumList) && { - "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry as any).join(", "), - }), - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonBlobsCommand = async ( - input: JsonBlobsCommandInput, - 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 || ""}` + "/JsonBlobs"; - let body: any; - body = JSON.stringify({ - ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonEnumsCommand = async ( - input: JsonEnumsCommandInput, - 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 || ""}` + "/JsonEnums"; - let body: any; - body = JSON.stringify({ - ...(input.fooEnum1 !== undefined && input.fooEnum1 !== null && { fooEnum1: input.fooEnum1 }), - ...(input.fooEnum2 !== undefined && input.fooEnum2 !== null && { fooEnum2: input.fooEnum2 }), - ...(input.fooEnum3 !== undefined && input.fooEnum3 !== null && { fooEnum3: input.fooEnum3 }), - ...(input.fooEnumList !== undefined && - input.fooEnumList !== null && { fooEnumList: serializeAws_restJson1FooEnumList(input.fooEnumList, context) }), - ...(input.fooEnumMap !== undefined && - input.fooEnumMap !== null && { fooEnumMap: serializeAws_restJson1FooEnumMap(input.fooEnumMap, context) }), - ...(input.fooEnumSet !== undefined && - input.fooEnumSet !== null && { fooEnumSet: serializeAws_restJson1FooEnumSet(input.fooEnumSet, context) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonListsCommand = async ( - input: JsonListsCommandInput, - 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 || ""}` + "/JsonLists"; - let body: any; - body = JSON.stringify({ - ...(input.booleanList !== undefined && - input.booleanList !== null && { booleanList: serializeAws_restJson1BooleanList(input.booleanList, context) }), - ...(input.enumList !== undefined && - input.enumList !== null && { enumList: serializeAws_restJson1FooEnumList(input.enumList, context) }), - ...(input.integerList !== undefined && - input.integerList !== null && { integerList: serializeAws_restJson1IntegerList(input.integerList, context) }), - ...(input.nestedStringList !== undefined && - input.nestedStringList !== null && { - nestedStringList: serializeAws_restJson1NestedStringList(input.nestedStringList, context), - }), - ...(input.sparseStringList !== undefined && - input.sparseStringList !== null && { - sparseStringList: serializeAws_restJson1SparseStringList(input.sparseStringList, context), - }), - ...(input.stringList !== undefined && - input.stringList !== null && { stringList: serializeAws_restJson1StringList(input.stringList, context) }), - ...(input.stringSet !== undefined && - input.stringSet !== null && { stringSet: serializeAws_restJson1StringSet(input.stringSet, context) }), - ...(input.structureList !== undefined && - input.structureList !== null && { - myStructureList: serializeAws_restJson1StructureList(input.structureList, context), - }), - ...(input.timestampList !== undefined && - input.timestampList !== null && { - timestampList: serializeAws_restJson1TimestampList(input.timestampList, context), - }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonMapsCommand = async ( - input: JsonMapsCommandInput, - 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 || ""}` + "/JsonMaps"; - let body: any; - body = JSON.stringify({ - ...(input.denseBooleanMap !== undefined && - input.denseBooleanMap !== null && { - denseBooleanMap: serializeAws_restJson1DenseBooleanMap(input.denseBooleanMap, context), - }), - ...(input.denseNumberMap !== undefined && - input.denseNumberMap !== null && { - denseNumberMap: serializeAws_restJson1DenseNumberMap(input.denseNumberMap, context), - }), - ...(input.denseSetMap !== undefined && - input.denseSetMap !== null && { denseSetMap: serializeAws_restJson1DenseSetMap(input.denseSetMap, context) }), - ...(input.denseStringMap !== undefined && - input.denseStringMap !== null && { - denseStringMap: serializeAws_restJson1DenseStringMap(input.denseStringMap, context), - }), - ...(input.denseStructMap !== undefined && - input.denseStructMap !== null && { - denseStructMap: serializeAws_restJson1DenseStructMap(input.denseStructMap, context), - }), - ...(input.sparseBooleanMap !== undefined && - input.sparseBooleanMap !== null && { - sparseBooleanMap: serializeAws_restJson1SparseBooleanMap(input.sparseBooleanMap, context), - }), - ...(input.sparseNumberMap !== undefined && - input.sparseNumberMap !== null && { - sparseNumberMap: serializeAws_restJson1SparseNumberMap(input.sparseNumberMap, context), - }), - ...(input.sparseSetMap !== undefined && - input.sparseSetMap !== null && { sparseSetMap: serializeAws_restJson1SparseSetMap(input.sparseSetMap, context) }), - ...(input.sparseStringMap !== undefined && - input.sparseStringMap !== null && { - sparseStringMap: serializeAws_restJson1SparseStringMap(input.sparseStringMap, context), - }), - ...(input.sparseStructMap !== undefined && - input.sparseStructMap !== null && { - sparseStructMap: serializeAws_restJson1SparseStructMap(input.sparseStructMap, context), - }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonTimestampsCommand = async ( - input: JsonTimestampsCommandInput, - 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 || ""}` + "/JsonTimestamps"; - let body: any; - body = JSON.stringify({ - ...(input.dateTime !== undefined && - input.dateTime !== null && { dateTime: input.dateTime.toISOString().split(".")[0] + "Z" }), - ...(input.epochSeconds !== undefined && - input.epochSeconds !== null && { epochSeconds: Math.round(input.epochSeconds.getTime() / 1000) }), - ...(input.httpDate !== undefined && input.httpDate !== null && { httpDate: __dateToUtcString(input.httpDate) }), - ...(input.normal !== undefined && input.normal !== null && { normal: Math.round(input.normal.getTime() / 1000) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1JsonUnionsCommand = async ( - input: JsonUnionsCommandInput, - 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 || ""}` + "/JsonUnions"; - let body: any; - body = JSON.stringify({ - ...(input.contents !== undefined && - input.contents !== null && { contents: serializeAws_restJson1MyUnion(input.contents, context) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedAcceptWithBodyCommand = async ( - input: MalformedAcceptWithBodyCommandInput, - 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 || ""}` + "/MalformedAcceptWithBody"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -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/octet-stream", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedAcceptWithGenericString"; - let body: any; - if (input.payload !== undefined) { - body = input.payload; - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedAcceptWithPayloadCommand = async ( - input: MalformedAcceptWithPayloadCommandInput, - 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 || ""}` + "/MalformedAcceptWithPayload"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedBlobCommand = async ( - input: MalformedBlobCommandInput, - 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 || ""}` + "/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: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedBooleanCommand = async ( - input: MalformedBooleanCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "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() }), - }; - let body: any; - body = JSON.stringify({ - ...(input.booleanInBody !== undefined && input.booleanInBody !== null && { booleanInBody: input.booleanInBody }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1MalformedByteCommand = async ( - input: MalformedByteCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - 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.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: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1MalformedContentTypeWithBodyCommand = async ( - input: MalformedContentTypeWithBodyCommandInput, - 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 || ""}` + "/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, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedContentTypeWithoutBodyCommand = async ( - input: MalformedContentTypeWithoutBodyCommandInput, - 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 || ""}` + "/MalformedContentTypeWithoutBody"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restJson1MalformedContentTypeWithPayloadCommand = async ( - input: MalformedContentTypeWithPayloadCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - 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, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -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(), - }), - }; - let body: any; - body = JSON.stringify({ - ...(input.doubleInBody !== undefined && - input.doubleInBody !== null && { doubleInBody: __serializeFloat(input.doubleInBody) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -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.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(), - }), - }; - let body: any; - body = JSON.stringify({ - ...(input.floatInBody !== undefined && - input.floatInBody !== null && { floatInBody: __serializeFloat(input.floatInBody) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -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/json", - ...(isSerializableHeaderValue(input.integerInHeader) && { integerinheader: input.integerInHeader!.toString() }), - }; - 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, - port, - method: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -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/json", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedList"; - let body: any; - body = JSON.stringify({ - ...(input.bodyList !== undefined && - input.bodyList !== null && { bodyList: serializeAws_restJson1SimpleList(input.bodyList, context) }), - }); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -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": "application/json", - ...(isSerializableHeaderValue(input.longInHeader) && { longinheader: input.longInHeader!.toString() }), - }; - 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, - port, - method: "POST", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restJson1MalformedMapCommand = async ( - input: MalformedMapCommandInput, - 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 || ""}` + "/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!))), - }), - }; - 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(), - }), - }; - 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 || ""}` + "/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_restJson1JsonTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonTimestampsCommandError(output, context); - } - const contents: JsonTimestampsCommandOutput = { - $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)); - } - if (data.normal !== undefined && data.normal !== null) { - contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1JsonTimestampsCommandError = 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_restJson1JsonUnionsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1JsonUnionsCommandError(output, context); - } - const contents: JsonUnionsCommandOutput = { - $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); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1JsonUnionsCommandError = 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_restJson1MalformedAcceptWithBodyCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedAcceptWithBodyCommandError(output, context); - } - const contents: MalformedAcceptWithBodyCommandOutput = { - $metadata: deserializeMetadata(output), - hi: undefined, - }; - 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_restJson1MalformedAcceptWithBodyCommandError = 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_restJson1MalformedAcceptWithGenericStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError(output, context); - } - const contents: MalformedAcceptWithGenericStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedAcceptWithGenericStringCommandError = 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_restJson1MalformedAcceptWithPayloadCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedAcceptWithPayloadCommandError(output, context); - } - const contents: MalformedAcceptWithPayloadCommandOutput = { - $metadata: deserializeMetadata(output), - payload: undefined, - }; - const data: any = await collectBody(output.body, context); - contents.payload = data; - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedAcceptWithPayloadCommandError = 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_restJson1MalformedBlobCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedBlobCommandError(output, context); - } - const contents: MalformedBlobCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedBlobCommandError = 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_restJson1MalformedBooleanCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedBooleanCommandError(output, context); - } - const contents: MalformedBooleanCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedBooleanCommandError = 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_restJson1MalformedByteCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedByteCommandError(output, context); - } - const contents: MalformedByteCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedByteCommandError = 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_restJson1MalformedContentTypeWithBodyCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedContentTypeWithBodyCommandError(output, context); - } - const contents: MalformedContentTypeWithBodyCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedContentTypeWithBodyCommandError = 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_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 = { - ...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_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; - 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_restJson1MalformedContentTypeWithPayloadCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError(output, context); - } - const contents: MalformedContentTypeWithPayloadCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedContentTypeWithPayloadCommandError = 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_restJson1MalformedDoubleCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedDoubleCommandError(output, context); - } - const contents: MalformedDoubleCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedDoubleCommandError = 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_restJson1MalformedFloatCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedFloatCommandError(output, context); - } - const contents: MalformedFloatCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedFloatCommandError = 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_restJson1MalformedIntegerCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedIntegerCommandError(output, context); - } - const contents: MalformedIntegerCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedIntegerCommandError = 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_restJson1MalformedListCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedListCommandError(output, context); - } - const contents: MalformedListCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedListCommandError = 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_restJson1MalformedLongCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedLongCommandError(output, context); - } - const contents: MalformedLongCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedLongCommandError = 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_restJson1MalformedMapCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedMapCommandError(output, context); - } - const contents: MalformedMapCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedMapCommandError = 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_restJson1MalformedRequestBodyCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedRequestBodyCommandError(output, context); - } - const contents: MalformedRequestBodyCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedRequestBodyCommandError = 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_restJson1MalformedSetCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedSetCommandError(output, context); - } - const contents: MalformedSetCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedSetCommandError = 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_restJson1MalformedShortCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedShortCommandError(output, context); - } - const contents: MalformedShortCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedShortCommandError = 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_restJson1MalformedStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedStringCommandError(output, context); - } - const contents: MalformedStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedStringCommandError = 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_restJson1MalformedTimestampBodyDateTimeCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError(output, context); - } - const contents: MalformedTimestampBodyDateTimeCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampBodyDateTimeCommandError = 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_restJson1MalformedTimestampBodyDefaultCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError(output, context); - } - const contents: MalformedTimestampBodyDefaultCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampBodyDefaultCommandError = 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_restJson1MalformedTimestampBodyHttpDateCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError(output, context); - } - const contents: MalformedTimestampBodyHttpDateCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampBodyHttpDateCommandError = 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_restJson1MalformedTimestampHeaderDateTimeCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError(output, context); - } - const contents: MalformedTimestampHeaderDateTimeCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampHeaderDateTimeCommandError = 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_restJson1MalformedTimestampHeaderDefaultCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampHeaderDefaultCommandError(output, context); - } - const contents: MalformedTimestampHeaderDefaultCommandOutput = { - $metadata: deserializeMetadata(output), - }; - 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; - } - 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_restJson1MalformedTimestampHeaderEpochCommandError = 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_restJson1MalformedTimestampPathDefaultCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampPathDefaultCommandError(output, context); - } - const contents: MalformedTimestampPathDefaultCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampPathDefaultCommandError = 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_restJson1MalformedTimestampPathEpochCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampPathEpochCommandError(output, context); - } - const contents: MalformedTimestampPathEpochCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampPathEpochCommandError = 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_restJson1MalformedTimestampPathHttpDateCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError(output, context); - } - const contents: MalformedTimestampPathHttpDateCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampPathHttpDateCommandError = 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_restJson1MalformedTimestampQueryDefaultCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError(output, context); - } - const contents: MalformedTimestampQueryDefaultCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedTimestampQueryDefaultCommandError = 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_restJson1MalformedTimestampQueryEpochCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedTimestampQueryEpochCommandError(output, context); - } - const contents: MalformedTimestampQueryEpochCommandOutput = { - $metadata: deserializeMetadata(output), - }; - 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; - } - 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_restJson1MalformedTimestampQueryHttpDateCommandError = 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_restJson1MalformedUnionCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MalformedUnionCommandError(output, context); - } - const contents: MalformedUnionCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MalformedUnionCommandError = 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_restJson1MediaTypeHeaderCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1MediaTypeHeaderCommandError(output, context); - } - const contents: MediaTypeHeaderCommandOutput = { - $metadata: deserializeMetadata(output), - json: undefined, - }; - if (output.headers["x-json"] !== undefined) { - contents.json = new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-json"])).toString("utf8")); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1MediaTypeHeaderCommandError = 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_restJson1NoInputAndNoOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1NoInputAndNoOutputCommandError(output, context); - } - const contents: NoInputAndNoOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1NoInputAndNoOutputCommandError = 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_restJson1NoInputAndOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1NoInputAndOutputCommandError(output, context); - } - const contents: NoInputAndOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1NoInputAndOutputCommandError = 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_restJson1NullAndEmptyHeadersClientCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1NullAndEmptyHeadersClientCommandError(output, context); - } - const contents: NullAndEmptyHeadersClientCommandOutput = { - $metadata: deserializeMetadata(output), - a: undefined, - b: undefined, - c: undefined, - }; - if (output.headers["x-a"] !== undefined) { - contents.a = output.headers["x-a"]; - } - if (output.headers["x-b"] !== undefined) { - contents.b = output.headers["x-b"]; - } - if (output.headers["x-c"] !== undefined) { - contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1NullAndEmptyHeadersClientCommandError = 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_restJson1NullAndEmptyHeadersServerCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1NullAndEmptyHeadersServerCommandError(output, context); - } - const contents: NullAndEmptyHeadersServerCommandOutput = { - $metadata: deserializeMetadata(output), - a: undefined, - b: undefined, - c: undefined, - }; - if (output.headers["x-a"] !== undefined) { - contents.a = output.headers["x-a"]; - } - if (output.headers["x-b"] !== undefined) { - contents.b = output.headers["x-b"]; - } - if (output.headers["x-c"] !== undefined) { - contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1NullAndEmptyHeadersServerCommandError = 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_restJson1OmitsNullSerializesEmptyStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1OmitsNullSerializesEmptyStringCommandError(output, context); - } - const contents: OmitsNullSerializesEmptyStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1OmitsNullSerializesEmptyStringCommandError = 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_restJson1QueryIdempotencyTokenAutoFillCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommandError(output, context); - } - const contents: QueryIdempotencyTokenAutoFillCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1QueryIdempotencyTokenAutoFillCommandError = 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_restJson1QueryParamsAsStringListMapCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1QueryParamsAsStringListMapCommandError(output, context); - } - const contents: QueryParamsAsStringListMapCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1QueryParamsAsStringListMapCommandError = 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_restJson1QueryPrecedenceCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1QueryPrecedenceCommandError(output, context); - } - const contents: QueryPrecedenceCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1QueryPrecedenceCommandError = 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_restJson1RecursiveShapesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1RecursiveShapesCommandError(output, context); - } - const contents: RecursiveShapesCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.nested !== undefined && data.nested !== null) { - contents.nested = deserializeAws_restJson1RecursiveShapesInputOutputNested1(data.nested, context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1RecursiveShapesCommandError = 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_restJson1SimpleScalarPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1SimpleScalarPropertiesCommandError(output, context); - } - const contents: SimpleScalarPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - byteValue: undefined, - doubleValue: undefined, - falseBooleanValue: undefined, - floatValue: undefined, - foo: undefined, - integerValue: undefined, - longValue: undefined, - shortValue: undefined, - stringValue: undefined, - trueBooleanValue: undefined, - }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byteValue !== undefined && data.byteValue !== null) { - contents.byteValue = __expectByte(data.byteValue); - } - if (data.DoubleDribble !== undefined && data.DoubleDribble !== null) { - contents.doubleValue = __limitedParseDouble(data.DoubleDribble); - } - if (data.falseBooleanValue !== undefined && data.falseBooleanValue !== null) { - contents.falseBooleanValue = __expectBoolean(data.falseBooleanValue); - } - if (data.floatValue !== undefined && data.floatValue !== null) { - contents.floatValue = __limitedParseFloat32(data.floatValue); - } - if (data.integerValue !== undefined && data.integerValue !== null) { - contents.integerValue = __expectInt32(data.integerValue); - } - if (data.longValue !== undefined && data.longValue !== null) { - contents.longValue = __expectLong(data.longValue); - } - if (data.shortValue !== undefined && data.shortValue !== null) { - contents.shortValue = __expectShort(data.shortValue); - } - if (data.stringValue !== undefined && data.stringValue !== null) { - contents.stringValue = __expectString(data.stringValue); - } - if (data.trueBooleanValue !== undefined && data.trueBooleanValue !== null) { - contents.trueBooleanValue = __expectBoolean(data.trueBooleanValue); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1SimpleScalarPropertiesCommandError = 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_restJson1StreamingTraitsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1StreamingTraitsCommandError(output, context); - } - const contents: StreamingTraitsCommandOutput = { - $metadata: deserializeMetadata(output), - blob: undefined, - foo: undefined, - }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: any = output.body; - contents.blob = data; - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1StreamingTraitsCommandError = 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_restJson1StreamingTraitsRequireLengthCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1StreamingTraitsRequireLengthCommandError(output, context); - } - const contents: StreamingTraitsRequireLengthCommandOutput = { - $metadata: deserializeMetadata(output), - blob: undefined, - foo: undefined, - }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: any = output.body; - contents.blob = data; - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1StreamingTraitsRequireLengthCommandError = 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_restJson1StreamingTraitsWithMediaTypeCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommandError(output, context); - } - const contents: StreamingTraitsWithMediaTypeCommandOutput = { - $metadata: deserializeMetadata(output), - blob: undefined, - foo: undefined, - }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: any = output.body; - contents.blob = data; - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1StreamingTraitsWithMediaTypeCommandError = 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_restJson1TimestampFormatHeadersCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restJson1TimestampFormatHeadersCommandError(output, context); - } - const contents: TimestampFormatHeadersCommandOutput = { - $metadata: deserializeMetadata(output), - defaultFormat: undefined, - memberDateTime: undefined, - memberEpochSeconds: undefined, - memberHttpDate: undefined, - targetDateTime: undefined, - targetEpochSeconds: undefined, - targetHttpDate: undefined, - }; - if (output.headers["x-memberepochseconds"] !== undefined) { - contents.memberEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-memberepochseconds"])); - } - if (output.headers["x-memberhttpdate"] !== undefined) { - contents.memberHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-memberhttpdate"])); - } - if (output.headers["x-memberdatetime"] !== undefined) { - contents.memberDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-memberdatetime"])); - } - if (output.headers["x-defaultformat"] !== undefined) { - contents.defaultFormat = __expectNonNull(__parseRfc7231DateTime(output.headers["x-defaultformat"])); - } - if (output.headers["x-targetepochseconds"] !== undefined) { - contents.targetEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-targetepochseconds"])); - } - if (output.headers["x-targethttpdate"] !== undefined) { - contents.targetHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-targethttpdate"])); - } - if (output.headers["x-targetdatetime"] !== undefined) { - contents.targetDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-targetdatetime"])); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restJson1TimestampFormatHeadersCommandError = 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)); -}; - -const deserializeAws_restJson1ComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - Header: undefined, - Nested: undefined, - TopLevel: undefined, - }; - if (parsedOutput.headers["x-header"] !== undefined) { - contents.Header = parsedOutput.headers["x-header"]; - } - const data: any = parsedOutput.body; - if (data.Nested !== undefined && data.Nested !== null) { - contents.Nested = deserializeAws_restJson1ComplexNestedErrorData(data.Nested, context); - } - if (data.TopLevel !== undefined && data.TopLevel !== null) { - contents.TopLevel = __expectString(data.TopLevel); - } - return contents; -}; - -const deserializeAws_restJson1FooErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const contents: FooError = { - name: "FooError", - $fault: "server", - $metadata: deserializeMetadata(parsedOutput), - }; - const data: any = parsedOutput.body; - return contents; -}; - -const deserializeAws_restJson1InvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - Message: undefined, - }; - const data: any = parsedOutput.body; - if (data.Message !== undefined && data.Message !== null) { - contents.Message = __expectString(data.Message); - } - return contents; -}; - -const serializeAws_restJson1DenseBooleanMap = (input: { [key: string]: boolean }, 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_restJson1DenseNumberMap = (input: { [key: string]: number }, 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_restJson1DenseSetMap = (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]: serializeAws_restJson1StringSet(value, context), - }; - }, {}); -}; - -const serializeAws_restJson1DenseStringMap = (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_restJson1DenseStructMap = ( - input: { [key: string]: GreetingStruct }, - context: __SerdeContext -): any => { - return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: serializeAws_restJson1GreetingStruct(value, context), - }; - }, {}); -}; - -const serializeAws_restJson1Document = (input: __DocumentType, context: __SerdeContext): any => { - return input; -}; - -const serializeAws_restJson1MyUnion = (input: MyUnion, context: __SerdeContext): any => { - return MyUnion.visit(input, { - blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), - booleanValue: (value) => ({ booleanValue: value }), - enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: serializeAws_restJson1StringList(value, context) }), - mapValue: (value) => ({ mapValue: serializeAws_restJson1StringMap(value, context) }), - numberValue: (value) => ({ numberValue: value }), - renamedStructureValue: (value) => ({ - renamedStructureValue: serializeAws_restJson1RenamedGreeting(value, context), - }), - stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: serializeAws_restJson1GreetingStruct(value, context) }), - timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), - _: (name, value) => ({ name: value } as any), - }); -}; - -const serializeAws_restJson1NestedPayload = (input: NestedPayload, context: __SerdeContext): any => { - return { - ...(input.greeting !== undefined && input.greeting !== null && { greeting: input.greeting }), - ...(input.name !== undefined && input.name !== null && { name: input.name }), - }; -}; - -const serializeAws_restJson1RecursiveShapesInputOutputNested1 = ( - input: RecursiveShapesInputOutputNested1, - context: __SerdeContext -): any => { - return { - ...(input.foo !== undefined && input.foo !== null && { foo: input.foo }), - ...(input.nested !== undefined && - input.nested !== null && { - nested: serializeAws_restJson1RecursiveShapesInputOutputNested2(input.nested, context), - }), - }; -}; - -const serializeAws_restJson1RecursiveShapesInputOutputNested2 = ( - input: RecursiveShapesInputOutputNested2, - context: __SerdeContext -): any => { - return { - ...(input.bar !== undefined && input.bar !== null && { bar: input.bar }), - ...(input.recursiveMember !== undefined && - input.recursiveMember !== null && { - recursiveMember: serializeAws_restJson1RecursiveShapesInputOutputNested1(input.recursiveMember, context), - }), - }; -}; - -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) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: value, - }; - }, {}); -}; - -const serializeAws_restJson1SparseNumberMap = (input: { [key: string]: number }, context: __SerdeContext): any => { - return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: value, - }; - }, {}); -}; - -const serializeAws_restJson1SparseSetMap = (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, [key]: null as any }; - } - return { - ...acc, - [key]: serializeAws_restJson1StringSet(value, context), - }; - }, {}); -}; - -const serializeAws_restJson1SparseStructMap = ( - input: { [key: string]: GreetingStruct }, - context: __SerdeContext -): any => { - return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: serializeAws_restJson1GreetingStruct(value, context), - }; - }, {}); -}; - -const serializeAws_restJson1StructureList = (input: StructureListMember[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_restJson1StructureListMember(entry, context); - }); -}; - -const serializeAws_restJson1StructureListMember = (input: StructureListMember, context: __SerdeContext): any => { - return { - ...(input.a !== undefined && input.a !== null && { value: input.a }), - ...(input.b !== undefined && input.b !== null && { other: input.b }), - }; -}; - -const serializeAws_restJson1RenamedGreeting = (input: RenamedGreeting, context: __SerdeContext): any => { - return { - ...(input.salutation !== undefined && input.salutation !== null && { salutation: input.salutation }), - }; -}; - -const serializeAws_restJson1BooleanList = (input: boolean[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_restJson1FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_restJson1FooEnumMap = (input: { [key: string]: FooEnum | 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_restJson1FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_restJson1GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi !== undefined && input.hi !== null && { hi: input.hi }), - }; -}; - -const serializeAws_restJson1IntegerList = (input: number[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_restJson1NestedStringList = (input: string[][], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return serializeAws_restJson1StringList(entry, context); - }); -}; - -const serializeAws_restJson1SparseStringList = (input: string[], context: __SerdeContext): any => { - return input.map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); -}; - -const serializeAws_restJson1SparseStringMap = (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, [key]: null as any }; - } - return { - ...acc, - [key]: value, - }; - }, {}); -}; - -const serializeAws_restJson1StringList = (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_restJson1StringMap = (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_restJson1StringSet = (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_restJson1TimestampList = (input: Date[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - return Math.round(entry.getTime() / 1000); - }); -}; - -const deserializeAws_restJson1ComplexNestedErrorData = ( - output: any, - context: __SerdeContext -): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Fooooo), - } as any; -}; - -const deserializeAws_restJson1DenseBooleanMap = (output: any, context: __SerdeContext): { [key: string]: boolean } => { - return Object.entries(output).reduce((acc: { [key: string]: boolean }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectBoolean(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1DenseNumberMap = (output: any, context: __SerdeContext): { [key: string]: number } => { - return Object.entries(output).reduce((acc: { [key: string]: number }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectInt32(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1DenseSetMap = (output: any, context: __SerdeContext): { [key: string]: string[] } => { - return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_restJson1StringSet(value, context), - }; - }, {}); -}; - -const deserializeAws_restJson1DenseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1DenseStructMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return Object.entries(output).reduce((acc: { [key: string]: GreetingStruct }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: deserializeAws_restJson1GreetingStruct(value, context), - }; - }, {}); -}; - -const deserializeAws_restJson1Document = (output: any, context: __SerdeContext): __DocumentType => { - return output; -}; - -const deserializeAws_restJson1MyUnion = (output: any, context: __SerdeContext): MyUnion => { - if (output.blobValue !== undefined && output.blobValue !== null) { - return { - blobValue: context.base64Decoder(output.blobValue), - }; - } - if (__expectBoolean(output.booleanValue) !== undefined) { - return { booleanValue: __expectBoolean(output.booleanValue) as any }; - } - if (__expectString(output.enumValue) !== undefined) { - return { enumValue: __expectString(output.enumValue) as any }; - } - if (output.listValue !== undefined && output.listValue !== null) { - return { - listValue: deserializeAws_restJson1StringList(output.listValue, context), - }; - } - if (output.mapValue !== undefined && output.mapValue !== null) { - return { - mapValue: deserializeAws_restJson1StringMap(output.mapValue, context), - }; - } - if (__expectInt32(output.numberValue) !== undefined) { - return { numberValue: __expectInt32(output.numberValue) as any }; - } - if (output.renamedStructureValue !== undefined && output.renamedStructureValue !== null) { - return { - renamedStructureValue: deserializeAws_restJson1RenamedGreeting(output.renamedStructureValue, context), - }; - } - if (__expectString(output.stringValue) !== undefined) { - return { stringValue: __expectString(output.stringValue) as any }; - } - if (output.structureValue !== undefined && output.structureValue !== null) { - return { - structureValue: deserializeAws_restJson1GreetingStruct(output.structureValue, context), - }; - } - if (output.timestampValue !== undefined && output.timestampValue !== null) { - return { - timestampValue: __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestampValue))), - }; - } - return { $unknown: Object.entries(output)[0] }; -}; - -const deserializeAws_restJson1NestedPayload = (output: any, context: __SerdeContext): NestedPayload => { - return { - greeting: __expectString(output.greeting), - name: __expectString(output.name), - } as any; -}; - -const deserializeAws_restJson1RecursiveShapesInputOutputNested1 = ( - output: any, - context: __SerdeContext -): RecursiveShapesInputOutputNested1 => { - return { - foo: __expectString(output.foo), - nested: - output.nested !== undefined && output.nested !== null - ? deserializeAws_restJson1RecursiveShapesInputOutputNested2(output.nested, context) - : undefined, - } as any; -}; - -const deserializeAws_restJson1RecursiveShapesInputOutputNested2 = ( - output: any, - context: __SerdeContext -): RecursiveShapesInputOutputNested2 => { - return { - bar: __expectString(output.bar), - recursiveMember: - output.recursiveMember !== undefined && output.recursiveMember !== null - ? deserializeAws_restJson1RecursiveShapesInputOutputNested1(output.recursiveMember, context) - : undefined, - } as any; -}; - -const deserializeAws_restJson1SparseBooleanMap = (output: any, context: __SerdeContext): { [key: string]: boolean } => { - return Object.entries(output).reduce((acc: { [key: string]: boolean }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: __expectBoolean(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1SparseNumberMap = (output: any, context: __SerdeContext): { [key: string]: number } => { - return Object.entries(output).reduce((acc: { [key: string]: number }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: __expectInt32(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1SparseSetMap = (output: any, context: __SerdeContext): { [key: string]: string[] } => { - return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: deserializeAws_restJson1StringSet(value, context), - }; - }, {}); -}; - -const deserializeAws_restJson1SparseStructMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return Object.entries(output).reduce((acc: { [key: string]: GreetingStruct }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: deserializeAws_restJson1GreetingStruct(value, context), - }; - }, {}); -}; - -const deserializeAws_restJson1StructureList = (output: any, context: __SerdeContext): StructureListMember[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_restJson1StructureListMember(entry, context); - }); -}; - -const deserializeAws_restJson1StructureListMember = (output: any, context: __SerdeContext): StructureListMember => { - return { - a: __expectString(output.value), - b: __expectString(output.other), - } as any; -}; - -const deserializeAws_restJson1RenamedGreeting = (output: any, context: __SerdeContext): RenamedGreeting => { - return { - salutation: __expectString(output.salutation), - } as any; -}; - -const deserializeAws_restJson1BooleanList = (output: any, context: __SerdeContext): boolean[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectBoolean(entry) as any; - }); -}; - -const deserializeAws_restJson1FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restJson1FooEnumMap = ( - output: any, - context: __SerdeContext -): { [key: string]: FooEnum | string } => { - return Object.entries(output).reduce((acc: { [key: string]: FooEnum | string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - const uniqueValues = new Set(); - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - const parsedEntry = __expectString(entry) as any; - if (uniqueValues.has(parsedEntry)) { - throw new TypeError('All elements of the set "aws.protocoltests.shared#FooEnumSet" must be unique.'); - } else { - uniqueValues.add(parsedEntry); - return parsedEntry; - } - }); -}; - -const deserializeAws_restJson1GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; -}; - -const deserializeAws_restJson1IntegerList = (output: any, context: __SerdeContext): number[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectInt32(entry) as any; - }); -}; - -const deserializeAws_restJson1NestedStringList = (output: any, context: __SerdeContext): string[][] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_restJson1StringList(entry, context); - }); -}; - -const deserializeAws_restJson1SparseStringList = (output: any, context: __SerdeContext): string[] => { - return (output || []).map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restJson1SparseStringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return { ...acc, [key]: null as any }; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1StringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restJson1StringMap = (output: any, context: __SerdeContext): { [key: string]: string } => { - return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => { - if (value === null) { - return acc; - } - return { - ...acc, - [key]: __expectString(value) as any, - }; - }, {}); -}; - -const deserializeAws_restJson1StringSet = (output: any, context: __SerdeContext): string[] => { - const uniqueValues = new Set(); - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - const parsedEntry = __expectString(entry) as any; - if (uniqueValues.has(parsedEntry)) { - throw new TypeError('All elements of the set "aws.protocoltests.shared#StringSet" must be unique.'); - } else { - uniqueValues.add(parsedEntry); - return parsedEntry; - } - }); -}; - -const deserializeAws_restJson1TimestampList = (output: any, context: __SerdeContext): Date[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectNonNull(__parseEpochTimestamp(__expectNumber(entry))); - }); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const isSerializableHeaderValue = (value: any): boolean => - value !== undefined && - value !== null && - value !== "" && - (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && - (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); - } - return {}; - }); - -/** - * Load an error code for the aws.rest-json-1.1 protocol. - */ -const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { - const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - - const sanitizeErrorCode = (rawValue: string): string => { - let cleanValue = rawValue; - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } - return cleanValue; - }; - - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== undefined) { - return sanitizeErrorCode(output.headers[headerKey]); - } - - if (data.code !== undefined) { - return sanitizeErrorCode(data.code); - } - - if (data["__type"] !== undefined) { - return sanitizeErrorCode(data["__type"]); - } - - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts deleted file mode 100644 index eb22e57df908..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { blobHasher as streamHasher } from "@aws-sdk/hash-blob-browser"; -import { Md5 } from "@aws-sdk/md5-js"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - md5: config?.md5 ?? Md5, - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - streamHasher: config?.streamHasher ?? streamHasher, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts deleted file mode 100644 index f18442bcf90d..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts deleted file mode 100644 index 548bcfef2cee..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { defaultRegionInfoProvider } from "./endpoints"; -import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => ({ - apiVersion: "2019-12-16", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "Rest Json Protocol", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts deleted file mode 100644 index 5fce08d94ec8..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/src/runtimeConfig.ts +++ /dev/null @@ -1,44 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Hash } from "@aws-sdk/hash-node"; -import { fileStreamHasher as streamHasher } from "@aws-sdk/hash-stream-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - md5: config?.md5 ?? Hash.bind(null, "md5"), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - streamHasher: config?.streamHasher ?? streamHasher, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts b/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts deleted file mode 100644 index 879c3fd9d52f..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/test/functional/restjson1.spec.ts +++ /dev/null @@ -1,7617 +0,0 @@ -import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; -import { buildQueryString } from "@aws-sdk/querystring-builder"; -import { Encoder as __Encoder } from "@aws-sdk/types"; -import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; -import { Readable } from "stream"; - -import { AllQueryStringTypesCommand } from "../../src/commands/AllQueryStringTypesCommand"; -import { ConstantAndVariableQueryStringCommand } from "../../src/commands/ConstantAndVariableQueryStringCommand"; -import { ConstantQueryStringCommand } from "../../src/commands/ConstantQueryStringCommand"; -import { DocumentTypeAsPayloadCommand } from "../../src/commands/DocumentTypeAsPayloadCommand"; -import { DocumentTypeCommand } from "../../src/commands/DocumentTypeCommand"; -import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; -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 { HttpChecksumRequiredCommand } from "../../src/commands/HttpChecksumRequiredCommand"; -import { HttpEnumPayloadCommand } from "../../src/commands/HttpEnumPayloadCommand"; -import { HttpPayloadTraitsCommand } from "../../src/commands/HttpPayloadTraitsCommand"; -import { HttpPayloadTraitsWithMediaTypeCommand } from "../../src/commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { HttpPayloadWithStructureCommand } from "../../src/commands/HttpPayloadWithStructureCommand"; -import { HttpPrefixHeadersCommand } from "../../src/commands/HttpPrefixHeadersCommand"; -import { HttpPrefixHeadersResponseCommand } from "../../src/commands/HttpPrefixHeadersResponseCommand"; -import { HttpRequestWithFloatLabelsCommand } from "../../src/commands/HttpRequestWithFloatLabelsCommand"; -import { HttpRequestWithGreedyLabelInPathCommand } from "../../src/commands/HttpRequestWithGreedyLabelInPathCommand"; -import { HttpRequestWithLabelsAndTimestampFormatCommand } from "../../src/commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { HttpRequestWithLabelsCommand } from "../../src/commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommand } from "../../src/commands/HttpResponseCodeCommand"; -import { HttpStringPayloadCommand } from "../../src/commands/HttpStringPayloadCommand"; -import { IgnoreQueryParamsInResponseCommand } from "../../src/commands/IgnoreQueryParamsInResponseCommand"; -import { InputAndOutputWithHeadersCommand } from "../../src/commands/InputAndOutputWithHeadersCommand"; -import { JsonBlobsCommand } from "../../src/commands/JsonBlobsCommand"; -import { JsonEnumsCommand } from "../../src/commands/JsonEnumsCommand"; -import { JsonListsCommand } from "../../src/commands/JsonListsCommand"; -import { JsonMapsCommand } from "../../src/commands/JsonMapsCommand"; -import { JsonTimestampsCommand } from "../../src/commands/JsonTimestampsCommand"; -import { JsonUnionsCommand } from "../../src/commands/JsonUnionsCommand"; -import { MediaTypeHeaderCommand } from "../../src/commands/MediaTypeHeaderCommand"; -import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; -import { NullAndEmptyHeadersClientCommand } from "../../src/commands/NullAndEmptyHeadersClientCommand"; -import { OmitsNullSerializesEmptyStringCommand } from "../../src/commands/OmitsNullSerializesEmptyStringCommand"; -import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryParamsAsStringListMapCommand } from "../../src/commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommand } from "../../src/commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommand } from "../../src/commands/RecursiveShapesCommand"; -import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; -import { StreamingTraitsCommand } from "../../src/commands/StreamingTraitsCommand"; -import { StreamingTraitsRequireLengthCommand } from "../../src/commands/StreamingTraitsRequireLengthCommand"; -import { StreamingTraitsWithMediaTypeCommand } from "../../src/commands/StreamingTraitsWithMediaTypeCommand"; -import { TimestampFormatHeadersCommand } from "../../src/commands/TimestampFormatHeadersCommand"; -import { ComplexError, FooError, InvalidGreeting } from "../../src/models/models_0"; -import { RestJsonProtocolClient } from "../../src/RestJsonProtocolClient"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Serializes query string parameters with all supported types - */ -it("RestJsonAllQueryStringTypes:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryString: "Hello there", - - queryStringList: ["a", "b", "c"], - - queryStringSet: ["a", "b", "c"], - - queryByte: 1, - - queryShort: 2, - - queryInteger: 3, - - queryIntegerList: [ - 1, - - 2, - - 3, - ], - - queryIntegerSet: [ - 1, - - 2, - - 3, - ], - - queryLong: 4, - - queryFloat: 1.1, - - queryDouble: 1.1, - - queryDoubleList: [ - 1.1, - - 2.1, - - 3.1, - ], - - queryBoolean: true, - - queryBooleanList: [true, false, true], - - queryTimestamp: new Date(1000), - - queryTimestampList: [new Date(1000), new Date(2000), new Date(3000)], - - queryEnum: "Foo", - - queryEnumList: ["Foo", "Baz", "Bar"], - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("String=Hello%20there"); - expect(queryString).toContain("StringList=a"); - expect(queryString).toContain("StringList=b"); - expect(queryString).toContain("StringList=c"); - expect(queryString).toContain("StringSet=a"); - expect(queryString).toContain("StringSet=b"); - expect(queryString).toContain("StringSet=c"); - expect(queryString).toContain("Byte=1"); - expect(queryString).toContain("Short=2"); - expect(queryString).toContain("Integer=3"); - expect(queryString).toContain("IntegerList=1"); - expect(queryString).toContain("IntegerList=2"); - expect(queryString).toContain("IntegerList=3"); - expect(queryString).toContain("IntegerSet=1"); - expect(queryString).toContain("IntegerSet=2"); - expect(queryString).toContain("IntegerSet=3"); - expect(queryString).toContain("Long=4"); - expect(queryString).toContain("Float=1.1"); - expect(queryString).toContain("Double=1.1"); - expect(queryString).toContain("DoubleList=1.1"); - expect(queryString).toContain("DoubleList=2.1"); - expect(queryString).toContain("DoubleList=3.1"); - expect(queryString).toContain("Boolean=true"); - expect(queryString).toContain("BooleanList=true"); - expect(queryString).toContain("BooleanList=false"); - expect(queryString).toContain("BooleanList=true"); - expect(queryString).toContain("Timestamp=1970-01-01T00%3A00%3A01Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A01Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A02Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A03Z"); - expect(queryString).toContain("Enum=Foo"); - expect(queryString).toContain("EnumList=Foo"); - expect(queryString).toContain("EnumList=Baz"); - expect(queryString).toContain("EnumList=Bar"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Handles query string maps - */ -it("RestJsonQueryStringMap:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryParamsMapOfStringList: { - QueryParamsStringKeyA: ["Foo"], - - QueryParamsStringKeyB: ["Bar"], - } as any, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("QueryParamsStringKeyA=Foo"); - expect(queryString).toContain("QueryParamsStringKeyB=Bar"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Handles escaping all required characters in the query string. - */ -it("RestJsonQueryStringEscaping:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryString: "%:/?#[]@!$&'()*+,;=😹", - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("String=%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling NaN float query values. - */ -it("RestJsonSupportsNaNFloatQueryValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: NaN, - - queryDouble: NaN, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=NaN"); - expect(queryString).toContain("Double=NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float query values. - */ -it("RestJsonSupportsInfinityFloatQueryValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: Infinity, - - queryDouble: Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=Infinity"); - expect(queryString).toContain("Double=Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float query values. - */ -it("RestJsonSupportsNegativeInfinityFloatQueryValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: -Infinity, - - queryDouble: -Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=-Infinity"); - expect(queryString).toContain("Double=-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Mixes constant and variable query string parameters - */ -it("RestJsonConstantAndVariableQueryStringMissingOneValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantAndVariableQueryStringCommand({ - baz: "bam", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantAndVariableQueryString"); - - expect(r.query["maybeSet"]).toBeUndefined(); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("baz=bam"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Mixes constant and variable query string parameters - */ -it("RestJsonConstantAndVariableQueryStringAllValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantAndVariableQueryStringCommand({ - baz: "bam", - - maybeSet: "yes", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantAndVariableQueryString"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("baz=bam"); - expect(queryString).toContain("maybeSet=yes"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Includes constant query string parameters - */ -it("RestJsonConstantQueryString:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantQueryStringCommand({ - hello: "hi", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantQueryString/hi"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("hello"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes document types as part of the JSON request payload with no escaping. - */ -it("DocumentTypeInputWithObject:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeCommand({ - stringValue: "string", - - documentValue: { - foo: "bar", - }, - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"documentValue\": { - \"foo\": \"bar\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes document types using a string. - */ -it("DocumentInputWithString:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeCommand({ - stringValue: "string", - - documentValue: "hello", - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"documentValue\": \"hello\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes document types using a number. - */ -it("DocumentInputWithNumber:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeCommand({ - stringValue: "string", - - documentValue: 10, - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"documentValue\": 10 - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes document types using a boolean. - */ -it("DocumentInputWithBoolean:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeCommand({ - stringValue: "string", - - documentValue: true, - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"documentValue\": true - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes document types using a list. - */ -it("DocumentInputWithList:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeCommand({ - stringValue: "string", - - documentValue: [ - true, - - "hi", - - [ - 1, - - 2, - ], - - { - foo: { - baz: [3, 4], - }, - }, - ], - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"documentValue\": [ - true, - \"hi\", - [ - 1, - 2 - ], - { - \"foo\": { - \"baz\": [ - 3, - 4 - ] - } - } - ] - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes documents as part of the JSON response payload with no escaping. - */ -it("DocumentOutput:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "documentValue": { - "foo": "bar" - } - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - documentValue: { - foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Document types can be JSON scalars too. - */ -it("DocumentOutputString:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "documentValue": "hello" - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - documentValue: "hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Document types can be JSON scalars too. - */ -it("DocumentOutputNumber:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "documentValue": 10 - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - documentValue: 10, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Document types can be JSON scalars too. - */ -it("DocumentOutputBoolean:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "documentValue": false - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - documentValue: false, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Document types can be JSON arrays. - */ -it("DocumentOutputArray:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "documentValue": [ - true, - false - ] - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringValue: "string", - - documentValue: [true, false], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a document as the target of the httpPayload trait. - */ -it("DocumentTypeAsPayloadInput:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeAsPayloadCommand({ - documentValue: { - foo: "bar", - }, - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentTypeAsPayload"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"foo\": \"bar\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a document as the target of the httpPayload trait using a string. - */ -it("DocumentTypeAsPayloadInputString:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new DocumentTypeAsPayloadCommand({ - documentValue: "hello", - } as any); - 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("PUT"); - expect(r.path).toBe("/DocumentTypeAsPayload"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `\"hello\"`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a document as the target of the httpPayload trait. - */ -it("DocumentTypeAsPayloadOutput:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "foo": "bar" - }` - ), - }); - - const params: any = {}; - const command = new DocumentTypeAsPayloadCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - documentValue: { - foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a document as a payload string. - */ -it("DocumentTypeAsPayloadOutputString:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `"hello"` - ), - }); - - const params: any = {}; - const command = new DocumentTypeAsPayloadCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - documentValue: "hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Clients should not serialize a JSON payload when no parameters - * are given that are sent in the body. A service will tolerate - * clients that omit a payload or that send a JSON object. - */ -it("RestJsonEmptyInputAndEmptyOutput:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyInputAndEmptyOutputCommand({} as any); - 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("/EmptyInputAndEmptyOutput"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * As of January 2021, server implementations are expected to - * respond with a JSON object regardless of if the output - * parameters are empty. - */ -it("RestJsonEmptyInputAndEmptyOutput:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * This test ensures that clients can gracefully handle - * situations where a service omits a JSON payload entirely. - */ -it("RestJsonEmptyInputAndEmptyOutputJsonObjectOutput:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("RestJsonEndpointTrait:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/EndpointOperation"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("RestJsonEndpointTraitWithHostLabel:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/EndpointWithHostLabelOperation"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{\"label\": \"bar\"}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that operations with errors successfully know how - * to deserialize a successful response. As of January 2021, - * server implementations are expected to respond with a - * JSON object regardless of if the output parameters are - * empty. - */ -it("RestJsonGreetingWithErrors:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-greeting": "Hello", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - greeting: "Hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * This test is similar to RestJsonGreetingWithErrors, but it - * ensures that clients can gracefully deal with a server - * omitting a response payload. - */ -it("RestJsonGreetingWithErrorsNoPayload:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-greeting": "Hello", - }, - `` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - greeting: "Hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. - */ -it("RestJsonFooErrorUsingXAmznErrorType:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/' - * is to be interpreted as 'ValidationException'. - * - * For an example service see Amazon Polly. - */ -it("RestJsonFooErrorUsingXAmznErrorTypeWithUri:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service. - */ -it("RestJsonFooErrorUsingXAmznErrorTypeWithUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(false, 500, { - "x-amzn-errortype": - "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/", - }), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property. - * - * For example service see Amazon S3 Glacier. - */ -it("RestJsonFooErrorUsingCode:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "code": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("RestJsonFooErrorUsingCodeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "code": "aws.protocoltests.restjson#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("RestJsonFooErrorUsingCodeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "code": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type. - */ -it("RestJsonFooErrorWithDunderType:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "__type": "FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'. - */ -it("RestJsonFooErrorWithDunderTypeAndNamespace:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "__type": "aws.protocoltests.restjson#FooError" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service. - */ -it("RestJsonFooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 500, - { - "content-type": "application/json", - }, - `{ - "__type": "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "FooError") { - console.log(err); - fail(`Expected a FooError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(500); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Serializes a complex error with no message member - */ -it("RestJsonComplexErrorWithNoMessage:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 403, - { - "x-amzn-errortype": "ComplexError", - "x-header": "Header", - "content-type": "application/json", - }, - `{ - "TopLevel": "Top level", - "Nested": { - "Fooooo": "bar" - } - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(403); - const paramsToValidate: any = [ - { - Header: "Header", - - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -it("RestJsonEmptyComplexErrorWithNoMessage:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 403, - { - "x-amzn-errortype": "ComplexError", - "content-type": "application/json", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(403); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Parses simple JSON errors - */ -it("RestJsonInvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "x-amzn-errortype": "InvalidGreeting", - "content-type": "application/json", - }, - `{ - "Message": "Hi" - }` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Custom endpoints supplied by users can have paths - */ -it("RestJsonHostWithPath:Request", async () => { - const client = new RestJsonProtocolClient({ - ...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("GET"); - expect(r.path).toBe("/custom/HostWithPathOperation"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Adds Content-MD5 header - */ -it("RestJsonHttpChecksumRequired:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpChecksumRequiredCommand({ - foo: "base64 encoded md5 checksum", - } as any); - 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("/HttpChecksumRequired"); - - expect(r.headers["content-md5"]).toBeDefined(); - expect(r.headers["content-md5"]).toBe("iB0/3YSo7maijL0IGOgA9g=="); - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"foo\":\"base64 encoded md5 checksum\" - } - `; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -it("EnumPayloadRequest:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpEnumPayloadCommand({ - payload: "enumvalue", - } as any); - 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("/EnumPayload"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `enumvalue`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -it("EnumPayloadResponse:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `enumvalue`), - }); - - const params: any = {}; - const command = new HttpEnumPayloadCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - payload: "enumvalue", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("RestJsonHttpPayloadTraitsWithBlob:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/HttpPayloadTraits"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/octet-stream"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonHttpPayloadTraitsWithNoBlobBody:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsCommand({ - foo: "Foo", - } as any); - 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("/HttpPayloadTraits"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("RestJsonHttpPayloadTraitsWithBlob:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonHttpPayloadTraitsWithNoBlobBody:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("RestJsonHttpPayloadTraitsWithMediaTypeWithBlob:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsWithMediaTypeCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/HttpPayloadTraitsWithMediaType"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("text/plain"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("RestJsonHttpPayloadTraitsWithMediaTypeWithBlob:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "text/plain", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsWithMediaTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload - */ -it("RestJsonHttpPayloadWithStructure:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithStructureCommand({ - nested: { - greeting: "hello", - - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithStructure"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"greeting\": \"hello\", - \"name\": \"Phreddy\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload - */ -it("RestJsonHttpPayloadWithStructure:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "greeting": "hello", - "name": "Phreddy" - }` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithStructureCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - greeting: "hello", - - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Adds headers by prefix - */ -it("RestJsonHttpPrefixHeadersArePresent:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPrefixHeadersCommand({ - foo: "Foo", - - fooMap: { - Abc: "Abc value", - - Def: "Def value", - } as any, - } as any); - 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("GET"); - expect(r.path).toBe("/HttpPrefixHeaders"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - expect(r.headers["x-foo-abc"]).toBeDefined(); - expect(r.headers["x-foo-abc"]).toBe("Abc value"); - expect(r.headers["x-foo-def"]).toBeDefined(); - expect(r.headers["x-foo-def"]).toBe("Def value"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * No prefix headers are serialized because the value is empty - */ -it("RestJsonHttpPrefixHeadersAreNotPresent:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPrefixHeadersCommand({ - foo: "Foo", - - fooMap: {} as any, - } as any); - 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("GET"); - expect(r.path).toBe("/HttpPrefixHeaders"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Adds headers by prefix - */ -it("RestJsonHttpPrefixHeadersArePresent:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-foo": "Foo", - "x-foo-abc": "Abc value", - "x-foo-def": "Def value", - }), - }); - - const params: any = {}; - const command = new HttpPrefixHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - fooMap: { - abc: "Abc value", - - def: "Def value", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * (de)serializes all response headers - */ -it("HttpPrefixHeadersResponse:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-foo": "Foo", - hello: "Hello", - }), - }); - - const params: any = {}; - const command = new HttpPrefixHeadersResponseCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - prefixHeaders: { - "x-foo": "Foo", - - hello: "Hello", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float label values. - */ -it("RestJsonSupportsNaNFloatLabels:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: NaN, - - double: NaN, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/NaN/NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float label values. - */ -it("RestJsonSupportsInfinityFloatLabels:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: Infinity, - - double: Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/Infinity/Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float label values. - */ -it("RestJsonSupportsNegativeInfinityFloatLabels:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: -Infinity, - - double: -Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/-Infinity/-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes greedy labels and normal labels - */ -it("RestJsonHttpRequestWithGreedyLabelInPath:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithGreedyLabelInPathCommand({ - foo: "hello/escape", - - baz: "there/guy", - } as any); - 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("GET"); - expect(r.path).toBe("/HttpRequestWithGreedyLabelInPath/foo/hello%2Fescape/baz/there/guy"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Sends a GET request that uses URI label bindings - */ -it("RestJsonInputWithHeadersAndAllParams:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithLabelsCommand({ - string: "string", - - short: 1, - - integer: 2, - - long: 3, - - float: 4.1, - - double: 5.1, - - boolean: true, - - timestamp: new Date(1576540098000), - } as any); - 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("GET"); - expect(r.path).toBe("/HttpRequestWithLabels/string/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Sends a GET request that uses URI label bindings - */ -it("RestJsonHttpRequestLabelEscaping:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithLabelsCommand({ - string: "%:/?#[]@!$&'()*+,;=😹", - - short: 1, - - integer: 2, - - long: 3, - - float: 4.1, - - double: 5.1, - - boolean: true, - - timestamp: new Date(1576540098000), - } as any); - 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("GET"); - expect(r.path).toBe( - "/HttpRequestWithLabels/%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z" - ); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes different timestamp formats in URI labels - */ -it("RestJsonHttpRequestWithLabelsAndTimestampFormat:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithLabelsAndTimestampFormatCommand({ - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - } as any); - 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("GET"); - expect(r.path).toBe( - "/HttpRequestWithLabelsAndTimestampFormat/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z/2019-12-16T23%3A48%3A18Z/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z" - ); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Binds the http response code to an output structure. Note that - * even though all members are bound outside of the payload, an - * empty JSON object is serialized in the response. However, - * clients should be able to handle an empty JSON object or an - * empty payload without failing to deserialize a response. - */ -it("RestJsonHttpResponseCode:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 201, - { - "content-type": "application/json", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new HttpResponseCodeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(201); - const paramsToValidate: any = [ - { - Status: 201, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * This test ensures that clients gracefully handle cases where - * the service responds with no payload rather than an empty JSON - * object. - */ -it("RestJsonHttpResponseCodeWithNoPayload:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 201, undefined, ``), - }); - - const params: any = {}; - const command = new HttpResponseCodeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(201); - const paramsToValidate: any = [ - { - Status: 201, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -it("StringPayloadRequest:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpStringPayloadCommand({ - payload: "rawstring", - } as any); - 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("/StringPayload"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `rawstring`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -it("StringPayloadResponse:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `rawstring`), - }); - - const params: any = {}; - const command = new HttpStringPayloadCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - payload: "rawstring", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Query parameters must be ignored when serializing the output - * of an operation. As of January 2021, server implementations - * are expected to respond with a JSON object regardless of - * if the output parameters are empty. - */ -it("RestJsonIgnoreQueryParamsInResponse:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new IgnoreQueryParamsInResponseCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * This test is similar to RestJsonIgnoreQueryParamsInResponse, - * but it ensures that clients gracefully handle responses from - * the server that do not serialize an empty JSON object. - */ -it("RestJsonIgnoreQueryParamsInResponseNoPayload:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new IgnoreQueryParamsInResponseCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Tests requests with string header bindings - */ -it("RestJsonInputAndOutputWithStringHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerString: "Hello", - - headerStringList: ["a", "b", "c"], - - headerStringSet: ["a", "b", "c"], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-string"]).toBeDefined(); - expect(r.headers["x-string"]).toBe("Hello"); - expect(r.headers["x-stringlist"]).toBeDefined(); - expect(r.headers["x-stringlist"]).toBe("a, b, c"); - expect(r.headers["x-stringset"]).toBeDefined(); - expect(r.headers["x-stringset"]).toBe("a, b, c"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with numeric header bindings - */ -it("RestJsonInputAndOutputWithNumericHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerByte: 1, - - headerShort: 123, - - headerInteger: 123, - - headerLong: 123, - - headerFloat: 1.1, - - headerDouble: 1.1, - - headerIntegerList: [ - 1, - - 2, - - 3, - ], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-byte"]).toBeDefined(); - expect(r.headers["x-byte"]).toBe("1"); - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("1.1"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("1.1"); - expect(r.headers["x-integer"]).toBeDefined(); - expect(r.headers["x-integer"]).toBe("123"); - expect(r.headers["x-integerlist"]).toBeDefined(); - expect(r.headers["x-integerlist"]).toBe("1, 2, 3"); - expect(r.headers["x-long"]).toBeDefined(); - expect(r.headers["x-long"]).toBe("123"); - expect(r.headers["x-short"]).toBeDefined(); - expect(r.headers["x-short"]).toBe("123"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with boolean header bindings - */ -it("RestJsonInputAndOutputWithBooleanHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerTrueBool: true, - - headerFalseBool: false, - - headerBooleanList: [true, false, true], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-boolean1"]).toBeDefined(); - expect(r.headers["x-boolean1"]).toBe("true"); - expect(r.headers["x-boolean2"]).toBeDefined(); - expect(r.headers["x-boolean2"]).toBe("false"); - expect(r.headers["x-booleanlist"]).toBeDefined(); - expect(r.headers["x-booleanlist"]).toBe("true, false, true"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with timestamp header bindings - */ -it("RestJsonInputAndOutputWithTimestampHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-timestamplist"]).toBeDefined(); - expect(r.headers["x-timestamplist"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with enum header bindings - */ -it("RestJsonInputAndOutputWithEnumHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerEnum: "Foo", - - headerEnumList: ["Foo", "Bar", "Baz"], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-enum"]).toBeDefined(); - expect(r.headers["x-enum"]).toBe("Foo"); - expect(r.headers["x-enumlist"]).toBeDefined(); - expect(r.headers["x-enumlist"]).toBe("Foo, Bar, Baz"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling NaN float header values. - */ -it("RestJsonSupportsNaNFloatHeaderInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: NaN, - - headerDouble: NaN, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("NaN"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float header values. - */ -it("RestJsonSupportsInfinityFloatHeaderInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: Infinity, - - headerDouble: Infinity, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("Infinity"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float header values. - */ -it("RestJsonSupportsNegativeInfinityFloatHeaderInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: -Infinity, - - headerDouble: -Infinity, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("-Infinity"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests responses with string header bindings - */ -it("RestJsonInputAndOutputWithStringHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-stringlist": "a, b, c", - "x-stringset": "a, b, c", - "x-string": "Hello", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerString: "Hello", - - headerStringList: ["a", "b", "c"], - - headerStringSet: ["a", "b", "c"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with numeric header bindings - */ -it("RestJsonInputAndOutputWithNumericHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-float": "1.1", - "x-byte": "1", - "x-long": "123", - "x-integer": "123", - "x-integerlist": "1, 2, 3", - "x-double": "1.1", - "x-short": "123", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerByte: 1, - - headerShort: 123, - - headerInteger: 123, - - headerLong: 123, - - headerFloat: 1.1, - - headerDouble: 1.1, - - headerIntegerList: [ - 1, - - 2, - - 3, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with boolean header bindings - */ -it("RestJsonInputAndOutputWithBooleanHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-booleanlist": "true, false, true", - "x-boolean1": "true", - "x-boolean2": "false", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerTrueBool: true, - - headerFalseBool: false, - - headerBooleanList: [true, false, true], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with timestamp header bindings - */ -it("RestJsonInputAndOutputWithTimestampHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-timestamplist": "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with enum header bindings - */ -it("RestJsonInputAndOutputWithEnumHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-enumlist": "Foo, Bar, Baz", - "x-enum": "Foo", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerEnum: "Foo", - - headerEnumList: ["Foo", "Bar", "Baz"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float header values. - */ -it("RestJsonSupportsNaNFloatHeaderOutputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-float": "NaN", - "x-double": "NaN", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: NaN, - - headerDouble: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float header values. - */ -it("RestJsonSupportsInfinityFloatHeaderOutputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-float": "Infinity", - "x-double": "Infinity", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: Infinity, - - headerDouble: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float header values. - */ -it("RestJsonSupportsNegativeInfinityFloatHeaderOutputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-float": "-Infinity", - "x-double": "-Infinity", - }), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: -Infinity, - - headerDouble: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Blobs are base64 encoded - */ -it("RestJsonJsonBlobs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonBlobsCommand({ - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - } as any); - 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("/JsonBlobs"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"data\": \"dmFsdWU=\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Blobs are base64 encoded - */ -it("RestJsonJsonBlobs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "data": "dmFsdWU=" - }` - ), - }); - - const params: any = {}; - const command = new JsonBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("RestJsonJsonEnums:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonEnumsCommand({ - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonEnums"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"fooEnum1\": \"Foo\", - \"fooEnum2\": \"0\", - \"fooEnum3\": \"1\", - \"fooEnumList\": [ - \"Foo\", - \"0\" - ], - \"fooEnumSet\": [ - \"Foo\", - \"0\" - ], - \"fooEnumMap\": { - \"hi\": \"Foo\", - \"zero\": \"0\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("RestJsonJsonEnums:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "fooEnum1": "Foo", - "fooEnum2": "0", - "fooEnum3": "1", - "fooEnumList": [ - "Foo", - "0" - ], - "fooEnumSet": [ - "Foo", - "0" - ], - "fooEnumMap": { - "hi": "Foo", - "zero": "0" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonEnumsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes JSON lists - */ -it("RestJsonLists:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonListsCommand({ - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - structureList: [ - { - a: "1", - - b: "2", - } as any, - - { - a: "3", - - b: "4", - } as any, - ], - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonLists"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringList\": [ - \"foo\", - \"bar\" - ], - \"stringSet\": [ - \"foo\", - \"bar\" - ], - \"integerList\": [ - 1, - 2 - ], - \"booleanList\": [ - true, - false - ], - \"timestampList\": [ - 1398796238, - 1398796238 - ], - \"enumList\": [ - \"Foo\", - \"0\" - ], - \"nestedStringList\": [ - [ - \"foo\", - \"bar\" - ], - [ - \"baz\", - \"qux\" - ] - ], - \"myStructureList\": [ - { - \"value\": \"1\", - \"other\": \"2\" - }, - { - \"value\": \"3\", - \"other\": \"4\" - } - ] - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes empty JSON lists - */ -it("RestJsonListsEmpty:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonListsCommand({ - stringList: [], - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonLists"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringList\": [] - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes null values in lists - */ -it("RestJsonListsSerializeNull:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonListsCommand({ - sparseStringList: [null, "hi"], - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonLists"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseStringList\": [ - null, - \"hi\" - ] - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes JSON lists - */ -it("RestJsonLists:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringList": [ - "foo", - "bar" - ], - "stringSet": [ - "foo", - "bar" - ], - "integerList": [ - 1, - 2 - ], - "booleanList": [ - true, - false - ], - "timestampList": [ - 1398796238, - 1398796238 - ], - "enumList": [ - "Foo", - "0" - ], - "nestedStringList": [ - [ - "foo", - "bar" - ], - [ - "baz", - "qux" - ] - ], - "myStructureList": [ - { - "value": "1", - "other": "2" - }, - { - "value": "3", - "other": "4" - } - ] - }` - ), - }); - - const params: any = {}; - const command = new JsonListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - structureList: [ - { - a: "1", - - b: "2", - }, - - { - a: "3", - - b: "4", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes empty JSON lists - */ -it("RestJsonListsEmpty:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringList": [] - }` - ), - }); - - const params: any = {}; - const command = new JsonListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: [], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes null values in sparse lists - */ -it("RestJsonListsSerializeNull:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "sparseStringList": [ - null, - "hi" - ] - }` - ), - }); - - const params: any = {}; - const command = new JsonListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseStringList: [null, "hi"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes JSON maps - */ -it("RestJsonJsonMaps:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - denseStructMap: { - foo: { - hi: "there", - } as any, - - baz: { - hi: "bye", - } as any, - } as any, - - sparseStructMap: { - foo: { - hi: "there", - } as any, - - baz: { - hi: "bye", - } as any, - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"denseStructMap\": { - \"foo\": { - \"hi\": \"there\" - }, - \"baz\": { - \"hi\": \"bye\" - } - }, - \"sparseStructMap\": { - \"foo\": { - \"hi\": \"there\" - }, - \"baz\": { - \"hi\": \"bye\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes JSON map values in sparse maps - */ -it("RestJsonSerializesNullMapValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - sparseBooleanMap: { - x: null, - } as any, - - sparseNumberMap: { - x: null, - } as any, - - sparseStringMap: { - x: null, - } as any, - - sparseStructMap: { - x: null, - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseBooleanMap\": { - \"x\": null - }, - \"sparseNumberMap\": { - \"x\": null - }, - \"sparseStringMap\": { - \"x\": null - }, - \"sparseStructMap\": { - \"x\": null - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensure that 0 and false are sent over the wire in all maps and lists - */ -it("RestJsonSerializesZeroValuesInMaps:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - denseNumberMap: { - x: 0, - } as any, - - sparseNumberMap: { - x: 0, - } as any, - - denseBooleanMap: { - x: false, - } as any, - - sparseBooleanMap: { - x: false, - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"denseNumberMap\": { - \"x\": 0 - }, - \"sparseNumberMap\": { - \"x\": 0 - }, - \"denseBooleanMap\": { - \"x\": false - }, - \"sparseBooleanMap\": { - \"x\": false - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * A request that contains a sparse map of sets - */ -it("RestJsonSerializesSparseSetMap:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - sparseSetMap: { - x: [], - - y: ["a", "b"], - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"] - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * A request that contains a dense map of sets. - */ -it("RestJsonSerializesDenseSetMap:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - denseSetMap: { - x: [], - - y: ["a", "b"], - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"denseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"] - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * A request that contains a sparse map of sets. - */ -it("RestJsonSerializesSparseSetMapAndRetainsNull:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonMapsCommand({ - sparseSetMap: { - x: [], - - y: ["a", "b"], - - z: null, - } as any, - } as any); - 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("/JsonMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"sparseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"], - \"z\": null - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes JSON maps - */ -it("RestJsonJsonMaps:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "denseStructMap": { - "foo": { - "hi": "there" - }, - "baz": { - "hi": "bye" - } - }, - "sparseStructMap": { - "foo": { - "hi": "there" - }, - "baz": { - "hi": "bye" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - denseStructMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - - sparseStructMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes null JSON map values - */ -it("RestJsonDeserializesNullMapValues:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "sparseBooleanMap": { - "x": null - }, - "sparseNumberMap": { - "x": null - }, - "sparseStringMap": { - "x": null - }, - "sparseStructMap": { - "x": null - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseBooleanMap: { - x: null, - }, - - sparseNumberMap: { - x: null, - }, - - sparseStringMap: { - x: null, - }, - - sparseStructMap: { - x: null, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensure that 0 and false are sent over the wire in all maps and lists - */ -it("RestJsonDeserializesZeroValuesInMaps:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "denseNumberMap": { - "x": 0 - }, - "sparseNumberMap": { - "x": 0 - }, - "denseBooleanMap": { - "x": false - }, - "sparseBooleanMap": { - "x": false - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - denseNumberMap: { - x: 0, - }, - - sparseNumberMap: { - x: 0, - }, - - denseBooleanMap: { - x: false, - }, - - sparseBooleanMap: { - x: false, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * A response that contains a sparse map of sets - */ -it("RestJsonDeserializesSparseSetMap:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "sparseSetMap": { - "x": [], - "y": ["a", "b"] - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseSetMap: { - x: [], - - y: ["a", "b"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * A response that contains a dense map of sets. - */ -it("RestJsonDeserializesDenseSetMap:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "denseSetMap": { - "x": [], - "y": ["a", "b"] - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - denseSetMap: { - x: [], - - y: ["a", "b"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * A response that contains a sparse map of sets. - */ -it("RestJsonDeserializesSparseSetMapAndRetainsNull:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "sparseSetMap": { - "x": [], - "y": ["a", "b"], - "z": null - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - sparseSetMap: { - x: [], - - y: ["a", "b"], - - z: null, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Clients SHOULD tolerate seeing a null value in a dense map, and they SHOULD - * drop the null key-value pair. - */ -it("RestJsonDeserializesDenseSetMapAndSkipsNull:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "denseSetMap": { - "x": [], - "y": ["a", "b"], - "z": null - } - }` - ), - }); - - const params: any = {}; - const command = new JsonMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - denseSetMap: { - x: [], - - y: ["a", "b"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests how normal timestamps are serialized - */ -it("RestJsonJsonTimestamps:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonTimestampsCommand({ - normal: new Date(1398796238000), - } as any); - 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("/JsonTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"normal\": 1398796238 - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("RestJsonJsonTimestampsWithDateTimeFormat:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonTimestampsCommand({ - dateTime: new Date(1398796238000), - } as any); - 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("/JsonTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"dateTime\": \"2014-04-29T18:30:38Z\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("RestJsonJsonTimestampsWithEpochSecondsFormat:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonTimestampsCommand({ - epochSeconds: new Date(1398796238000), - } as any); - 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("/JsonTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"epochSeconds\": 1398796238 - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("RestJsonJsonTimestampsWithHttpDateFormat:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonTimestampsCommand({ - httpDate: new Date(1398796238000), - } as any); - 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("/JsonTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"httpDate\": \"Tue, 29 Apr 2014 18:30:38 GMT\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests how normal timestamps are serialized - */ -it("RestJsonJsonTimestamps:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "normal": 1398796238 - }` - ), - }); - - const params: any = {}; - const command = new JsonTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - normal: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("RestJsonJsonTimestampsWithDateTimeFormat:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "dateTime": "2014-04-29T18:30:38Z" - }` - ), - }); - - const params: any = {}; - const command = new JsonTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - dateTime: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("RestJsonJsonTimestampsWithEpochSecondsFormat:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "epochSeconds": 1398796238 - }` - ), - }); - - const params: any = {}; - const command = new JsonTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - epochSeconds: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("RestJsonJsonTimestampsWithHttpDateFormat:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "httpDate": "Tue, 29 Apr 2014 18:30:38 GMT" - }` - ), - }); - - const params: any = {}; - const command = new JsonTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - httpDate: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a string union value - */ -it("RestJsonSerializeStringUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - stringValue: "foo", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"stringValue\": \"foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a boolean union value - */ -it("RestJsonSerializeBooleanUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - booleanValue: true, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"booleanValue\": true - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a number union value - */ -it("RestJsonSerializeNumberUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - numberValue: 1, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"numberValue\": 1 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob union value - */ -it("RestJsonSerializeBlobUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"blobValue\": \"Zm9v\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a timestamp union value - */ -it("RestJsonSerializeTimestampUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - timestampValue: new Date(1398796238000), - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"timestampValue\": 1398796238 - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an enum union value - */ -it("RestJsonSerializeEnumUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - enumValue: "Foo", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"enumValue\": \"Foo\" - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a list union value - */ -it("RestJsonSerializeListUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - listValue: ["foo", "bar"], - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"listValue\": [\"foo\", \"bar\"] - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a map union value - */ -it("RestJsonSerializeMapUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"mapValue\": { - \"foo\": \"bar\", - \"spam\": \"eggs\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure union value - */ -it("RestJsonSerializeStructureUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - structureValue: { - hi: "hello", - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"structureValue\": { - \"hi\": \"hello\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a renamed structure union value - */ -it("RestJsonSerializeRenamedStructureUnionValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new JsonUnionsCommand({ - contents: { - renamedStructureValue: { - salutation: "hello!", - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/JsonUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"contents\": { - \"renamedStructureValue\": { - \"salutation\": \"hello!\" - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes a string union value - */ -it("RestJsonDeserializeStringUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "stringValue": "foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - stringValue: "foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a boolean union value - */ -it("RestJsonDeserializeBooleanUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "booleanValue": true - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - booleanValue: true, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a number union value - */ -it("RestJsonDeserializeNumberUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "numberValue": 1 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - numberValue: 1, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a blob union value - */ -it("RestJsonDeserializeBlobUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "blobValue": "Zm9v" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - blobValue: Uint8Array.from("foo", (c) => c.charCodeAt(0)), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a timestamp union value - */ -it("RestJsonDeserializeTimestampUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "timestampValue": 1398796238 - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - timestampValue: new Date(1398796238000), - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes an enum union value - */ -it("RestJsonDeserializeEnumUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "enumValue": "Foo" - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - enumValue: "Foo", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a list union value - */ -it("RestJsonDeserializeListUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "listValue": ["foo", "bar"] - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - listValue: ["foo", "bar"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a map union value - */ -it("RestJsonDeserializeMapUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "mapValue": { - "foo": "bar", - "spam": "eggs" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - mapValue: { - foo: "bar", - - spam: "eggs", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes a structure union value - */ -it("RestJsonDeserializeStructureUnionValue:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "contents": { - "structureValue": { - "hi": "hello" - } - } - }` - ), - }); - - const params: any = {}; - const command = new JsonUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - contents: { - structureValue: { - hi: "hello", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Headers that target strings with a mediaType are base64 encoded - */ -it("MediaTypeHeaderInputBase64:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new MediaTypeHeaderCommand({ - json: "true", - } as any); - 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("GET"); - expect(r.path).toBe("/MediaTypeHeader"); - - expect(r.headers["x-json"]).toBeDefined(); - expect(r.headers["x-json"]).toBe("dHJ1ZQ=="); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Headers that target strings with a mediaType are base64 encoded - */ -it("MediaTypeHeaderOutputBase64:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-json": "dHJ1ZQ==", - }), - }); - - const params: any = {}; - const command = new MediaTypeHeaderCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - json: "true", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * No input serializes no payload. When clients do not need to - * serialize any data in the payload, they should omit a payload - * altogether. - */ -it("RestJsonNoInputAndNoOutput:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndNoOutputCommand({}); - 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("/NoInputAndNoOutput"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * When an operation does not define output, the service will respond - * with an empty payload, and may optionally include the content-type - * header. - */ -it("RestJsonNoInputAndNoOutput:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * No input serializes no payload. When clients do not need to - * serialize any data in the payload, they should omit a payload - * altogether. - */ -it.skip("RestJsonNoInputAndOutput:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndOutputCommand({}); - 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("/NoInputAndOutputOutput"); - - expect(r.headers["accept"]).toBeDefined(); - expect(r.headers["accept"]).toBe("application/json"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Operations that define output and do not bind anything to - * the payload return a JSON object in the response. - */ -it("RestJsonNoInputAndOutputWithJson:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{}` - ), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * This test is similar to RestJsonNoInputAndOutputWithJson, but - * it ensures that clients can gracefully handle responses that - * omit a JSON payload. - */ -it("RestJsonNoInputAndOutputNoPayload:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Do not send null values, empty strings, or empty lists over the wire in headers - */ -it("RestJsonNullAndEmptyHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NullAndEmptyHeadersClientCommand({ - a: null, - - b: "", - - c: [], - } as any); - 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("GET"); - expect(r.path).toBe("/NullAndEmptyHeadersClient"); - - expect(r.headers["x-a"]).toBeUndefined(); - expect(r.headers["x-b"]).toBeUndefined(); - expect(r.headers["x-c"]).toBeUndefined(); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Omits null query values - */ -it("RestJsonOmitsNullQuery:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OmitsNullSerializesEmptyStringCommand({ - nullValue: null, - } as any); - 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("GET"); - expect(r.path).toBe("/OmitsNullSerializesEmptyString"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes empty query strings - */ -it("RestJsonSerializesEmptyQueryValue:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OmitsNullSerializesEmptyStringCommand({ - emptyString: "", - } as any); - 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("GET"); - expect(r.path).toBe("/OmitsNullSerializesEmptyString"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Empty="); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Automatically adds idempotency token when not set - */ -it("RestJsonQueryIdempotencyTokenAutoFill:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/QueryIdempotencyTokenAutoFill"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Uses the given idempotency token as-is - */ -it("RestJsonQueryIdempotencyTokenAutoFillIsSet:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/QueryIdempotencyTokenAutoFill"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serialize query params from map of list strings - */ -it("RestJsonQueryParamsStringListMap:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryParamsAsStringListMapCommand({ - qux: "named", - - foo: { - baz: ["bar", "qux"], - } as any, - } as any); - 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("/StringListMap"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("corge=named"); - expect(queryString).toContain("baz=bar"); - expect(queryString).toContain("baz=qux"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Prefer named query parameters when serializing - */ -it("RestJsonQueryPrecedence:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryPrecedenceCommand({ - foo: "named", - - baz: { - bar: "fromMap", - - qux: "alsoFromMap", - } as any, - } as any); - 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("/Precedence"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("bar=named"); - expect(queryString).toContain("qux=alsoFromMap"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes recursive structures - */ -it("RestJsonRecursiveShapes:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new RecursiveShapesCommand({ - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - } as any, - } as any, - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/RecursiveShapes"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"nested\": { - \"foo\": \"Foo1\", - \"nested\": { - \"bar\": \"Bar1\", - \"recursiveMember\": { - \"foo\": \"Foo2\", - \"nested\": { - \"bar\": \"Bar2\" - } - } - } - } - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes recursive structures - */ -it("RestJsonRecursiveShapes:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "nested": { - "foo": "Foo1", - "nested": { - "bar": "Bar1", - "recursiveMember": { - "foo": "Foo2", - "nested": { - "bar": "Bar2" - } - } - } - } - }` - ), - }); - - const params: any = {}; - const command = new RecursiveShapesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - }, - }, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("RestJsonSimpleScalarProperties:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - foo: "Foo", - - stringValue: "string", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"stringValue\": \"string\", - \"trueBooleanValue\": true, - \"falseBooleanValue\": false, - \"byteValue\": 1, - \"shortValue\": 2, - \"integerValue\": 3, - \"longValue\": 4, - \"floatValue\": 5.5, - \"DoubleDribble\": 6.5 - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Rest Json should not serialize null structure values - */ -it("RestJsonDoesntSerializeNullStructureValues:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - stringValue: null, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{}`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("RestJsonSupportsNaNFloatInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: NaN, - - doubleValue: NaN, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"NaN\", - \"DoubleDribble\": \"NaN\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("RestJsonSupportsInfinityFloatInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: Infinity, - - doubleValue: Infinity, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"Infinity\", - \"DoubleDribble\": \"Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("RestJsonSupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: -Infinity, - - doubleValue: -Infinity, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/json"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `{ - \"floatValue\": \"-Infinity\", - \"DoubleDribble\": \"-Infinity\" - }`; - const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("RestJsonSimpleScalarProperties:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/json", - }, - `{ - "stringValue": "string", - "trueBooleanValue": true, - "falseBooleanValue": false, - "byteValue": 1, - "shortValue": 2, - "integerValue": 3, - "longValue": 4, - "floatValue": 5.5, - "DoubleDribble": 6.5 - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: "string", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Rest Json should not deserialize null structure values - */ -it("RestJsonDoesntDeserializeNullStructureValues:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "stringValue": null - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Supports handling NaN float values. - */ -it("RestJsonSupportsNaNFloatInputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "floatValue": "NaN", - "DoubleDribble": "NaN" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("RestJsonSupportsInfinityFloatInputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "floatValue": "Infinity", - "DoubleDribble": "Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("RestJsonSupportsNegativeInfinityFloatInputs:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "floatValue": "-Infinity", - "DoubleDribble": "-Infinity" - }` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("RestJsonStreamingTraitsWithBlob:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new StreamingTraitsCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/StreamingTraits"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/octet-stream"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonStreamingTraitsWithNoBlobBody:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new StreamingTraitsCommand({ - foo: "Foo", - } as any); - 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("/StreamingTraits"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("RestJsonStreamingTraitsWithBlob:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/octet-stream", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new StreamingTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - const comparableBlob = await client.config.streamCollector(r["blob"]); - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - if (param === "blob") { - expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); - } else { - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - } - }); -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonStreamingTraitsWithNoBlobBody:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new StreamingTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - }, - ][0]; - const comparableBlob = await client.config.streamCollector(r["blob"]); - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - if (param === "blob") { - expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); - } else { - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - } - }); -}); - -/** - * Serializes a blob in the HTTP payload with a required length - */ -it("RestJsonStreamingTraitsRequireLengthWithBlob:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new StreamingTraitsRequireLengthCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/StreamingTraitsRequireLength"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/octet-stream"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonStreamingTraitsRequireLengthWithNoBlobBody:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new StreamingTraitsRequireLengthCommand({ - foo: "Foo", - } as any); - 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("/StreamingTraitsRequireLength"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes a blob in the HTTP payload with a required length - */ -it("RestJsonStreamingTraitsRequireLengthWithBlob:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/octet-stream", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new StreamingTraitsRequireLengthCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - const comparableBlob = await client.config.streamCollector(r["blob"]); - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - if (param === "blob") { - expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); - } else { - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - } - }); -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("RestJsonStreamingTraitsRequireLengthWithNoBlobBody:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new StreamingTraitsRequireLengthCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - }, - ][0]; - const comparableBlob = await client.config.streamCollector(r["blob"]); - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - if (param === "blob") { - expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); - } else { - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - } - }); -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("RestJsonStreamingTraitsWithMediaTypeWithBlob:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new StreamingTraitsWithMediaTypeCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/StreamingTraitsWithMediaType"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("text/plain"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentOctetStreamBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("RestJsonStreamingTraitsWithMediaTypeWithBlob:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "text/plain", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new StreamingTraitsWithMediaTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - const comparableBlob = await client.config.streamCollector(r["blob"]); - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - if (param === "blob") { - expect(equivalentContents(comparableBlob, paramsToValidate[param])).toBe(true); - } else { - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - } - }); -}); - -/** - * Tests how timestamp request headers are serialized - */ -it("RestJsonTimestampFormatHeaders:Request", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new TimestampFormatHeadersCommand({ - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - } as any); - 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("/TimestampFormatHeaders"); - - expect(r.headers["x-defaultformat"]).toBeDefined(); - expect(r.headers["x-defaultformat"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - expect(r.headers["x-memberdatetime"]).toBeDefined(); - expect(r.headers["x-memberdatetime"]).toBe("2019-12-16T23:48:18Z"); - expect(r.headers["x-memberepochseconds"]).toBeDefined(); - expect(r.headers["x-memberepochseconds"]).toBe("1576540098"); - expect(r.headers["x-memberhttpdate"]).toBeDefined(); - expect(r.headers["x-memberhttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - expect(r.headers["x-targetdatetime"]).toBeDefined(); - expect(r.headers["x-targetdatetime"]).toBe("2019-12-16T23:48:18Z"); - expect(r.headers["x-targetepochseconds"]).toBeDefined(); - expect(r.headers["x-targetepochseconds"]).toBe("1576540098"); - expect(r.headers["x-targethttpdate"]).toBeDefined(); - expect(r.headers["x-targethttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests how timestamp response headers are serialized - */ -it("RestJsonTimestampFormatHeaders:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, { - "x-targetepochseconds": "1576540098", - "x-memberdatetime": "2019-12-16T23:48:18Z", - "x-defaultformat": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-memberepochseconds": "1576540098", - "x-targethttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-memberhttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-targetdatetime": "2019-12-16T23:48:18Z", - }), - }); - - const params: any = {}; - const command = new TimestampFormatHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentJsonBodies = (expectedBody: string, generatedBody: string): Object => { - const expectedParts = JSON.parse(expectedBody); - const generatedParts = JSON.parse(generatedBody); - - return compareParts(expectedParts, generatedParts); -}; - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentOctetStreamBodies = ( - utf8Encoder: __Encoder, - expectedBody: string, - generatedBody: Uint8Array -): Object => { - const expectedParts = { Value: expectedBody }; - const generatedParts = { Value: utf8Encoder(generatedBody) }; - - 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-protocoltests-restjson/tsconfig.es.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-restjson/tsconfig.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json b/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-restjson/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-restxml/.gitignore b/protocol_tests/aws-protocoltests-restxml/.gitignore deleted file mode 100644 index bff6121c007d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/node_modules/ -/build/ -/coverage/ -/docs/ -/dist-* -*.tsbuildinfo -*.tgz -*.log -package-lock.json \ No newline at end of file diff --git a/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md b/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md deleted file mode 100644 index 5b159d5d1ef8..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/CHANGELOG.md +++ /dev/null @@ -1,797 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22) - - -### Features - -* **client-documentation-generator:** rename package ([#2916](https://github.com/aws/aws-sdk-js-v3/issues/2916)) ([1a80bfd](https://github.com/aws/aws-sdk-js-v3/commit/1a80bfd2dfc583001ddb4a21b6432eaaad699aa7)) -* **clients:** export folder from index.ts ([#2912](https://github.com/aws/aws-sdk-js-v3/issues/2912)) ([183b46d](https://github.com/aws/aws-sdk-js-v3/commit/183b46dde7f5613128038bf1c076f3c0b693203b)) - - - - - -# [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15) - - -### Features - -* **clients:** update clients as of 10/15/2021 ([#2902](https://github.com/aws/aws-sdk-js-v3/issues/2902)) ([2730b54](https://github.com/aws/aws-sdk-js-v3/commit/2730b5424377944a5a2ad5e1ad7d3ca4135dae1c)) - - - - - -# [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08) - - -### Features - -* publish files in dist-* only ([#2873](https://github.com/aws/aws-sdk-js-v3/issues/2873)) ([53b4243](https://github.com/aws/aws-sdk-js-v3/commit/53b4243b066f25ff2412d5f0dea1036054b2df32)) -* **codegen:** ts-ignore packageInfo imports in codegen ([#2875](https://github.com/aws/aws-sdk-js-v3/issues/2875)) ([99d9267](https://github.com/aws/aws-sdk-js-v3/commit/99d926762193e83a354edec6e9de2b0543449704)) -* **tsconfig:** remove sourceMap ([#2867](https://github.com/aws/aws-sdk-js-v3/issues/2867)) ([d25f526](https://github.com/aws/aws-sdk-js-v3/commit/d25f526627a02a2ca28675fecce66c76b6c97966)) - - - - - -# [3.35.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.34.0...v3.35.0) (2021-10-04) - - -### Bug Fixes - -* **client-s3:** use member xmlname if applicable ([#2835](https://github.com/aws/aws-sdk-js-v3/issues/2835)) ([7e634cf](https://github.com/aws/aws-sdk-js-v3/commit/7e634cfab78d0a82864f828c4c8c10c9d0cccc97)) -* **scripts:** overwrite test folder for protocol_tests ([#2853](https://github.com/aws/aws-sdk-js-v3/issues/2853)) ([5df7d12](https://github.com/aws/aws-sdk-js-v3/commit/5df7d124c4f9825db95c065008d4fd1becf5e23a)) - - -### Features - -* **clients:** eslint --fix using esprint ([#2849](https://github.com/aws/aws-sdk-js-v3/issues/2849)) ([94d0a2d](https://github.com/aws/aws-sdk-js-v3/commit/94d0a2d8a0579ee0a742337937ad05735cfbc1ba)) -* **clients:** move source files to 'src' folder ([#2845](https://github.com/aws/aws-sdk-js-v3/issues/2845)) ([e0025cd](https://github.com/aws/aws-sdk-js-v3/commit/e0025cddbba244a41ddf1fd1adb761142e15c22d)) - - - - - -# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24) - - -### Features - -* **clients:** remove comments from transpiled JS files ([#2817](https://github.com/aws/aws-sdk-js-v3/issues/2817)) ([d01420b](https://github.com/aws/aws-sdk-js-v3/commit/d01420b247966c8ec84c1dd0a1b42512ede10c90)) - - - - - -# [3.33.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.32.0...v3.33.0) (2021-09-21) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.31.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.30.0...v3.31.0) (2021-09-11) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.30.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.29.0...v3.30.0) (2021-09-07) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.29.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.28.0...v3.29.0) (2021-09-02) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.28.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.27.0...v3.28.0) (2021-08-27) - - -### Bug Fixes - -* **clients:** use optional chaining while processing runtime config ([#2690](https://github.com/aws/aws-sdk-js-v3/issues/2690)) ([18469ce](https://github.com/aws/aws-sdk-js-v3/commit/18469cefc27840ba00d516265ebd976f10240496)) - - -### Features - -* **clients:** modular endpoints resolution ([#2704](https://github.com/aws/aws-sdk-js-v3/issues/2704)) ([88de69b](https://github.com/aws/aws-sdk-js-v3/commit/88de69ba28aaedfc7f13fa165044ef8cae023bbe)) - - - - - -# [3.27.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.26.0...v3.27.0) (2021-08-19) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.26.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.25.0...v3.26.0) (2021-08-13) - - -### Bug Fixes - -* **clients:** only trim xml tag values which contain newline ([#2653](https://github.com/aws/aws-sdk-js-v3/issues/2653)) ([28336f5](https://github.com/aws/aws-sdk-js-v3/commit/28336f50cd7181f5805ec036113365d10e9a7a03)) - - - - - -# [3.25.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.24.0...v3.25.0) (2021-08-05) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.24.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.23.0...v3.24.0) (2021-07-29) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.23.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.22.0...v3.23.0) (2021-07-23) - - -### Bug Fixes - -* **clients:** allow undefined configuration ([#2617](https://github.com/aws/aws-sdk-js-v3/issues/2617)) ([a004d15](https://github.com/aws/aws-sdk-js-v3/commit/a004d1569e0b213259c50f72fddfd209fff0d7a3)) -* bump up tslib to 2.3.0 ([#2601](https://github.com/aws/aws-sdk-js-v3/issues/2601)) ([7040faa](https://github.com/aws/aws-sdk-js-v3/commit/7040faac07976c1dcfd5240675b82a2f275b2a55)) - - -### Features - -* **clients:** change runtime config from constant to provider functions ([#2574](https://github.com/aws/aws-sdk-js-v3/issues/2574)) ([5eca565](https://github.com/aws/aws-sdk-js-v3/commit/5eca565b5237a31ee4f18a2ecb4608099ccd55ac)) - - - - - -# [3.22.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.21.0...v3.22.0) (2021-07-16) - - -### Bug Fixes - -* **clients:** link to Hash Interface ([#2573](https://github.com/aws/aws-sdk-js-v3/issues/2573)) ([bb7b3ed](https://github.com/aws/aws-sdk-js-v3/commit/bb7b3edc152f2c33b0e1cf2848aba4231882c36d)) -* **clients:** prefix `dist/` for typesVersions TS<4 ([#2580](https://github.com/aws/aws-sdk-js-v3/issues/2580)) ([dff5cd4](https://github.com/aws/aws-sdk-js-v3/commit/dff5cd4b6fa00453e938ce8f238c1542ee7ba3d6)) - - - - - -# [3.21.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.20.0...v3.21.0) (2021-07-09) - - -### Features - -* **clients:** update clients as of 07/08/2021 ([#2565](https://github.com/aws/aws-sdk-js-v3/issues/2565)) ([c9bd983](https://github.com/aws/aws-sdk-js-v3/commit/c9bd98328765c540b778f9085d0ec8870e5af6c9)) - - - - - -# [3.20.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.19.0...v3.20.0) (2021-07-02) - - -### Bug Fixes - -* replace prepublishOnly script with downlevel-dts ([#2537](https://github.com/aws/aws-sdk-js-v3/issues/2537)) ([63818a1](https://github.com/aws/aws-sdk-js-v3/commit/63818a1e47b08af56f092031a01bbbff0a9af590)) - - - - - -# [3.19.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.18.0...v3.19.0) (2021-06-24) - - -### Bug Fixes - -* **protocol_tests:** format files using prettier v2.3.0 ([#2467](https://github.com/aws/aws-sdk-js-v3/issues/2467)) ([cce6231](https://github.com/aws/aws-sdk-js-v3/commit/cce62317e862f9ebf91ba991c4e2dabb5c59f55a)) - - - - - -# [3.18.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.17.0...v3.18.0) (2021-06-04) - - -### Features - -* **clients:** add retryModeProvider in runtimeConfig ([#2440](https://github.com/aws/aws-sdk-js-v3/issues/2440)) ([fc0a5da](https://github.com/aws/aws-sdk-js-v3/commit/fc0a5dae2c13814d5a0c5fce1d892ce0e97c98e4)) -* **clients:** update clients as of 06/03/2021 ([#2464](https://github.com/aws/aws-sdk-js-v3/issues/2464)) ([14e8fbf](https://github.com/aws/aws-sdk-js-v3/commit/14e8fbf696c9623643e609bfbb702916e36b057a)) - - - - - -# [3.17.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.16.0...v3.17.0) (2021-05-26) - - -### Features - -* **clients:** update endpoint resolution as of 05/12/2021 ([#2398](https://github.com/aws/aws-sdk-js-v3/issues/2398)) ([17afcbb](https://github.com/aws/aws-sdk-js-v3/commit/17afcbb65bb26f091ba258717716272d5dc4e2c7)) - - - - - -# [3.16.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.15.0...v3.16.0) (2021-05-14) - - -### Bug Fixes - -* **clients:** call decode from HTML entities in XML parser ([#2381](https://github.com/aws/aws-sdk-js-v3/issues/2381)) ([fd6b7eb](https://github.com/aws/aws-sdk-js-v3/commit/fd6b7ebd7d3fc4a2ceb3b016404de73413e1fb2f)) - - - - - -# [3.15.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.14.0...v3.15.0) (2021-05-10) - - -### Bug Fixes - -* **middleware-retry:** defaultStrategy handles any error ([#2349](https://github.com/aws/aws-sdk-js-v3/issues/2349)) ([e5b876f](https://github.com/aws/aws-sdk-js-v3/commit/e5b876f56eb97698d7ed9a6b29c3cbedd0187cba)) - - - - - -# [3.14.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.1...v3.14.0) (2021-04-30) - - -### Bug Fixes - -* **clients:** typo in README difference -> different ([#2314](https://github.com/aws/aws-sdk-js-v3/issues/2314)) ([9ac1f40](https://github.com/aws/aws-sdk-js-v3/commit/9ac1f40eea78075e6b301df50cfae17c19ad77c3)) - - -### Features - -* **clients:** update clients as of 04/29/2021 ([#2329](https://github.com/aws/aws-sdk-js-v3/issues/2329)) ([48ab750](https://github.com/aws/aws-sdk-js-v3/commit/48ab75045d1a94adfae94ac638a0dd882ebd05ac)) - - - - - -## [3.13.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.13.0...v3.13.1) (2021-04-22) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.13.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.12.0...v3.13.0) (2021-04-15) - - -### Features - -* remove @aws-sdk/url-parser-native in favor of react-native-url-polyfill ([#2229](https://github.com/aws/aws-sdk-js-v3/issues/2229)) ([d6a67d7](https://github.com/aws/aws-sdk-js-v3/commit/d6a67d7cd471e3440fa7b23ba00b11c00b10a566)) - - - - - -# [3.12.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.11.0...v3.12.0) (2021-04-09) - - -### Bug Fixes - -* run downlevel-dts in prepublishOnly ([#2218](https://github.com/aws/aws-sdk-js-v3/issues/2218)) ([0745502](https://github.com/aws/aws-sdk-js-v3/commit/0745502dcf819460ee1d81362470859674c757a7)) - - -### Features - -* support default role assumers ([#2221](https://github.com/aws/aws-sdk-js-v3/issues/2221)) ([ae17f4c](https://github.com/aws/aws-sdk-js-v3/commit/ae17f4c64f0390c9b879eb27390688ac156cac47)) - - - - - -# [3.11.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.10.0...v3.11.0) (2021-04-01) - - -### Bug Fixes - -* **clients:** trim values in parsed xml only if result is empty ([#2194](https://github.com/aws/aws-sdk-js-v3/issues/2194)) ([a990db7](https://github.com/aws/aws-sdk-js-v3/commit/a990db7deb0e672ec8bd4545111bb2523fe5bf28)) - - - - - -# [3.10.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.9.0...v3.10.0) (2021-03-26) - - -### Features - -* use ts-jest for running jest tests ([#2088](https://github.com/aws/aws-sdk-js-v3/issues/2088)) ([456002c](https://github.com/aws/aws-sdk-js-v3/commit/456002cf7fa16864b72c3c279b094886a42abddb)) - - - - - -# [3.9.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.1...v3.9.0) (2021-03-18) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -## [3.8.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.8.0...v3.8.1) (2021-03-11) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [3.8.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.7.0...v3.8.0) (2021-03-05) - - -### Bug Fixes - -* **deps:** pin fast-xml-parser to v3.17.4 ([#2102](https://github.com/aws/aws-sdk-js-v3/issues/2102)) ([c612c75](https://github.com/aws/aws-sdk-js-v3/commit/c612c75890a9b5005ff68b72bcac91761ce5dc14)) - - - - - -# [3.7.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.1...v3.7.0) (2021-02-25) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -## [3.6.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.6.0...v3.6.1) (2021-02-22) - - -### Bug Fixes - -* update references of default branch from master to main ([#2057](https://github.com/aws/aws-sdk-js-v3/issues/2057)) ([59b8b58](https://github.com/aws/aws-sdk-js-v3/commit/59b8b58c3a8c057b36abfaa59bae3a6ffb068cf1)) - - - - - -# [3.6.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.5.0...v3.6.0) (2021-02-20) - - -### Bug Fixes - -* revert publish v3.5.1-0 ([#2058](https://github.com/aws/aws-sdk-js-v3/issues/2058)) ([af25697](https://github.com/aws/aws-sdk-js-v3/commit/af25697aee9363a66c0d69b83f7df2e445c4b721)) - - - - - -# [3.5.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.1...v3.5.0) (2021-02-12) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -## [3.4.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.4.0...v3.4.1) (2021-01-29) - - -### Bug Fixes - -* **clients:** use TS 3.4 compatible types for TS 3.9 ([#1978](https://github.com/aws/aws-sdk-js-v3/issues/1978)) ([8bced5c](https://github.com/aws/aws-sdk-js-v3/commit/8bced5c32b9dbc68f1065054d796cb0b8b87bcc4)) - - - - - -# [3.4.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.3.0...v3.4.0) (2021-01-28) - - -### Features - -* **middleware-stack:** allow adding middleware to override an existing one ([#1964](https://github.com/aws/aws-sdk-js-v3/issues/1964)) ([9c21f14](https://github.com/aws/aws-sdk-js-v3/commit/9c21f14412f2b1f591422f3c67dedbe886db723b)), closes [#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883) -* use downlevel-dts to generate TS 3.4 compatible types ([#1943](https://github.com/aws/aws-sdk-js-v3/issues/1943)) ([63ad215](https://github.com/aws/aws-sdk-js-v3/commit/63ad2151c8bb7be32ea8838a9b0974806ed3906b)) - - - - - -# [3.3.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.2.0...v3.3.0) (2021-01-14) - - -### Bug Fixes - -* **clients:** export explicit dependencies on @aws-sdk/types ([#1902](https://github.com/aws/aws-sdk-js-v3/issues/1902)) ([96f1087](https://github.com/aws/aws-sdk-js-v3/commit/96f1087333ba916593d557051297983912b27caa)) -* **clients:** lowercase all header names in serializer ([#1892](https://github.com/aws/aws-sdk-js-v3/issues/1892)) ([1308721](https://github.com/aws/aws-sdk-js-v3/commit/130872194bc94590f599051ee067d862210252f8)) -* **url-parser:** merge browser and node url parser, add rn url parser ([#1903](https://github.com/aws/aws-sdk-js-v3/issues/1903)) ([99be092](https://github.com/aws/aws-sdk-js-v3/commit/99be092fded13bb00802549e17dbdb6d760a8679)) - - -### Features - -* **clients:** update README with documentation, usage and more ([#1907](https://github.com/aws/aws-sdk-js-v3/issues/1907)) ([03be111](https://github.com/aws/aws-sdk-js-v3/commit/03be111a086360687f20b2ac1d490584fb4fbefe)) - - - - - -# [3.2.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.1.0...v3.2.0) (2021-01-09) - - -### Bug Fixes - -* stop adding command mw repeatedly in resolveMiddleware() ([#1883](https://github.com/aws/aws-sdk-js-v3/issues/1883)) ([d4c302b](https://github.com/aws/aws-sdk-js-v3/commit/d4c302b816e1781f8d04bd479cc4e26e0fe4debc)) - - - - - -# [3.1.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.0.0...v3.1.0) (2020-12-23) - - -### Bug Fixes - -* **clients:** default region and credential provider ([#1834](https://github.com/aws/aws-sdk-js-v3/issues/1834)) ([bc79ab5](https://github.com/aws/aws-sdk-js-v3/commit/bc79ab5f17e00bc069b51f2f426dc73c16483eaa)) -* log requestId, extendedRequestId, cfId in $metadata ([#1819](https://github.com/aws/aws-sdk-js-v3/issues/1819)) ([f2a47e8](https://github.com/aws/aws-sdk-js-v3/commit/f2a47e80965f96b86fa42038bf2711b922eee302)) -* **clients:** populate sdkId in serviceId and default to use arnNamespace as signingName ([#1786](https://github.com/aws/aws-sdk-js-v3/issues/1786)) ([0011af2](https://github.com/aws/aws-sdk-js-v3/commit/0011af27a62d0d201296225e2a70276645b3231a)) -* **clients:** update endpoint provider ([#1824](https://github.com/aws/aws-sdk-js-v3/issues/1824)) ([64d2210](https://github.com/aws/aws-sdk-js-v3/commit/64d22105691f286ad9accf1a137d7c1928378ad4)) - - -### Features - -* standardize user agent value ([#1775](https://github.com/aws/aws-sdk-js-v3/issues/1775)) ([388b180](https://github.com/aws/aws-sdk-js-v3/commit/388b18071146171b42d283a93f9590cb23956e1a)) - - - - - -# [3.0.0](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.10...v3.0.0) (2020-12-15) - - -### Features - -* bump version to 3.0.0 ([#1793](https://github.com/aws/aws-sdk-js-v3/issues/1793)) ([d8475f8](https://github.com/aws/aws-sdk-js-v3/commit/d8475f8d972d28fbc15cd7e23abfe18f9eab0644)) - - - - - -# [1.0.0-rc.10](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.9...v1.0.0-rc.10) (2020-12-15) - - -### Features - -* update clients as of 12/12/2020 ([#1771](https://github.com/aws/aws-sdk-js-v3/issues/1771)) ([f69ff44](https://github.com/aws/aws-sdk-js-v3/commit/f69ff440a79018ad69fcb26ad46e3db65b23ce71)) - - - - - -# [1.0.0-rc.9](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.8...v1.0.0-rc.9) (2020-12-11) - - -### Bug Fixes - -* **codegen:** import SENSITIVE_STRING only when used ([#1761](https://github.com/aws/aws-sdk-js-v3/issues/1761)) ([9296283](https://github.com/aws/aws-sdk-js-v3/commit/9296283623edecf95441e310200a17b61efe80e3)) - - -### Features - -* add service id config ([#1765](https://github.com/aws/aws-sdk-js-v3/issues/1765)) ([1ba5672](https://github.com/aws/aws-sdk-js-v3/commit/1ba5672ff75bf5401f02f65d20af61c7bee339ff)) - - - - - -# [1.0.0-rc.8](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.7...v1.0.0-rc.8) (2020-12-05) - - -### Features - -* **invalid-dependency:** add invalidAsyncFunction which rejects with an Error ([#1719](https://github.com/aws/aws-sdk-js-v3/issues/1719)) ([c4c046e](https://github.com/aws/aws-sdk-js-v3/commit/c4c046edf0e752560fded20255642e6aed559d2c)) - - - - - -# [1.0.0-rc.7](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.6...v1.0.0-rc.7) (2020-11-20) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-rc.6](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2020-11-13) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-rc.5](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2020-11-09) - - -### Bug Fixes - -* **package.json:** migrate @aws-sdk/types into devDependencies codegen ([#1658](https://github.com/aws/aws-sdk-js-v3/issues/1658)) ([eb50962](https://github.com/aws/aws-sdk-js-v3/commit/eb509629cd6eeb293bf762c201710acabe049a58)) - - - - - -# [1.0.0-rc.4](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2020-10-31) - - -### Features - -* log clientName and commandName ([#1637](https://github.com/aws/aws-sdk-js-v3/issues/1637)) ([79f25ca](https://github.com/aws/aws-sdk-js-v3/commit/79f25cacc076483e0134f3626d9971ada5f1206d)) - - - - - -# [1.0.0-rc.3](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2020-10-27) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-rc.2](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2020-10-22) - - -### Bug Fixes - -* throw 3XX redirection as errors explicitly ([#1591](https://github.com/aws/aws-sdk-js-v3/issues/1591)) ([76f83f1](https://github.com/aws/aws-sdk-js-v3/commit/76f83f19c96dc6c8705c8367cae5d87bbcfd7b23)) - - - - - -# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19) - - -### Features - -* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e)) - - - - - -# [1.0.0-gamma.10](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.9...@aws-sdk/aws-restxml@1.0.0-gamma.10) (2020-10-07) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-gamma.9](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.8...@aws-sdk/aws-restxml@1.0.0-gamma.9) (2020-09-29) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.7...@aws-sdk/aws-restxml@1.0.0-gamma.8) (2020-09-15) - - -### Bug Fixes - -* default import package.json for spec compatibility ([#1505](https://github.com/aws/aws-sdk-js-v3/issues/1505)) ([797ba7d](https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861)) -* toposort and chunk shape models ([#1510](https://github.com/aws/aws-sdk-js-v3/issues/1510)) ([bee87d8](https://github.com/aws/aws-sdk-js-v3/commit/bee87d8fcc5ea82a361386309ebf9330fe39c816)) - - - - - -# [1.0.0-gamma.7](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.6...@aws-sdk/aws-restxml@1.0.0-gamma.7) (2020-09-01) - - -### Features - -* add LoggerConfig to all clients ([#1472](https://github.com/aws/aws-sdk-js-v3/issues/1472)) ([d55a812](https://github.com/aws/aws-sdk-js-v3/commit/d55a81278fee13281b20bfa60d89d2b111245dd4)) - - - - - -# [1.0.0-gamma.6](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.5...@aws-sdk/aws-restxml@1.0.0-gamma.6) (2020-08-25) - - -### Features - -* get partition of given region ([#1435](https://github.com/aws/aws-sdk-js-v3/issues/1435)) ([c18bfe4](https://github.com/aws/aws-sdk-js-v3/commit/c18bfe489db77d945d0bcc4ae7194ff46cd461a9)) -* refactor nodejs region loader ([#1437](https://github.com/aws/aws-sdk-js-v3/issues/1437)) ([5d79645](https://github.com/aws/aws-sdk-js-v3/commit/5d79645eb622b111c94a7de1918c8357c83a7bf8)) -* refactor nodejs retry config loader ([#1438](https://github.com/aws/aws-sdk-js-v3/issues/1438)) ([5478012](https://github.com/aws/aws-sdk-js-v3/commit/5478012147b475bdce07a2cbe393a972e502c93f)) - - - - - -# [1.0.0-gamma.5](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.4...@aws-sdk/aws-restxml@1.0.0-gamma.5) (2020-08-04) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-gamma.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.3...@aws-sdk/aws-restxml@1.0.0-gamma.4) (2020-07-21) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# [1.0.0-gamma.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/aws-restxml@1.0.0-gamma.2...@aws-sdk/aws-restxml@1.0.0-gamma.3) (2020-07-13) - -**Note:** Version bump only for package @aws-sdk/aws-restxml - - - - - -# 1.0.0-gamma.2 (2020-07-08) - - -### Features - -* add filterSensitiveLog method to Structure namespaces ([#1130](https://github.com/aws/aws-sdk-js-v3/issues/1130)) ([8eff087](https://github.com/aws/aws-sdk-js-v3/commit/8eff0875580e30e12f2e0abd5fa402973790e697)) - - - -# 1.0.0-gamma.2 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.1 (2020-05-26) - - - -# 1.0.0-gamma.1 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-gamma.0 (2020-05-21) - - -### Bug Fixes - -* update array to SetShape in protocol_tests ([#1170](https://github.com/aws/aws-sdk-js-v3/issues/1170)) ([1414b8c](https://github.com/aws/aws-sdk-js-v3/commit/1414b8c2ec1869f5b07db94772a39a42a2351650)) - - -### Features - -* populate contents from '#text' recursively in parseBody ([#1154](https://github.com/aws/aws-sdk-js-v3/issues/1154)) ([b3148b4](https://github.com/aws/aws-sdk-js-v3/commit/b3148b4a906e7335f95839c59fd55140ddc89e96)) -* refactor http request handlers ([#1186](https://github.com/aws/aws-sdk-js-v3/issues/1186)) ([605ebc5](https://github.com/aws/aws-sdk-js-v3/commit/605ebc57d2ec140ae5dd1c152168ec786e6663d9)) -* remove redundant variables from deser functions ([#1153](https://github.com/aws/aws-sdk-js-v3/issues/1153)) ([bcfa99c](https://github.com/aws/aws-sdk-js-v3/commit/bcfa99cd2d7b02d8f396dfc06c5d5323a10c55dd)) -* use array for SetShape ([#1144](https://github.com/aws/aws-sdk-js-v3/issues/1144)) ([0ab6a0f](https://github.com/aws/aws-sdk-js-v3/commit/0ab6a0feb365c7da83f74cc0b7186281e5ce73d4)) - - - -# 1.0.0-beta.4 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) - - - - - -# 1.0.0-beta.0 (2020-04-25) - - -### Bug Fixes - -* XML Namespace Serde issues ([#1077](https://github.com/aws/aws-sdk-js-v3/issues/1077)) ([77386f6](https://github.com/aws/aws-sdk-js-v3/commit/77386f6fac5fe2644f1b60a77050975c0327b6e0)) - - -### Features - -* protocol test codegen project + service clients ([#1058](https://github.com/aws/aws-sdk-js-v3/issues/1058)) ([16f81f6](https://github.com/aws/aws-sdk-js-v3/commit/16f81f6c59a060d30e76f61bb6d68a6e85db110a)) diff --git a/protocol_tests/aws-protocoltests-restxml/LICENSE b/protocol_tests/aws-protocoltests-restxml/LICENSE deleted file mode 100644 index dd65ae06be7a..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/protocol_tests/aws-protocoltests-restxml/README.md b/protocol_tests/aws-protocoltests-restxml/README.md deleted file mode 100644 index 0556eb71cdf0..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# @aws-sdk/aws-protocoltests-restxml - -[![NPM version](https://img.shields.io/npm/v/@aws-sdk/aws-protocoltests-restxml/latest.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restxml) -[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/aws-protocoltests-restxml.svg)](https://www.npmjs.com/package/@aws-sdk/aws-protocoltests-restxml) - -## Description - -AWS SDK for JavaScript RestXmlProtocol Client for Node.js, Browser and React Native. - -A REST XML service that sends XML requests and responses. - -## Installing - -To install the this package, simply type add or install @aws-sdk/aws-protocoltests-restxml -using your favorite package manager: - -- `npm install @aws-sdk/aws-protocoltests-restxml` -- `yarn add @aws-sdk/aws-protocoltests-restxml` -- `pnpm add @aws-sdk/aws-protocoltests-restxml` - -## Getting Started - -### Import - -The AWS SDK is modulized by clients and commands. -To send a request, you only need to import the `RestXmlProtocolClient` and -the commands you need, for example `AllQueryStringTypesCommand`: - -```js -// ES5 example -const { RestXmlProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); -``` - -```ts -// ES6+ example -import { RestXmlProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restxml"; -``` - -### Usage - -To send a request, you: - -- Initiate client with configuration (e.g. credentials, region). -- Initiate command with input parameters. -- Call `send` operation on client with command object as input. -- If you are using a custom http handler, you may call `destroy()` to close open connections. - -```js -// a client can be shared by different commands. -const client = new RestXmlProtocolClient({ region: "REGION" }); - -const params = { - /** input parameters */ -}; -const command = new AllQueryStringTypesCommand(params); -``` - -#### Async/await - -We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) -operator to wait for the promise returned by send operation as follows: - -```js -// async/await. -try { - const data = await client.send(command); - // process data. -} catch (error) { - // error handling. -} finally { - // finally. -} -``` - -Async-await is clean, concise, intuitive, easy to debug and has better error handling -as compared to using Promise chains or callbacks. - -#### Promises - -You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) -to execute send operation. - -```js -client.send(command).then( - (data) => { - // process data. - }, - (error) => { - // error handling. - } -); -``` - -Promises can also be called using `.catch()` and `.finally()` as follows: - -```js -client - .send(command) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }) - .finally(() => { - // finally. - }); -``` - -#### Callbacks - -We do not recommend using callbacks because of [callback hell](http://callbackhell.com/), -but they are supported by the send operation. - -```js -// callbacks. -client.send(command, (err, data) => { - // proccess err and data. -}); -``` - -#### v2 compatible style - -The client can also send requests using v2 compatible style. -However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post -on [modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) - -```ts -import * as AWS from "@aws-sdk/aws-protocoltests-restxml"; -const client = new AWS.RestXmlProtocol({ region: "REGION" }); - -// async/await. -try { - const data = await client.allQueryStringTypes(params); - // process data. -} catch (error) { - // error handling. -} - -// Promises. -client - .allQueryStringTypes(params) - .then((data) => { - // process data. - }) - .catch((error) => { - // error handling. - }); - -// callbacks. -client.allQueryStringTypes(params, (err, data) => { - // proccess err and data. -}); -``` - -### Troubleshooting - -When the service returns an exception, the error will include the exception information, -as well as response metadata (e.g. request id). - -```js -try { - const data = await client.send(command); - // process data. -} catch (error) { - const { requestId, cfId, extendedRequestId } = error.$metadata; - console.log({ requestId, cfId, extendedRequestId }); - /** - * The keys within exceptions are also parsed. - * You can access them by specifying exception names: - * if (error.name === 'SomeServiceException') { - * const value = error.specialKeyInException; - * } - */ -} -``` - -## Getting Help - -Please use these community resources for getting help. -We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them. - -- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) - or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html). -- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/) - on AWS Developer Blog. -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`. -- Join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3). -- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues/new/choose). - -To test your universal JavaScript code in Node.js, browser and react-native environments, -visit our [code samples repo](https://github.com/aws-samples/aws-sdk-js-tests). - -## Contributing - -This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/aws-protocoltests-restxml` package is updated. -To contribute to client you can check our [generate clients scripts](https://github.com/aws/aws-sdk-js-v3/tree/main/scripts/generate-clients). - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE for more information. diff --git a/protocol_tests/aws-protocoltests-restxml/jest.config.js b/protocol_tests/aws-protocoltests-restxml/jest.config.js deleted file mode 100644 index a8d1c2e49912..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const base = require("../../jest.config.base.js"); - -module.exports = { - ...base, -}; diff --git a/protocol_tests/aws-protocoltests-restxml/package.json b/protocol_tests/aws-protocoltests-restxml/package.json deleted file mode 100644 index 53a6f264238e..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "@aws-sdk/aws-protocoltests-restxml", - "description": "@aws-sdk/aws-protocoltests-restxml client", - "version": "3.38.0", - "scripts": { - "build": "yarn build:cjs && yarn build:es && yarn build:types", - "build:cjs": "tsc -p tsconfig.json", - "build:docs": "yarn clean:docs && typedoc ./", - "build:es": "tsc -p tsconfig.es.json", - "build:types": "tsc -p tsconfig.types.json", - "clean": "yarn clean:dist && yarn clean:docs", - "clean:dist": "rimraf ./dist", - "clean:docs": "rimraf ./docs", - "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", - "test": "jest --coverage --passWithNoTests" - }, - "main": "./dist-cjs/index.js", - "types": "./dist-types/index.d.ts", - "module": "./dist-es/index.js", - "sideEffects": false, - "dependencies": { - "@aws-crypto/sha256-browser": "2.0.0", - "@aws-crypto/sha256-js": "2.0.0", - "@aws-sdk/config-resolver": "3.38.0", - "@aws-sdk/fetch-http-handler": "3.38.0", - "@aws-sdk/hash-node": "3.38.0", - "@aws-sdk/invalid-dependency": "3.38.0", - "@aws-sdk/middleware-content-length": "3.38.0", - "@aws-sdk/middleware-host-header": "3.38.0", - "@aws-sdk/middleware-logger": "3.38.0", - "@aws-sdk/middleware-retry": "3.38.0", - "@aws-sdk/middleware-serde": "3.38.0", - "@aws-sdk/middleware-stack": "3.38.0", - "@aws-sdk/middleware-user-agent": "3.38.0", - "@aws-sdk/node-config-provider": "3.38.0", - "@aws-sdk/node-http-handler": "3.38.0", - "@aws-sdk/protocol-http": "3.38.0", - "@aws-sdk/querystring-builder": "3.38.0", - "@aws-sdk/smithy-client": "3.38.0", - "@aws-sdk/types": "3.38.0", - "@aws-sdk/url-parser": "3.38.0", - "@aws-sdk/util-base64-browser": "3.37.0", - "@aws-sdk/util-base64-node": "3.37.0", - "@aws-sdk/util-body-length-browser": "3.37.0", - "@aws-sdk/util-body-length-node": "3.37.0", - "@aws-sdk/util-user-agent-browser": "3.38.0", - "@aws-sdk/util-user-agent-node": "3.38.0", - "@aws-sdk/util-utf8-browser": "3.37.0", - "@aws-sdk/util-utf8-node": "3.37.0", - "@aws-sdk/xml-builder": "3.37.0", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", - "tslib": "^2.3.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@aws-sdk/service-client-documentation-generator": "3.38.0", - "@types/node": "^12.7.5", - "@types/uuid": "^8.3.0", - "downlevel-dts": "0.7.0", - "jest": "^26.1.0", - "rimraf": "^3.0.0", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typescript": "~4.3.5" - }, - "engines": { - "node": ">=10.0.0" - }, - "typesVersions": { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - "files": [ - "dist-*" - ], - "author": { - "name": "AWS SDK for JavaScript Team", - "url": "https://aws.amazon.com/javascript/" - }, - "license": "Apache-2.0", - "browser": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - "private": true, - "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-protocoltests-restxml", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-js-v3.git", - "directory": "clients/aws-protocoltests-restxml" - } -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts deleted file mode 100644 index d429966268a9..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocol.ts +++ /dev/null @@ -1,1919 +0,0 @@ -import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; - -import { - AllQueryStringTypesCommand, - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "./commands/AllQueryStringTypesCommand"; -import { - BodyWithXmlNameCommand, - BodyWithXmlNameCommandInput, - BodyWithXmlNameCommandOutput, -} from "./commands/BodyWithXmlNameCommand"; -import { - ConstantAndVariableQueryStringCommand, - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "./commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommand, - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "./commands/ConstantQueryStringCommand"; -import { - EmptyInputAndEmptyOutputCommand, - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { - EndpointOperationCommand, - EndpointOperationCommandInput, - EndpointOperationCommandOutput, -} from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelHeaderOperationCommand, - EndpointWithHostLabelHeaderOperationCommandInput, - EndpointWithHostLabelHeaderOperationCommandOutput, -} from "./commands/EndpointWithHostLabelHeaderOperationCommand"; -import { - EndpointWithHostLabelOperationCommand, - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { - FlattenedXmlMapCommand, - FlattenedXmlMapCommandInput, - FlattenedXmlMapCommandOutput, -} from "./commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommand, - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommand, - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { - GreetingWithErrorsCommand, - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, -} from "./commands/GreetingWithErrorsCommand"; -import { - HttpPayloadTraitsCommand, - HttpPayloadTraitsCommandInput, - HttpPayloadTraitsCommandOutput, -} from "./commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommand, - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithMemberXmlNameCommand, - HttpPayloadWithMemberXmlNameCommandInput, - HttpPayloadWithMemberXmlNameCommandOutput, -} from "./commands/HttpPayloadWithMemberXmlNameCommand"; -import { - HttpPayloadWithStructureCommand, - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "./commands/HttpPayloadWithStructureCommand"; -import { - HttpPayloadWithXmlNameCommand, - HttpPayloadWithXmlNameCommandInput, - HttpPayloadWithXmlNameCommandOutput, -} from "./commands/HttpPayloadWithXmlNameCommand"; -import { - HttpPayloadWithXmlNamespaceAndPrefixCommand, - HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, -} from "./commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; -import { - HttpPayloadWithXmlNamespaceCommand, - HttpPayloadWithXmlNamespaceCommandInput, - HttpPayloadWithXmlNamespaceCommandOutput, -} from "./commands/HttpPayloadWithXmlNamespaceCommand"; -import { - HttpPrefixHeadersCommand, - HttpPrefixHeadersCommandInput, - HttpPrefixHeadersCommandOutput, -} from "./commands/HttpPrefixHeadersCommand"; -import { - HttpRequestWithFloatLabelsCommand, - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "./commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommand, - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommand, - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommand, - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "./commands/HttpRequestWithLabelsCommand"; -import { - HttpResponseCodeCommand, - HttpResponseCodeCommandInput, - HttpResponseCodeCommandOutput, -} from "./commands/HttpResponseCodeCommand"; -import { - IgnoreQueryParamsInResponseCommand, - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "./commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommand, - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "./commands/InputAndOutputWithHeadersCommand"; -import { - NestedXmlMapsCommand, - NestedXmlMapsCommandInput, - NestedXmlMapsCommandOutput, -} from "./commands/NestedXmlMapsCommand"; -import { - NoInputAndNoOutputCommand, - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, -} from "./commands/NoInputAndNoOutputCommand"; -import { - NoInputAndOutputCommand, - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, -} from "./commands/NoInputAndOutputCommand"; -import { - NullAndEmptyHeadersClientCommand, - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "./commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommand, - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "./commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommand, - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "./commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommand, - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommand, - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "./commands/QueryParamsAsStringListMapCommand"; -import { - QueryPrecedenceCommand, - QueryPrecedenceCommandInput, - QueryPrecedenceCommandOutput, -} from "./commands/QueryPrecedenceCommand"; -import { - RecursiveShapesCommand, - RecursiveShapesCommandInput, - RecursiveShapesCommandOutput, -} from "./commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommand, - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { - TimestampFormatHeadersCommand, - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "./commands/TimestampFormatHeadersCommand"; -import { - XmlAttributesCommand, - XmlAttributesCommandInput, - XmlAttributesCommandOutput, -} from "./commands/XmlAttributesCommand"; -import { - XmlAttributesOnPayloadCommand, - XmlAttributesOnPayloadCommandInput, - XmlAttributesOnPayloadCommandOutput, -} from "./commands/XmlAttributesOnPayloadCommand"; -import { XmlBlobsCommand, XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { - XmlEmptyBlobsCommand, - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, -} from "./commands/XmlEmptyBlobsCommand"; -import { - XmlEmptyListsCommand, - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, -} from "./commands/XmlEmptyListsCommand"; -import { - XmlEmptyMapsCommand, - XmlEmptyMapsCommandInput, - XmlEmptyMapsCommandOutput, -} from "./commands/XmlEmptyMapsCommand"; -import { - XmlEmptyStringsCommand, - XmlEmptyStringsCommandInput, - XmlEmptyStringsCommandOutput, -} from "./commands/XmlEmptyStringsCommand"; -import { XmlEnumsCommand, XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommand, XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { XmlMapsCommand, XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; -import { - XmlMapsXmlNameCommand, - XmlMapsXmlNameCommandInput, - XmlMapsXmlNameCommandOutput, -} from "./commands/XmlMapsXmlNameCommand"; -import { - XmlNamespacesCommand, - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, -} from "./commands/XmlNamespacesCommand"; -import { - XmlTimestampsCommand, - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, -} from "./commands/XmlTimestampsCommand"; -import { XmlUnionsCommand, XmlUnionsCommandInput, XmlUnionsCommandOutput } from "./commands/XmlUnionsCommand"; -import { RestXmlProtocolClient } from "./RestXmlProtocolClient"; - -/** - * A REST XML service that sends XML requests and responses. - */ -export class RestXmlProtocol extends RestXmlProtocolClient { - /** - * This example uses all query string types. - */ - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): void; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): void; - public allQueryStringTypes( - args: AllQueryStringTypesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AllQueryStringTypesCommandOutput) => void), - cb?: (err: any, data?: AllQueryStringTypesCommandOutput) => void - ): Promise | void { - const command = new AllQueryStringTypesCommand(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 following example serializes a body that uses an XML name, - * changing the wrapper name. - */ - public bodyWithXmlName( - args: BodyWithXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public bodyWithXmlName( - args: BodyWithXmlNameCommandInput, - cb: (err: any, data?: BodyWithXmlNameCommandOutput) => void - ): void; - public bodyWithXmlName( - args: BodyWithXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: BodyWithXmlNameCommandOutput) => void - ): void; - public bodyWithXmlName( - args: BodyWithXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BodyWithXmlNameCommandOutput) => void), - cb?: (err: any, data?: BodyWithXmlNameCommandOutput) => void - ): Promise | void { - const command = new BodyWithXmlNameCommand(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 uses fixed query string params and variable query string params. - * The fixed query string parameters and variable parameters must both be - * serialized (implementations may need to merge them together). - */ - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): void; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): void; - public constantAndVariableQueryString( - args: ConstantAndVariableQueryStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void), - cb?: (err: any, data?: ConstantAndVariableQueryStringCommandOutput) => void - ): Promise | void { - const command = new ConstantAndVariableQueryStringCommand(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 uses a constant query string parameters and a label. - * This simply tests that labels and query string parameters are - * compatible. The fixed query string parameter named "hello" should - * in no way conflict with the label, `{hello}`. - */ - public constantQueryString( - args: ConstantQueryStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public constantQueryString( - args: ConstantQueryStringCommandInput, - cb: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): void; - public constantQueryString( - args: ConstantQueryStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): void; - public constantQueryString( - args: ConstantQueryStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ConstantQueryStringCommandOutput) => void), - cb?: (err: any, data?: ConstantQueryStringCommandOutput) => void - ): Promise | void { - const command = new ConstantQueryStringCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - */ - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): void; - public emptyInputAndEmptyOutput( - args: EmptyInputAndEmptyOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void), - cb?: (err: any, data?: EmptyInputAndEmptyOutputCommandOutput) => void - ): Promise | void { - const command = new EmptyInputAndEmptyOutputCommand(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 endpointOperation( - args: EndpointOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointOperation( - args: EndpointOperationCommandInput, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointOperationCommandOutput) => void - ): void; - public endpointOperation( - args: EndpointOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointOperationCommand(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 endpointWithHostLabelHeaderOperation( - args: EndpointWithHostLabelHeaderOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelHeaderOperation( - args: EndpointWithHostLabelHeaderOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void - ): void; - public endpointWithHostLabelHeaderOperation( - args: EndpointWithHostLabelHeaderOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void - ): void; - public endpointWithHostLabelHeaderOperation( - args: EndpointWithHostLabelHeaderOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelHeaderOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelHeaderOperationCommand(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 endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): void; - public endpointWithHostLabelOperation( - args: EndpointWithHostLabelOperationCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void), - cb?: (err: any, data?: EndpointWithHostLabelOperationCommandOutput) => void - ): Promise | void { - const command = new EndpointWithHostLabelOperationCommand(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); - } - } - - /** - * Flattened maps - */ - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): void; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): void; - public flattenedXmlMap( - args: FlattenedXmlMapCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapCommand(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); - } - } - - /** - * Flattened maps with @xmlName - */ - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlName( - args: FlattenedXmlMapWithXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapWithXmlNameCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapWithXmlNameCommand(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); - } - } - - /** - * Flattened maps with @xmlNamespace and @xmlName - */ - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): void; - public flattenedXmlMapWithXmlNamespace( - args: FlattenedXmlMapWithXmlNamespaceCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void), - cb?: (err: any, data?: FlattenedXmlMapWithXmlNamespaceCommandOutput) => void - ): Promise | void { - const command = new FlattenedXmlMapWithXmlNamespaceCommand(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 has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * - * Implementations must be able to successfully take a response and - * properly (de)serialize successful and error responses based on the - * the presence of the - */ - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): void; - public greetingWithErrors( - args: GreetingWithErrorsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GreetingWithErrorsCommandOutput) => void), - cb?: (err: any, data?: GreetingWithErrorsCommandOutput) => void - ): Promise | void { - const command = new GreetingWithErrorsCommand(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 examples serializes a blob shape in the payload. - * - * In this example, no XML document is synthesized because the payload is - * not a structure or a union type. - */ - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): void; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): void; - public httpPayloadTraits( - args: HttpPayloadTraitsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadTraitsCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadTraitsCommand(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 examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - */ - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): void; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): void; - public httpPayloadTraitsWithMediaType( - args: HttpPayloadTraitsWithMediaTypeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadTraitsWithMediaTypeCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadTraitsWithMediaTypeCommand(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 following example serializes a payload that uses an XML name - * on the member, changing the wrapper name. - */ - public httpPayloadWithMemberXmlName( - args: HttpPayloadWithMemberXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithMemberXmlName( - args: HttpPayloadWithMemberXmlNameCommandInput, - cb: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void - ): void; - public httpPayloadWithMemberXmlName( - args: HttpPayloadWithMemberXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void - ): void; - public httpPayloadWithMemberXmlName( - args: HttpPayloadWithMemberXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithMemberXmlNameCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithMemberXmlNameCommand(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 examples serializes a structure in the payload. - * - * Note that serializing a structure changes the wrapper element name - * to match the targeted structure. - */ - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): void; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): void; - public httpPayloadWithStructure( - args: HttpPayloadWithStructureCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithStructureCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithStructureCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithStructureCommand(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 following example serializes a payload that uses an XML name, - * changing the wrapper name. - */ - public httpPayloadWithXmlName( - args: HttpPayloadWithXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithXmlName( - args: HttpPayloadWithXmlNameCommandInput, - cb: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void - ): void; - public httpPayloadWithXmlName( - args: HttpPayloadWithXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void - ): void; - public httpPayloadWithXmlName( - args: HttpPayloadWithXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithXmlNameCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithXmlNameCommand(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 following example serializes a payload that uses an XML namespace. - */ - public httpPayloadWithXmlNamespace( - args: HttpPayloadWithXmlNamespaceCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithXmlNamespace( - args: HttpPayloadWithXmlNamespaceCommandInput, - cb: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void - ): void; - public httpPayloadWithXmlNamespace( - args: HttpPayloadWithXmlNamespaceCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void - ): void; - public httpPayloadWithXmlNamespace( - args: HttpPayloadWithXmlNamespaceCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithXmlNamespaceCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithXmlNamespaceCommand(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 following example serializes a payload that uses an XML namespace. - */ - public httpPayloadWithXmlNamespaceAndPrefix( - args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPayloadWithXmlNamespaceAndPrefix( - args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - cb: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void - ): void; - public httpPayloadWithXmlNamespaceAndPrefix( - args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void - ): void; - public httpPayloadWithXmlNamespaceAndPrefix( - args: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void), - cb?: (err: any, data?: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput) => void - ): Promise | void { - const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(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 examples adds headers to the input of a request and response by prefix. - */ - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): void; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): void; - public httpPrefixHeaders( - args: HttpPrefixHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpPrefixHeadersCommandOutput) => void), - cb?: (err: any, data?: HttpPrefixHeadersCommandOutput) => void - ): Promise | void { - const command = new HttpPrefixHeadersCommand(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 httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): void; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): void; - public httpRequestWithFloatLabels( - args: HttpRequestWithFloatLabelsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithFloatLabelsCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithFloatLabelsCommand(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 httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): void; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): void; - public httpRequestWithGreedyLabelInPath( - args: HttpRequestWithGreedyLabelInPathCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithGreedyLabelInPathCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithGreedyLabelInPathCommand(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 example tests how requests are serialized when there's no input - * payload but there are HTTP labels. - */ - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): void; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): void; - public httpRequestWithLabels( - args: HttpRequestWithLabelsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpRequestWithLabelsCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithLabelsCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithLabelsCommand(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 example tests how requests serialize different timestamp formats in the - * URI path. - */ - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): void; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): void; - public httpRequestWithLabelsAndTimestampFormat( - args: HttpRequestWithLabelsAndTimestampFormatCommandInput, - optionsOrCb?: - | __HttpHandlerOptions - | ((err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void), - cb?: (err: any, data?: HttpRequestWithLabelsAndTimestampFormatCommandOutput) => void - ): Promise | void { - const command = new HttpRequestWithLabelsAndTimestampFormatCommand(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 httpResponseCode( - args: HttpResponseCodeCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - cb: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): void; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): void; - public httpResponseCode( - args: HttpResponseCodeCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HttpResponseCodeCommandOutput) => void), - cb?: (err: any, data?: HttpResponseCodeCommandOutput) => void - ): Promise | void { - const command = new HttpResponseCodeCommand(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 query string bound request parameters are - * serialized in the body of responses if the structure is used in both - * the request and response. - */ - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): void; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): void; - public ignoreQueryParamsInResponse( - args: IgnoreQueryParamsInResponseCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void), - cb?: (err: any, data?: IgnoreQueryParamsInResponseCommandOutput) => void - ): Promise | void { - const command = new IgnoreQueryParamsInResponseCommand(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 example tests how requests and responses are serialized when there is - * no input or output payload but there are HTTP header bindings. - */ - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): void; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): void; - public inputAndOutputWithHeaders( - args: InputAndOutputWithHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: InputAndOutputWithHeadersCommandOutput) => void), - cb?: (err: any, data?: InputAndOutputWithHeadersCommandOutput) => void - ): Promise | void { - const command = new InputAndOutputWithHeadersCommand(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 nestedXmlMaps( - args: NestedXmlMapsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nestedXmlMaps( - args: NestedXmlMapsCommandInput, - cb: (err: any, data?: NestedXmlMapsCommandOutput) => void - ): void; - public nestedXmlMaps( - args: NestedXmlMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NestedXmlMapsCommandOutput) => void - ): void; - public nestedXmlMaps( - args: NestedXmlMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NestedXmlMapsCommandOutput) => void), - cb?: (err: any, data?: NestedXmlMapsCommandOutput) => void - ): Promise | void { - const command = new NestedXmlMapsCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - */ - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): void; - public noInputAndNoOutput( - args: NoInputAndNoOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndNoOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndNoOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndNoOutputCommand(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 example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - */ - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): void; - public noInputAndOutput( - args: NoInputAndOutputCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NoInputAndOutputCommandOutput) => void), - cb?: (err: any, data?: NoInputAndOutputCommandOutput) => void - ): Promise | void { - const command = new NoInputAndOutputCommand(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); - } - } - - /** - * Null and empty headers are not sent over the wire. - */ - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): void; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): void; - public nullAndEmptyHeadersClient( - args: NullAndEmptyHeadersClientCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void), - cb?: (err: any, data?: NullAndEmptyHeadersClientCommandOutput) => void - ): Promise | void { - const command = new NullAndEmptyHeadersClientCommand(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); - } - } - - /** - * Null and empty headers are not sent over the wire. - */ - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): void; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): void; - public nullAndEmptyHeadersServer( - args: NullAndEmptyHeadersServerCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void), - cb?: (err: any, data?: NullAndEmptyHeadersServerCommandOutput) => void - ): Promise | void { - const command = new NullAndEmptyHeadersServerCommand(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); - } - } - - /** - * Omits null, but serializes empty string value. - */ - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): void; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): void; - public omitsNullSerializesEmptyString( - args: OmitsNullSerializesEmptyStringCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void), - cb?: (err: any, data?: OmitsNullSerializesEmptyStringCommandOutput) => void - ): Promise | void { - const command = new OmitsNullSerializesEmptyStringCommand(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); - } - } - - /** - * Automatically adds idempotency tokens. - */ - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): void; - public queryIdempotencyTokenAutoFill( - args: QueryIdempotencyTokenAutoFillCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void), - cb?: (err: any, data?: QueryIdempotencyTokenAutoFillCommandOutput) => void - ): Promise | void { - const command = new QueryIdempotencyTokenAutoFillCommand(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 queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): void; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): void; - public queryParamsAsStringListMap( - args: QueryParamsAsStringListMapCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryParamsAsStringListMapCommandOutput) => void), - cb?: (err: any, data?: QueryParamsAsStringListMapCommandOutput) => void - ): Promise | void { - const command = new QueryParamsAsStringListMapCommand(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 queryPrecedence( - args: QueryPrecedenceCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - cb: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): void; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): void; - public queryPrecedence( - args: QueryPrecedenceCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: QueryPrecedenceCommandOutput) => void), - cb?: (err: any, data?: QueryPrecedenceCommandOutput) => void - ): Promise | void { - const command = new QueryPrecedenceCommand(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); - } - } - - /** - * Recursive shapes - */ - public recursiveShapes( - args: RecursiveShapesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public recursiveShapes( - args: RecursiveShapesCommandInput, - cb: (err: any, data?: RecursiveShapesCommandOutput) => void - ): void; - public recursiveShapes( - args: RecursiveShapesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: RecursiveShapesCommandOutput) => void - ): void; - public recursiveShapes( - args: RecursiveShapesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RecursiveShapesCommandOutput) => void), - cb?: (err: any, data?: RecursiveShapesCommandOutput) => void - ): Promise | void { - const command = new RecursiveShapesCommand(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 simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): void; - public simpleScalarProperties( - args: SimpleScalarPropertiesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SimpleScalarPropertiesCommandOutput) => void), - cb?: (err: any, data?: SimpleScalarPropertiesCommandOutput) => void - ): Promise | void { - const command = new SimpleScalarPropertiesCommand(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 example tests how timestamp request and response headers are serialized. - */ - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): void; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): void; - public timestampFormatHeaders( - args: TimestampFormatHeadersCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TimestampFormatHeadersCommandOutput) => void), - cb?: (err: any, data?: TimestampFormatHeadersCommandOutput) => void - ): Promise | void { - const command = new TimestampFormatHeadersCommand(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 an XML attributes on synthesized document. - */ - public xmlAttributes( - args: XmlAttributesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlAttributes( - args: XmlAttributesCommandInput, - cb: (err: any, data?: XmlAttributesCommandOutput) => void - ): void; - public xmlAttributes( - args: XmlAttributesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlAttributesCommandOutput) => void - ): void; - public xmlAttributes( - args: XmlAttributesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlAttributesCommandOutput) => void), - cb?: (err: any, data?: XmlAttributesCommandOutput) => void - ): Promise | void { - const command = new XmlAttributesCommand(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 an XML attributes on a document targeted by httpPayload. - */ - public xmlAttributesOnPayload( - args: XmlAttributesOnPayloadCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlAttributesOnPayload( - args: XmlAttributesOnPayloadCommandInput, - cb: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void - ): void; - public xmlAttributesOnPayload( - args: XmlAttributesOnPayloadCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void - ): void; - public xmlAttributesOnPayload( - args: XmlAttributesOnPayloadCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlAttributesOnPayloadCommandOutput) => void), - cb?: (err: any, data?: XmlAttributesOnPayloadCommandOutput) => void - ): Promise | void { - const command = new XmlAttributesOnPayloadCommand(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); - } - } - - /** - * Blobs are base64 encoded - */ - public xmlBlobs(args: XmlBlobsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlBlobs(args: XmlBlobsCommandInput, cb: (err: any, data?: XmlBlobsCommandOutput) => void): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlBlobsCommandOutput) => void - ): void; - public xmlBlobs( - args: XmlBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlBlobsCommand(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); - } - } - - /** - * Blobs are base64 encoded - */ - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): void; - public xmlEmptyBlobs( - args: XmlEmptyBlobsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyBlobsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyBlobsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyBlobsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): void; - public xmlEmptyLists( - args: XmlEmptyListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyListsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyListsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyListsCommand(args); - if (typeof optionsOrCb === "function") { - this.send(command, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); - this.send(command, optionsOrCb || {}, cb); - } else { - return this.send(command, optionsOrCb); - } - } - - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyMaps(args: XmlEmptyMapsCommandInput, cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void): void; - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyMapsCommandOutput) => void - ): void; - public xmlEmptyMaps( - args: XmlEmptyMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyMapsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyMapsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyMapsCommand(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 xmlEmptyStrings( - args: XmlEmptyStringsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlEmptyStrings( - args: XmlEmptyStringsCommandInput, - cb: (err: any, data?: XmlEmptyStringsCommandOutput) => void - ): void; - public xmlEmptyStrings( - args: XmlEmptyStringsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEmptyStringsCommandOutput) => void - ): void; - public xmlEmptyStrings( - args: XmlEmptyStringsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEmptyStringsCommandOutput) => void), - cb?: (err: any, data?: XmlEmptyStringsCommandOutput) => void - ): Promise | void { - const command = new XmlEmptyStringsCommand(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. - */ - public xmlEnums(args: XmlEnumsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlEnums(args: XmlEnumsCommandInput, cb: (err: any, data?: XmlEnumsCommandOutput) => void): void; - public xmlEnums( - args: XmlEnumsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlEnumsCommandOutput) => void - ): void; - public xmlEnums( - args: XmlEnumsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlEnumsCommandOutput) => void), - cb?: (err: any, data?: XmlEnumsCommandOutput) => void - ): Promise | void { - const command = new XmlEnumsCommand(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 test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Flattened XML lists with @xmlNamespace. - * 8. Lists of structures. - * 9. Flattened XML list of structures - */ - public xmlLists(args: XmlListsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlLists(args: XmlListsCommandInput, cb: (err: any, data?: XmlListsCommandOutput) => void): void; - public xmlLists( - args: XmlListsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlListsCommandOutput) => void - ): void; - public xmlLists( - args: XmlListsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlListsCommandOutput) => void), - cb?: (err: any, data?: XmlListsCommandOutput) => void - ): Promise | void { - const command = new XmlListsCommand(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 example tests basic map serialization. - */ - public xmlMaps(args: XmlMapsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlMaps(args: XmlMapsCommandInput, cb: (err: any, data?: XmlMapsCommandOutput) => void): void; - public xmlMaps( - args: XmlMapsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlMapsCommandOutput) => void - ): void; - public xmlMaps( - args: XmlMapsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsCommandOutput) => void), - cb?: (err: any, data?: XmlMapsCommandOutput) => void - ): Promise | void { - const command = new XmlMapsCommand(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 xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): void; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): void; - public xmlMapsXmlName( - args: XmlMapsXmlNameCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlMapsXmlNameCommandOutput) => void), - cb?: (err: any, data?: XmlMapsXmlNameCommandOutput) => void - ): Promise | void { - const command = new XmlMapsXmlNameCommand(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 xmlNamespaces( - args: XmlNamespacesCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlNamespacesCommandOutput) => void - ): void; - public xmlNamespaces( - args: XmlNamespacesCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlNamespacesCommandOutput) => void), - cb?: (err: any, data?: XmlNamespacesCommandOutput) => void - ): Promise | void { - const command = new XmlNamespacesCommand(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 tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - */ - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options?: __HttpHandlerOptions - ): Promise; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlTimestampsCommandOutput) => void - ): void; - public xmlTimestamps( - args: XmlTimestampsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlTimestampsCommandOutput) => void), - cb?: (err: any, data?: XmlTimestampsCommandOutput) => void - ): Promise | void { - const command = new XmlTimestampsCommand(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 xmlUnions(args: XmlUnionsCommandInput, options?: __HttpHandlerOptions): Promise; - public xmlUnions(args: XmlUnionsCommandInput, cb: (err: any, data?: XmlUnionsCommandOutput) => void): void; - public xmlUnions( - args: XmlUnionsCommandInput, - options: __HttpHandlerOptions, - cb: (err: any, data?: XmlUnionsCommandOutput) => void - ): void; - public xmlUnions( - args: XmlUnionsCommandInput, - optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: XmlUnionsCommandOutput) => void), - cb?: (err: any, data?: XmlUnionsCommandOutput) => void - ): Promise | void { - const command = new XmlUnionsCommand(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); - } - } -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts b/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts deleted file mode 100644 index 55afbed456ac..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts +++ /dev/null @@ -1,457 +0,0 @@ -import { - EndpointsInputConfig, - EndpointsResolvedConfig, - RegionInputConfig, - RegionResolvedConfig, - resolveEndpointsConfig, - resolveRegionConfig, -} from "@aws-sdk/config-resolver"; -import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; -import { - getHostHeaderPlugin, - HostHeaderInputConfig, - HostHeaderResolvedConfig, - resolveHostHeaderConfig, -} from "@aws-sdk/middleware-host-header"; -import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; -import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry"; -import { - getUserAgentPlugin, - resolveUserAgentConfig, - UserAgentInputConfig, - UserAgentResolvedConfig, -} from "@aws-sdk/middleware-user-agent"; -import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; -import { - Client as __Client, - SmithyConfiguration as __SmithyConfiguration, - SmithyResolvedConfiguration as __SmithyResolvedConfiguration, -} from "@aws-sdk/smithy-client"; -import { - Decoder as __Decoder, - Encoder as __Encoder, - Hash as __Hash, - HashConstructor as __HashConstructor, - HttpHandlerOptions as __HttpHandlerOptions, - Logger as __Logger, - Provider as __Provider, - Provider, - RegionInfoProvider, - StreamCollector as __StreamCollector, - UrlParser as __UrlParser, - UserAgent as __UserAgent, -} from "@aws-sdk/types"; - -import { - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "./commands/AllQueryStringTypesCommand"; -import { BodyWithXmlNameCommandInput, BodyWithXmlNameCommandOutput } from "./commands/BodyWithXmlNameCommand"; -import { - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "./commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "./commands/ConstantQueryStringCommand"; -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "./commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelHeaderOperationCommandInput, - EndpointWithHostLabelHeaderOperationCommandOutput, -} from "./commands/EndpointWithHostLabelHeaderOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "./commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "./commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "./commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "./commands/GreetingWithErrorsCommand"; -import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "./commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithMemberXmlNameCommandInput, - HttpPayloadWithMemberXmlNameCommandOutput, -} from "./commands/HttpPayloadWithMemberXmlNameCommand"; -import { - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "./commands/HttpPayloadWithStructureCommand"; -import { - HttpPayloadWithXmlNameCommandInput, - HttpPayloadWithXmlNameCommandOutput, -} from "./commands/HttpPayloadWithXmlNameCommand"; -import { - HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, -} from "./commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; -import { - HttpPayloadWithXmlNamespaceCommandInput, - HttpPayloadWithXmlNamespaceCommandOutput, -} from "./commands/HttpPayloadWithXmlNamespaceCommand"; -import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "./commands/HttpPrefixHeadersCommand"; -import { - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "./commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "./commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "./commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "./commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "./commands/HttpResponseCodeCommand"; -import { - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "./commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "./commands/InputAndOutputWithHeadersCommand"; -import { NestedXmlMapsCommandInput, NestedXmlMapsCommandOutput } from "./commands/NestedXmlMapsCommand"; -import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "./commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "./commands/NoInputAndOutputCommand"; -import { - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "./commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "./commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "./commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "./commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "./commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "./commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "./commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "./commands/SimpleScalarPropertiesCommand"; -import { - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "./commands/TimestampFormatHeadersCommand"; -import { XmlAttributesCommandInput, XmlAttributesCommandOutput } from "./commands/XmlAttributesCommand"; -import { - XmlAttributesOnPayloadCommandInput, - XmlAttributesOnPayloadCommandOutput, -} from "./commands/XmlAttributesOnPayloadCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "./commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "./commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "./commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "./commands/XmlEmptyMapsCommand"; -import { XmlEmptyStringsCommandInput, XmlEmptyStringsCommandOutput } from "./commands/XmlEmptyStringsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; -import { XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; -import { XmlUnionsCommandInput, XmlUnionsCommandOutput } from "./commands/XmlUnionsCommand"; -import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; - -export type ServiceInputTypes = - | AllQueryStringTypesCommandInput - | BodyWithXmlNameCommandInput - | ConstantAndVariableQueryStringCommandInput - | ConstantQueryStringCommandInput - | EmptyInputAndEmptyOutputCommandInput - | EndpointOperationCommandInput - | EndpointWithHostLabelHeaderOperationCommandInput - | EndpointWithHostLabelOperationCommandInput - | FlattenedXmlMapCommandInput - | FlattenedXmlMapWithXmlNameCommandInput - | FlattenedXmlMapWithXmlNamespaceCommandInput - | GreetingWithErrorsCommandInput - | HttpPayloadTraitsCommandInput - | HttpPayloadTraitsWithMediaTypeCommandInput - | HttpPayloadWithMemberXmlNameCommandInput - | HttpPayloadWithStructureCommandInput - | HttpPayloadWithXmlNameCommandInput - | HttpPayloadWithXmlNamespaceAndPrefixCommandInput - | HttpPayloadWithXmlNamespaceCommandInput - | HttpPrefixHeadersCommandInput - | HttpRequestWithFloatLabelsCommandInput - | HttpRequestWithGreedyLabelInPathCommandInput - | HttpRequestWithLabelsAndTimestampFormatCommandInput - | HttpRequestWithLabelsCommandInput - | HttpResponseCodeCommandInput - | IgnoreQueryParamsInResponseCommandInput - | InputAndOutputWithHeadersCommandInput - | NestedXmlMapsCommandInput - | NoInputAndNoOutputCommandInput - | NoInputAndOutputCommandInput - | NullAndEmptyHeadersClientCommandInput - | NullAndEmptyHeadersServerCommandInput - | OmitsNullSerializesEmptyStringCommandInput - | QueryIdempotencyTokenAutoFillCommandInput - | QueryParamsAsStringListMapCommandInput - | QueryPrecedenceCommandInput - | RecursiveShapesCommandInput - | SimpleScalarPropertiesCommandInput - | TimestampFormatHeadersCommandInput - | XmlAttributesCommandInput - | XmlAttributesOnPayloadCommandInput - | XmlBlobsCommandInput - | XmlEmptyBlobsCommandInput - | XmlEmptyListsCommandInput - | XmlEmptyMapsCommandInput - | XmlEmptyStringsCommandInput - | XmlEnumsCommandInput - | XmlListsCommandInput - | XmlMapsCommandInput - | XmlMapsXmlNameCommandInput - | XmlNamespacesCommandInput - | XmlTimestampsCommandInput - | XmlUnionsCommandInput; - -export type ServiceOutputTypes = - | AllQueryStringTypesCommandOutput - | BodyWithXmlNameCommandOutput - | ConstantAndVariableQueryStringCommandOutput - | ConstantQueryStringCommandOutput - | EmptyInputAndEmptyOutputCommandOutput - | EndpointOperationCommandOutput - | EndpointWithHostLabelHeaderOperationCommandOutput - | EndpointWithHostLabelOperationCommandOutput - | FlattenedXmlMapCommandOutput - | FlattenedXmlMapWithXmlNameCommandOutput - | FlattenedXmlMapWithXmlNamespaceCommandOutput - | GreetingWithErrorsCommandOutput - | HttpPayloadTraitsCommandOutput - | HttpPayloadTraitsWithMediaTypeCommandOutput - | HttpPayloadWithMemberXmlNameCommandOutput - | HttpPayloadWithStructureCommandOutput - | HttpPayloadWithXmlNameCommandOutput - | HttpPayloadWithXmlNamespaceAndPrefixCommandOutput - | HttpPayloadWithXmlNamespaceCommandOutput - | HttpPrefixHeadersCommandOutput - | HttpRequestWithFloatLabelsCommandOutput - | HttpRequestWithGreedyLabelInPathCommandOutput - | HttpRequestWithLabelsAndTimestampFormatCommandOutput - | HttpRequestWithLabelsCommandOutput - | HttpResponseCodeCommandOutput - | IgnoreQueryParamsInResponseCommandOutput - | InputAndOutputWithHeadersCommandOutput - | NestedXmlMapsCommandOutput - | NoInputAndNoOutputCommandOutput - | NoInputAndOutputCommandOutput - | NullAndEmptyHeadersClientCommandOutput - | NullAndEmptyHeadersServerCommandOutput - | OmitsNullSerializesEmptyStringCommandOutput - | QueryIdempotencyTokenAutoFillCommandOutput - | QueryParamsAsStringListMapCommandOutput - | QueryPrecedenceCommandOutput - | RecursiveShapesCommandOutput - | SimpleScalarPropertiesCommandOutput - | TimestampFormatHeadersCommandOutput - | XmlAttributesCommandOutput - | XmlAttributesOnPayloadCommandOutput - | XmlBlobsCommandOutput - | XmlEmptyBlobsCommandOutput - | XmlEmptyListsCommandOutput - | XmlEmptyMapsCommandOutput - | XmlEmptyStringsCommandOutput - | XmlEnumsCommandOutput - | XmlListsCommandOutput - | XmlMapsCommandOutput - | XmlMapsXmlNameCommandOutput - | XmlNamespacesCommandOutput - | XmlTimestampsCommandOutput - | XmlUnionsCommandOutput; - -export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { - /** - * The HTTP handler to use. Fetch in browser and Https in Nodejs. - */ - requestHandler?: __HttpHandler; - - /** - * A constructor for a class implementing the {@link __Hash} interface - * that computes the SHA-256 HMAC or checksum of a string or binary buffer. - * @internal - */ - sha256?: __HashConstructor; - - /** - * The function that will be used to convert strings into HTTP endpoints. - * @internal - */ - urlParser?: __UrlParser; - - /** - * A function that can calculate the length of a request body. - * @internal - */ - bodyLengthChecker?: (body: any) => number | undefined; - - /** - * A function that converts a stream into an array of bytes. - * @internal - */ - streamCollector?: __StreamCollector; - - /** - * The function that will be used to convert a base64-encoded string to a byte array. - * @internal - */ - base64Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a base64-encoded string. - * @internal - */ - base64Encoder?: __Encoder; - - /** - * The function that will be used to convert a UTF8-encoded string to a byte array. - * @internal - */ - utf8Decoder?: __Decoder; - - /** - * The function that will be used to convert binary data to a UTF-8 encoded string. - * @internal - */ - utf8Encoder?: __Encoder; - - /** - * The runtime environment. - * @internal - */ - runtime?: string; - - /** - * Disable dyanamically changing the endpoint of the client based on the hostPrefix - * trait of an operation. - */ - disableHostPrefix?: boolean; - - /** - * Value for how many times a request will be made at most in case of retry. - */ - maxAttempts?: number | __Provider; - - /** - * Specifies which retry algorithm to use. - */ - retryMode?: string | __Provider; - - /** - * Optional logger for logging debug/info/warn/error. - */ - logger?: __Logger; - - /** - * Unique service identifier. - * @internal - */ - serviceId?: string; - - /** - * Fetch related hostname, signing name or signing region with given region. - * @internal - */ - regionInfoProvider?: RegionInfoProvider; - - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; -} - -type RestXmlProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & - ClientDefaults & - RegionInputConfig & - EndpointsInputConfig & - RetryInputConfig & - HostHeaderInputConfig & - UserAgentInputConfig; -/** - * The configuration interface of RestXmlProtocolClient class constructor that set the region, credentials and other options. - */ -export interface RestXmlProtocolClientConfig extends RestXmlProtocolClientConfigType {} - -type RestXmlProtocolClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & - Required & - RegionResolvedConfig & - EndpointsResolvedConfig & - RetryResolvedConfig & - HostHeaderResolvedConfig & - UserAgentResolvedConfig; -/** - * The resolved configuration interface of RestXmlProtocolClient class. This is resolved and normalized from the {@link RestXmlProtocolClientConfig | constructor configuration interface}. - */ -export interface RestXmlProtocolClientResolvedConfig extends RestXmlProtocolClientResolvedConfigType {} - -/** - * A REST XML service that sends XML requests and responses. - */ -export class RestXmlProtocolClient extends __Client< - __HttpHandlerOptions, - ServiceInputTypes, - ServiceOutputTypes, - RestXmlProtocolClientResolvedConfig -> { - /** - * The resolved configuration of RestXmlProtocolClient class. This is resolved and normalized from the {@link RestXmlProtocolClientConfig | constructor configuration interface}. - */ - readonly config: RestXmlProtocolClientResolvedConfig; - - constructor(configuration: RestXmlProtocolClientConfig) { - const _config_0 = __getRuntimeConfig(configuration); - const _config_1 = resolveRegionConfig(_config_0); - const _config_2 = resolveEndpointsConfig(_config_1); - const _config_3 = resolveRetryConfig(_config_2); - const _config_4 = resolveHostHeaderConfig(_config_3); - const _config_5 = resolveUserAgentConfig(_config_4); - super(_config_5); - this.config = _config_5; - this.middlewareStack.use(getRetryPlugin(this.config)); - this.middlewareStack.use(getContentLengthPlugin(this.config)); - this.middlewareStack.use(getHostHeaderPlugin(this.config)); - this.middlewareStack.use(getLoggerPlugin(this.config)); - this.middlewareStack.use(getUserAgentPlugin(this.config)); - } - - /** - * Destroy underlying resources, like sockets. It's usually not necessary to do this. - * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. - * Otherwise, sockets might stay open for quite a long time before the server terminates them. - */ - destroy(): void { - super.destroy(); - } -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts deleted file mode 100644 index 6d6548e25bcc..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/AllQueryStringTypesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { AllQueryStringTypesInput } from "../models/models_0"; -import { - deserializeAws_restXmlAllQueryStringTypesCommand, - serializeAws_restXmlAllQueryStringTypesCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface AllQueryStringTypesCommandInput extends AllQueryStringTypesInput {} -export interface AllQueryStringTypesCommandOutput extends __MetadataBearer {} - -/** - * This example uses all query string types. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, AllQueryStringTypesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, AllQueryStringTypesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new AllQueryStringTypesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link AllQueryStringTypesCommandInput} for command's `input` shape. - * @see {@link AllQueryStringTypesCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class AllQueryStringTypesCommand extends $Command< - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: AllQueryStringTypesCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "AllQueryStringTypesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: AllQueryStringTypesInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: AllQueryStringTypesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlAllQueryStringTypesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlAllQueryStringTypesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts deleted file mode 100644 index 9facc20d3947..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/BodyWithXmlNameCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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 { BodyWithXmlNameInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlBodyWithXmlNameCommand, - serializeAws_restXmlBodyWithXmlNameCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface BodyWithXmlNameCommandInput extends BodyWithXmlNameInputOutput {} -export interface BodyWithXmlNameCommandOutput extends BodyWithXmlNameInputOutput, __MetadataBearer {} - -/** - * The following example serializes a body that uses an XML name, - * changing the wrapper name. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, BodyWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, BodyWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new BodyWithXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link BodyWithXmlNameCommandInput} for command's `input` shape. - * @see {@link BodyWithXmlNameCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class BodyWithXmlNameCommand extends $Command< - BodyWithXmlNameCommandInput, - BodyWithXmlNameCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: BodyWithXmlNameCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "BodyWithXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: BodyWithXmlNameInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: BodyWithXmlNameInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: BodyWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlBodyWithXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlBodyWithXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts deleted file mode 100644 index df327c821d6d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantAndVariableQueryStringCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { ConstantAndVariableQueryStringInput } from "../models/models_0"; -import { - deserializeAws_restXmlConstantAndVariableQueryStringCommand, - serializeAws_restXmlConstantAndVariableQueryStringCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface ConstantAndVariableQueryStringCommandInput extends ConstantAndVariableQueryStringInput {} -export interface ConstantAndVariableQueryStringCommandOutput extends __MetadataBearer {} - -/** - * This example uses fixed query string params and variable query string params. - * The fixed query string parameters and variable parameters must both be - * serialized (implementations may need to merge them together). - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, ConstantAndVariableQueryStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, ConstantAndVariableQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new ConstantAndVariableQueryStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link ConstantAndVariableQueryStringCommandInput} for command's `input` shape. - * @see {@link ConstantAndVariableQueryStringCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class ConstantAndVariableQueryStringCommand extends $Command< - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: ConstantAndVariableQueryStringCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "ConstantAndVariableQueryStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: ConstantAndVariableQueryStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: ConstantAndVariableQueryStringCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlConstantAndVariableQueryStringCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlConstantAndVariableQueryStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts deleted file mode 100644 index a2e595abb7f3..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/ConstantQueryStringCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { ConstantQueryStringInput } from "../models/models_0"; -import { - deserializeAws_restXmlConstantQueryStringCommand, - serializeAws_restXmlConstantQueryStringCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface ConstantQueryStringCommandInput extends ConstantQueryStringInput {} -export interface ConstantQueryStringCommandOutput extends __MetadataBearer {} - -/** - * This example uses a constant query string parameters and a label. - * This simply tests that labels and query string parameters are - * compatible. The fixed query string parameter named "hello" should - * in no way conflict with the label, `{hello}`. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, ConstantQueryStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, ConstantQueryStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new ConstantQueryStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link ConstantQueryStringCommandInput} for command's `input` shape. - * @see {@link ConstantQueryStringCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class ConstantQueryStringCommand extends $Command< - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: ConstantQueryStringCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "ConstantQueryStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: ConstantQueryStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: ConstantQueryStringCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlConstantQueryStringCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlConstantQueryStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts deleted file mode 100644 index a88f31af42b9..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/EmptyInputAndEmptyOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { EmptyInputAndEmptyOutputInput, EmptyInputAndEmptyOutputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlEmptyInputAndEmptyOutputCommand, - serializeAws_restXmlEmptyInputAndEmptyOutputCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface EmptyInputAndEmptyOutputCommandInput extends EmptyInputAndEmptyOutputInput {} -export interface EmptyInputAndEmptyOutputCommandOutput extends EmptyInputAndEmptyOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has an empty input - * and empty output structure that reuses the same shape. While this should - * be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new EmptyInputAndEmptyOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link EmptyInputAndEmptyOutputCommandInput} for command's `input` shape. - * @see {@link EmptyInputAndEmptyOutputCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class EmptyInputAndEmptyOutputCommand extends $Command< - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EmptyInputAndEmptyOutputCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "EmptyInputAndEmptyOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: EmptyInputAndEmptyOutputInput.filterSensitiveLog, - outputFilterSensitiveLog: EmptyInputAndEmptyOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlEmptyInputAndEmptyOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlEmptyInputAndEmptyOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts deleted file mode 100644 index 2baa16171c0c..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointOperationCommand.ts +++ /dev/null @@ -1,77 +0,0 @@ -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_restXmlEndpointOperationCommand, - serializeAws_restXmlEndpointOperationCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface EndpointOperationCommandInput {} -export interface EndpointOperationCommandOutput extends __MetadataBearer {} - -export class EndpointOperationCommand extends $Command< - EndpointOperationCommandInput, - EndpointOperationCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointOperationCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "EndpointOperationCommand"; - 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: EndpointOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlEndpointOperationCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlEndpointOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts deleted file mode 100644 index f904462ebbaa..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelHeaderOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelHeaderInput } from "../models/models_0"; -import { - deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand, - serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface EndpointWithHostLabelHeaderOperationCommandInput extends HostLabelHeaderInput {} -export interface EndpointWithHostLabelHeaderOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelHeaderOperationCommand extends $Command< - EndpointWithHostLabelHeaderOperationCommandInput, - EndpointWithHostLabelHeaderOperationCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelHeaderOperationCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "EndpointWithHostLabelHeaderOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelHeaderInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelHeaderOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts deleted file mode 100644 index 33486b179d2b..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/EndpointWithHostLabelOperationCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HostLabelInput } from "../models/models_0"; -import { - deserializeAws_restXmlEndpointWithHostLabelOperationCommand, - serializeAws_restXmlEndpointWithHostLabelOperationCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface EndpointWithHostLabelOperationCommandInput extends HostLabelInput {} -export interface EndpointWithHostLabelOperationCommandOutput extends __MetadataBearer {} - -export class EndpointWithHostLabelOperationCommand extends $Command< - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: EndpointWithHostLabelOperationCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "EndpointWithHostLabelOperationCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HostLabelInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlEndpointWithHostLabelOperationCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlEndpointWithHostLabelOperationCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts deleted file mode 100644 index 00dd893f39f4..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { FlattenedXmlMapInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlFlattenedXmlMapCommand, - serializeAws_restXmlFlattenedXmlMapCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface FlattenedXmlMapCommandInput extends FlattenedXmlMapInputOutput {} -export interface FlattenedXmlMapCommandOutput extends FlattenedXmlMapInputOutput, __MetadataBearer {} - -/** - * Flattened maps - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, FlattenedXmlMapCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, FlattenedXmlMapCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new FlattenedXmlMapCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapCommand extends $Command< - FlattenedXmlMapCommandInput, - FlattenedXmlMapCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "FlattenedXmlMapCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: FlattenedXmlMapInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: FlattenedXmlMapInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: FlattenedXmlMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlFlattenedXmlMapCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlFlattenedXmlMapCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts deleted file mode 100644 index 7b6994a162f4..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNameCommand.ts +++ /dev/null @@ -1,100 +0,0 @@ -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 { FlattenedXmlMapWithXmlNameInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommand, - serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface FlattenedXmlMapWithXmlNameCommandInput extends FlattenedXmlMapWithXmlNameInputOutput {} -export interface FlattenedXmlMapWithXmlNameCommandOutput - extends FlattenedXmlMapWithXmlNameInputOutput, - __MetadataBearer {} - -/** - * Flattened maps with @xmlName - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, FlattenedXmlMapWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, FlattenedXmlMapWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new FlattenedXmlMapWithXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapWithXmlNameCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapWithXmlNameCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapWithXmlNameCommand extends $Command< - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapWithXmlNameCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "FlattenedXmlMapWithXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: FlattenedXmlMapWithXmlNameInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: FlattenedXmlMapWithXmlNameInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: FlattenedXmlMapWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts deleted file mode 100644 index 01e5c7391648..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/FlattenedXmlMapWithXmlNamespaceCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { FlattenedXmlMapWithXmlNamespaceOutput } from "../models/models_0"; -import { - deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand, - serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface FlattenedXmlMapWithXmlNamespaceCommandInput {} -export interface FlattenedXmlMapWithXmlNamespaceCommandOutput - extends FlattenedXmlMapWithXmlNamespaceOutput, - __MetadataBearer {} - -/** - * Flattened maps with @xmlNamespace and @xmlName - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, FlattenedXmlMapWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new FlattenedXmlMapWithXmlNamespaceCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link FlattenedXmlMapWithXmlNamespaceCommandInput} for command's `input` shape. - * @see {@link FlattenedXmlMapWithXmlNamespaceCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class FlattenedXmlMapWithXmlNamespaceCommand extends $Command< - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: FlattenedXmlMapWithXmlNamespaceCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "FlattenedXmlMapWithXmlNamespaceCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: FlattenedXmlMapWithXmlNamespaceOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: FlattenedXmlMapWithXmlNamespaceCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts deleted file mode 100644 index 993fb98921a0..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/GreetingWithErrorsCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { GreetingWithErrorsOutput } from "../models/models_0"; -import { - deserializeAws_restXmlGreetingWithErrorsCommand, - serializeAws_restXmlGreetingWithErrorsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface GreetingWithErrorsCommandInput {} -export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutput, __MetadataBearer {} - -/** - * This operation has three possible return values: - * - * 1. A successful response in the form of GreetingWithErrorsOutput - * 2. An InvalidGreeting error. - * 3. A BadRequest error. - * - * Implementations must be able to successfully take a response and - * properly (de)serialize successful and error responses based on the - * the presence of the - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, GreetingWithErrorsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, GreetingWithErrorsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new GreetingWithErrorsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link GreetingWithErrorsCommandInput} for command's `input` shape. - * @see {@link GreetingWithErrorsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class GreetingWithErrorsCommand extends $Command< - GreetingWithErrorsCommandInput, - GreetingWithErrorsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: GreetingWithErrorsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "GreetingWithErrorsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: GreetingWithErrorsOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: GreetingWithErrorsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlGreetingWithErrorsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlGreetingWithErrorsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts deleted file mode 100644 index fc2e3f0af9d1..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { HttpPayloadTraitsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadTraitsCommand, - serializeAws_restXmlHttpPayloadTraitsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadTraitsCommandInput extends HttpPayloadTraitsInputOutput {} -export interface HttpPayloadTraitsCommandOutput extends HttpPayloadTraitsInputOutput, __MetadataBearer {} - -/** - * This examples serializes a blob shape in the payload. - * - * In this example, no XML document is synthesized because the payload is - * not a structure or a union type. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadTraitsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadTraitsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadTraitsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadTraitsCommandInput} for command's `input` shape. - * @see {@link HttpPayloadTraitsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadTraitsCommand extends $Command< - HttpPayloadTraitsCommandInput, - HttpPayloadTraitsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadTraitsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadTraitsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadTraitsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadTraitsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadTraitsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpPayloadTraitsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts deleted file mode 100644 index 65c7cc0e266d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadTraitsWithMediaTypeCommand.ts +++ /dev/null @@ -1,104 +0,0 @@ -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 { HttpPayloadTraitsWithMediaTypeInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand, - serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadTraitsWithMediaTypeCommandInput extends HttpPayloadTraitsWithMediaTypeInputOutput {} -export interface HttpPayloadTraitsWithMediaTypeCommandOutput - extends HttpPayloadTraitsWithMediaTypeInputOutput, - __MetadataBearer {} - -/** - * This examples uses a `@mediaType` trait on the payload to force a custom - * content-type to be serialized. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadTraitsWithMediaTypeCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadTraitsWithMediaTypeCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadTraitsWithMediaTypeCommandInput} for command's `input` shape. - * @see {@link HttpPayloadTraitsWithMediaTypeCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadTraitsWithMediaTypeCommand extends $Command< - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadTraitsWithMediaTypeCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadTraitsWithMediaTypeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadTraitsWithMediaTypeInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpPayloadTraitsWithMediaTypeCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts deleted file mode 100644 index 3051395808a1..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithMemberXmlNameCommand.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 { HttpPayloadWithMemberXmlNameInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommand, - serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadWithMemberXmlNameCommandInput extends HttpPayloadWithMemberXmlNameInputOutput {} -export interface HttpPayloadWithMemberXmlNameCommandOutput - extends HttpPayloadWithMemberXmlNameInputOutput, - __MetadataBearer {} - -/** - * The following example serializes a payload that uses an XML name - * on the member, changing the wrapper name. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadWithMemberXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadWithMemberXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadWithMemberXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithMemberXmlNameCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithMemberXmlNameCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithMemberXmlNameCommand extends $Command< - HttpPayloadWithMemberXmlNameCommandInput, - HttpPayloadWithMemberXmlNameCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithMemberXmlNameCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadWithMemberXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithMemberXmlNameInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithMemberXmlNameInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadWithMemberXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts deleted file mode 100644 index cde30ef08c96..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithStructureCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { HttpPayloadWithStructureInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadWithStructureCommand, - serializeAws_restXmlHttpPayloadWithStructureCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadWithStructureCommandInput extends HttpPayloadWithStructureInputOutput {} -export interface HttpPayloadWithStructureCommandOutput extends HttpPayloadWithStructureInputOutput, __MetadataBearer {} - -/** - * This examples serializes a structure in the payload. - * - * Note that serializing a structure changes the wrapper element name - * to match the targeted structure. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadWithStructureCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadWithStructureCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadWithStructureCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithStructureCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithStructureCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithStructureCommand extends $Command< - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithStructureCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadWithStructureCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithStructureInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadWithStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadWithStructureCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpPayloadWithStructureCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts deleted file mode 100644 index e8dc0dacf60d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNameCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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 { HttpPayloadWithXmlNameInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadWithXmlNameCommand, - serializeAws_restXmlHttpPayloadWithXmlNameCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadWithXmlNameCommandInput extends HttpPayloadWithXmlNameInputOutput {} -export interface HttpPayloadWithXmlNameCommandOutput extends HttpPayloadWithXmlNameInputOutput, __MetadataBearer {} - -/** - * The following example serializes a payload that uses an XML name, - * changing the wrapper name. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadWithXmlNameCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadWithXmlNameCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadWithXmlNameCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithXmlNameCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithXmlNameCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithXmlNameCommand extends $Command< - HttpPayloadWithXmlNameCommandInput, - HttpPayloadWithXmlNameCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithXmlNameCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadWithXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithXmlNameInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithXmlNameInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadWithXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadWithXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpPayloadWithXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts deleted file mode 100644 index c8e1443416c2..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand.ts +++ /dev/null @@ -1,104 +0,0 @@ -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 { HttpPayloadWithXmlNamespaceAndPrefixInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand, - serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadWithXmlNamespaceAndPrefixCommandInput - extends HttpPayloadWithXmlNamespaceAndPrefixInputOutput {} -export interface HttpPayloadWithXmlNamespaceAndPrefixCommandOutput - extends HttpPayloadWithXmlNamespaceAndPrefixInputOutput, - __MetadataBearer {} - -/** - * The following example serializes a payload that uses an XML namespace. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceAndPrefixCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceAndPrefixCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithXmlNamespaceAndPrefixCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithXmlNamespaceAndPrefixCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithXmlNamespaceAndPrefixCommand extends $Command< - HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadWithXmlNamespaceAndPrefixCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithXmlNamespaceAndPrefixInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithXmlNamespaceAndPrefixInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts deleted file mode 100644 index 03b5cd41022b..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPayloadWithXmlNamespaceCommand.ts +++ /dev/null @@ -1,100 +0,0 @@ -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 { HttpPayloadWithXmlNamespaceInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommand, - serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPayloadWithXmlNamespaceCommandInput extends HttpPayloadWithXmlNamespaceInputOutput {} -export interface HttpPayloadWithXmlNamespaceCommandOutput - extends HttpPayloadWithXmlNamespaceInputOutput, - __MetadataBearer {} - -/** - * The following example serializes a payload that uses an XML namespace. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPayloadWithXmlNamespaceCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPayloadWithXmlNamespaceCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPayloadWithXmlNamespaceCommandInput} for command's `input` shape. - * @see {@link HttpPayloadWithXmlNamespaceCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPayloadWithXmlNamespaceCommand extends $Command< - HttpPayloadWithXmlNamespaceCommandInput, - HttpPayloadWithXmlNamespaceCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPayloadWithXmlNamespaceCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPayloadWithXmlNamespaceCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPayloadWithXmlNamespaceInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPayloadWithXmlNamespaceInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPayloadWithXmlNamespaceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts deleted file mode 100644 index 8ffc3656f1bb..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpPrefixHeadersCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { HttpPrefixHeadersInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpPrefixHeadersCommand, - serializeAws_restXmlHttpPrefixHeadersCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpPrefixHeadersCommandInput extends HttpPrefixHeadersInputOutput {} -export interface HttpPrefixHeadersCommandOutput extends HttpPrefixHeadersInputOutput, __MetadataBearer {} - -/** - * This examples adds headers to the input of a request and response by prefix. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpPrefixHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpPrefixHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpPrefixHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpPrefixHeadersCommandInput} for command's `input` shape. - * @see {@link HttpPrefixHeadersCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpPrefixHeadersCommand extends $Command< - HttpPrefixHeadersCommandInput, - HttpPrefixHeadersCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpPrefixHeadersCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpPrefixHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: HttpPrefixHeadersInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpPrefixHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpPrefixHeadersCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpPrefixHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts deleted file mode 100644 index 8678037cc69d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithFloatLabelsCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { HttpRequestWithFloatLabelsInput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpRequestWithFloatLabelsCommand, - serializeAws_restXmlHttpRequestWithFloatLabelsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpRequestWithFloatLabelsCommandInput extends HttpRequestWithFloatLabelsInput {} -export interface HttpRequestWithFloatLabelsCommandOutput extends __MetadataBearer {} - -export class HttpRequestWithFloatLabelsCommand extends $Command< - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithFloatLabelsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpRequestWithFloatLabelsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithFloatLabelsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpRequestWithFloatLabelsCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpRequestWithFloatLabelsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts deleted file mode 100644 index bdd7138bcc5b..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithGreedyLabelInPathCommand.ts +++ /dev/null @@ -1,84 +0,0 @@ -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 { HttpRequestWithGreedyLabelInPathInput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand, - serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpRequestWithGreedyLabelInPathCommandInput extends HttpRequestWithGreedyLabelInPathInput {} -export interface HttpRequestWithGreedyLabelInPathCommandOutput extends __MetadataBearer {} - -export class HttpRequestWithGreedyLabelInPathCommand extends $Command< - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithGreedyLabelInPathCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpRequestWithGreedyLabelInPathCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithGreedyLabelInPathInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpRequestWithGreedyLabelInPathCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts deleted file mode 100644 index 1aabf293effb..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsAndTimestampFormatCommand.ts +++ /dev/null @@ -1,106 +0,0 @@ -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 { HttpRequestWithLabelsAndTimestampFormatInput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand, - serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpRequestWithLabelsAndTimestampFormatCommandInput - extends HttpRequestWithLabelsAndTimestampFormatInput {} -export interface HttpRequestWithLabelsAndTimestampFormatCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests serialize different timestamp formats in the - * URI path. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpRequestWithLabelsAndTimestampFormatCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpRequestWithLabelsAndTimestampFormatCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandInput} for command's `input` shape. - * @see {@link HttpRequestWithLabelsAndTimestampFormatCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpRequestWithLabelsAndTimestampFormatCommand extends $Command< - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithLabelsAndTimestampFormatCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler< - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput - > { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpRequestWithLabelsAndTimestampFormatCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithLabelsAndTimestampFormatInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: HttpRequestWithLabelsAndTimestampFormatCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts deleted file mode 100644 index df4ae928ca33..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpRequestWithLabelsCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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 { HttpRequestWithLabelsInput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpRequestWithLabelsCommand, - serializeAws_restXmlHttpRequestWithLabelsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpRequestWithLabelsCommandInput extends HttpRequestWithLabelsInput {} -export interface HttpRequestWithLabelsCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests are serialized when there's no input - * payload but there are HTTP labels. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, HttpRequestWithLabelsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, HttpRequestWithLabelsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new HttpRequestWithLabelsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link HttpRequestWithLabelsCommandInput} for command's `input` shape. - * @see {@link HttpRequestWithLabelsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class HttpRequestWithLabelsCommand extends $Command< - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpRequestWithLabelsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpRequestWithLabelsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: HttpRequestWithLabelsInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpRequestWithLabelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpRequestWithLabelsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpRequestWithLabelsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts deleted file mode 100644 index 27d3c5274503..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/HttpResponseCodeCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { HttpResponseCodeOutput } from "../models/models_0"; -import { - deserializeAws_restXmlHttpResponseCodeCommand, - serializeAws_restXmlHttpResponseCodeCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface HttpResponseCodeCommandInput {} -export interface HttpResponseCodeCommandOutput extends HttpResponseCodeOutput, __MetadataBearer {} - -export class HttpResponseCodeCommand extends $Command< - HttpResponseCodeCommandInput, - HttpResponseCodeCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: HttpResponseCodeCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "HttpResponseCodeCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: HttpResponseCodeOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: HttpResponseCodeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlHttpResponseCodeCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlHttpResponseCodeCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts deleted file mode 100644 index 9cec947751e1..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/IgnoreQueryParamsInResponseCommand.ts +++ /dev/null @@ -1,100 +0,0 @@ -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 { IgnoreQueryParamsInResponseOutput } from "../models/models_0"; -import { - deserializeAws_restXmlIgnoreQueryParamsInResponseCommand, - serializeAws_restXmlIgnoreQueryParamsInResponseCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface IgnoreQueryParamsInResponseCommandInput {} -export interface IgnoreQueryParamsInResponseCommandOutput extends IgnoreQueryParamsInResponseOutput, __MetadataBearer {} - -/** - * This example ensures that query string bound request parameters are - * serialized in the body of responses if the structure is used in both - * the request and response. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, IgnoreQueryParamsInResponseCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, IgnoreQueryParamsInResponseCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new IgnoreQueryParamsInResponseCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link IgnoreQueryParamsInResponseCommandInput} for command's `input` shape. - * @see {@link IgnoreQueryParamsInResponseCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class IgnoreQueryParamsInResponseCommand extends $Command< - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: IgnoreQueryParamsInResponseCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "IgnoreQueryParamsInResponseCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: IgnoreQueryParamsInResponseOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlIgnoreQueryParamsInResponseCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlIgnoreQueryParamsInResponseCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts deleted file mode 100644 index c9a9c5cfc84a..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/InputAndOutputWithHeadersCommand.ts +++ /dev/null @@ -1,99 +0,0 @@ -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 { InputAndOutputWithHeadersIO } from "../models/models_0"; -import { - deserializeAws_restXmlInputAndOutputWithHeadersCommand, - serializeAws_restXmlInputAndOutputWithHeadersCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface InputAndOutputWithHeadersCommandInput extends InputAndOutputWithHeadersIO {} -export interface InputAndOutputWithHeadersCommandOutput extends InputAndOutputWithHeadersIO, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there is - * no input or output payload but there are HTTP header bindings. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, InputAndOutputWithHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, InputAndOutputWithHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new InputAndOutputWithHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link InputAndOutputWithHeadersCommandInput} for command's `input` shape. - * @see {@link InputAndOutputWithHeadersCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class InputAndOutputWithHeadersCommand extends $Command< - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: InputAndOutputWithHeadersCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "InputAndOutputWithHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: InputAndOutputWithHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlInputAndOutputWithHeadersCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlInputAndOutputWithHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts deleted file mode 100644 index 558a38628f51..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/NestedXmlMapsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { NestedXmlMapsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlNestedXmlMapsCommand, - serializeAws_restXmlNestedXmlMapsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface NestedXmlMapsCommandInput extends NestedXmlMapsInputOutput {} -export interface NestedXmlMapsCommandOutput extends NestedXmlMapsInputOutput, __MetadataBearer {} - -export class NestedXmlMapsCommand extends $Command< - NestedXmlMapsCommandInput, - NestedXmlMapsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NestedXmlMapsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "NestedXmlMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NestedXmlMapsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: NestedXmlMapsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NestedXmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlNestedXmlMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlNestedXmlMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts deleted file mode 100644 index 1b2658cd1005..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndNoOutputCommand.ts +++ /dev/null @@ -1,96 +0,0 @@ -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_restXmlNoInputAndNoOutputCommand, - serializeAws_restXmlNoInputAndNoOutputCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface NoInputAndNoOutputCommandInput {} -export interface NoInputAndNoOutputCommandOutput extends __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input or output. - * While this should be rare, code generators must support this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, NoInputAndNoOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, NoInputAndNoOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new NoInputAndNoOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndNoOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndNoOutputCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndNoOutputCommand extends $Command< - NoInputAndNoOutputCommandInput, - NoInputAndNoOutputCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndNoOutputCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "NoInputAndNoOutputCommand"; - 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: NoInputAndNoOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlNoInputAndNoOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlNoInputAndNoOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts deleted file mode 100644 index fbc91389dd2d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/NoInputAndOutputCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NoInputAndOutputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlNoInputAndOutputCommand, - serializeAws_restXmlNoInputAndOutputCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface NoInputAndOutputCommandInput {} -export interface NoInputAndOutputCommandOutput extends NoInputAndOutputOutput, __MetadataBearer {} - -/** - * The example tests how requests and responses are serialized when there's - * no request or response payload because the operation has no input and the - * output is empty. While this should be rare, code generators must support - * this. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, NoInputAndOutputCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, NoInputAndOutputCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new NoInputAndOutputCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NoInputAndOutputCommandInput} for command's `input` shape. - * @see {@link NoInputAndOutputCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NoInputAndOutputCommand extends $Command< - NoInputAndOutputCommandInput, - NoInputAndOutputCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NoInputAndOutputCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "NoInputAndOutputCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (input: any) => input, - outputFilterSensitiveLog: NoInputAndOutputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NoInputAndOutputCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlNoInputAndOutputCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlNoInputAndOutputCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts deleted file mode 100644 index cf0ecca40907..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersClientCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NullAndEmptyHeadersIO } from "../models/models_0"; -import { - deserializeAws_restXmlNullAndEmptyHeadersClientCommand, - serializeAws_restXmlNullAndEmptyHeadersClientCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface NullAndEmptyHeadersClientCommandInput extends NullAndEmptyHeadersIO {} -export interface NullAndEmptyHeadersClientCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} - -/** - * Null and empty headers are not sent over the wire. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, NullAndEmptyHeadersClientCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, NullAndEmptyHeadersClientCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new NullAndEmptyHeadersClientCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NullAndEmptyHeadersClientCommandInput} for command's `input` shape. - * @see {@link NullAndEmptyHeadersClientCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NullAndEmptyHeadersClientCommand extends $Command< - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NullAndEmptyHeadersClientCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "NullAndEmptyHeadersClientCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlNullAndEmptyHeadersClientCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlNullAndEmptyHeadersClientCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts deleted file mode 100644 index d6d4c5f716ba..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/NullAndEmptyHeadersServerCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { NullAndEmptyHeadersIO } from "../models/models_0"; -import { - deserializeAws_restXmlNullAndEmptyHeadersServerCommand, - serializeAws_restXmlNullAndEmptyHeadersServerCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface NullAndEmptyHeadersServerCommandInput extends NullAndEmptyHeadersIO {} -export interface NullAndEmptyHeadersServerCommandOutput extends NullAndEmptyHeadersIO, __MetadataBearer {} - -/** - * Null and empty headers are not sent over the wire. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, NullAndEmptyHeadersServerCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, NullAndEmptyHeadersServerCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new NullAndEmptyHeadersServerCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link NullAndEmptyHeadersServerCommandInput} for command's `input` shape. - * @see {@link NullAndEmptyHeadersServerCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class NullAndEmptyHeadersServerCommand extends $Command< - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: NullAndEmptyHeadersServerCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "NullAndEmptyHeadersServerCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: NullAndEmptyHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlNullAndEmptyHeadersServerCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlNullAndEmptyHeadersServerCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts deleted file mode 100644 index 75fe14d3fd89..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/OmitsNullSerializesEmptyStringCommand.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 { OmitsNullSerializesEmptyStringInput } from "../models/models_0"; -import { - deserializeAws_restXmlOmitsNullSerializesEmptyStringCommand, - serializeAws_restXmlOmitsNullSerializesEmptyStringCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface OmitsNullSerializesEmptyStringCommandInput extends OmitsNullSerializesEmptyStringInput {} -export interface OmitsNullSerializesEmptyStringCommandOutput extends __MetadataBearer {} - -/** - * Omits null, but serializes empty string value. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, OmitsNullSerializesEmptyStringCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, OmitsNullSerializesEmptyStringCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new OmitsNullSerializesEmptyStringCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link OmitsNullSerializesEmptyStringCommandInput} for command's `input` shape. - * @see {@link OmitsNullSerializesEmptyStringCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class OmitsNullSerializesEmptyStringCommand extends $Command< - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: OmitsNullSerializesEmptyStringCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "OmitsNullSerializesEmptyStringCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: OmitsNullSerializesEmptyStringInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize( - input: OmitsNullSerializesEmptyStringCommandInput, - context: __SerdeContext - ): Promise<__HttpRequest> { - return serializeAws_restXmlOmitsNullSerializesEmptyStringCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlOmitsNullSerializesEmptyStringCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts deleted file mode 100644 index 1973f5aab88c..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryIdempotencyTokenAutoFillCommand.ts +++ /dev/null @@ -1,98 +0,0 @@ -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 { QueryIdempotencyTokenAutoFillInput } from "../models/models_0"; -import { - deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommand, - serializeAws_restXmlQueryIdempotencyTokenAutoFillCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface QueryIdempotencyTokenAutoFillCommandInput extends QueryIdempotencyTokenAutoFillInput {} -export interface QueryIdempotencyTokenAutoFillCommandOutput extends __MetadataBearer {} - -/** - * Automatically adds idempotency tokens. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, QueryIdempotencyTokenAutoFillCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, QueryIdempotencyTokenAutoFillCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new QueryIdempotencyTokenAutoFillCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link QueryIdempotencyTokenAutoFillCommandInput} for command's `input` shape. - * @see {@link QueryIdempotencyTokenAutoFillCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class QueryIdempotencyTokenAutoFillCommand extends $Command< - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryIdempotencyTokenAutoFillCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "QueryIdempotencyTokenAutoFillCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryIdempotencyTokenAutoFillInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlQueryIdempotencyTokenAutoFillCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts deleted file mode 100644 index a353051e0eab..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryParamsAsStringListMapCommand.ts +++ /dev/null @@ -1,81 +0,0 @@ -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 { QueryParamsAsStringListMapInput } from "../models/models_0"; -import { - deserializeAws_restXmlQueryParamsAsStringListMapCommand, - serializeAws_restXmlQueryParamsAsStringListMapCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface QueryParamsAsStringListMapCommandInput extends QueryParamsAsStringListMapInput {} -export interface QueryParamsAsStringListMapCommandOutput extends __MetadataBearer {} - -export class QueryParamsAsStringListMapCommand extends $Command< - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryParamsAsStringListMapCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "QueryParamsAsStringListMapCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryParamsAsStringListMapInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlQueryParamsAsStringListMapCommand(input, context); - } - - private deserialize( - output: __HttpResponse, - context: __SerdeContext - ): Promise { - return deserializeAws_restXmlQueryParamsAsStringListMapCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts deleted file mode 100644 index 6d3641e32dc8..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/QueryPrecedenceCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { QueryPrecedenceInput } from "../models/models_0"; -import { - deserializeAws_restXmlQueryPrecedenceCommand, - serializeAws_restXmlQueryPrecedenceCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface QueryPrecedenceCommandInput extends QueryPrecedenceInput {} -export interface QueryPrecedenceCommandOutput extends __MetadataBearer {} - -export class QueryPrecedenceCommand extends $Command< - QueryPrecedenceCommandInput, - QueryPrecedenceCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: QueryPrecedenceCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "QueryPrecedenceCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: QueryPrecedenceInput.filterSensitiveLog, - outputFilterSensitiveLog: (output: any) => output, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: QueryPrecedenceCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlQueryPrecedenceCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlQueryPrecedenceCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts deleted file mode 100644 index 611155ccaa9d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/RecursiveShapesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { RecursiveShapesInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlRecursiveShapesCommand, - serializeAws_restXmlRecursiveShapesCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface RecursiveShapesCommandInput extends RecursiveShapesInputOutput {} -export interface RecursiveShapesCommandOutput extends RecursiveShapesInputOutput, __MetadataBearer {} - -/** - * Recursive shapes - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, RecursiveShapesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, RecursiveShapesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new RecursiveShapesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link RecursiveShapesCommandInput} for command's `input` shape. - * @see {@link RecursiveShapesCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class RecursiveShapesCommand extends $Command< - RecursiveShapesCommandInput, - RecursiveShapesCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: RecursiveShapesCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "RecursiveShapesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: RecursiveShapesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: RecursiveShapesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlRecursiveShapesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlRecursiveShapesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts deleted file mode 100644 index 608833f0a3b3..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/SimpleScalarPropertiesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { SimpleScalarPropertiesInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlSimpleScalarPropertiesCommand, - serializeAws_restXmlSimpleScalarPropertiesCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface SimpleScalarPropertiesCommandInput extends SimpleScalarPropertiesInputOutput {} -export interface SimpleScalarPropertiesCommandOutput extends SimpleScalarPropertiesInputOutput, __MetadataBearer {} - -export class SimpleScalarPropertiesCommand extends $Command< - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: SimpleScalarPropertiesCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "SimpleScalarPropertiesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: SimpleScalarPropertiesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: SimpleScalarPropertiesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlSimpleScalarPropertiesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlSimpleScalarPropertiesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts deleted file mode 100644 index 8e075629fdd4..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/TimestampFormatHeadersCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { TimestampFormatHeadersIO } from "../models/models_0"; -import { - deserializeAws_restXmlTimestampFormatHeadersCommand, - serializeAws_restXmlTimestampFormatHeadersCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface TimestampFormatHeadersCommandInput extends TimestampFormatHeadersIO {} -export interface TimestampFormatHeadersCommandOutput extends TimestampFormatHeadersIO, __MetadataBearer {} - -/** - * The example tests how timestamp request and response headers are serialized. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, TimestampFormatHeadersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, TimestampFormatHeadersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new TimestampFormatHeadersCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link TimestampFormatHeadersCommandInput} for command's `input` shape. - * @see {@link TimestampFormatHeadersCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class TimestampFormatHeadersCommand extends $Command< - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: TimestampFormatHeadersCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "TimestampFormatHeadersCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, - outputFilterSensitiveLog: TimestampFormatHeadersIO.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: TimestampFormatHeadersCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlTimestampFormatHeadersCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlTimestampFormatHeadersCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts deleted file mode 100644 index f7c07eb32ebe..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { XmlAttributesInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlAttributesCommand, - serializeAws_restXmlXmlAttributesCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlAttributesCommandInput extends XmlAttributesInputOutput {} -export interface XmlAttributesCommandOutput extends XmlAttributesInputOutput, __MetadataBearer {} - -/** - * This example serializes an XML attributes on synthesized document. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlAttributesCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlAttributesCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlAttributesCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlAttributesCommandInput} for command's `input` shape. - * @see {@link XmlAttributesCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlAttributesCommand extends $Command< - XmlAttributesCommandInput, - XmlAttributesCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlAttributesCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlAttributesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlAttributesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlAttributesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlAttributesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlAttributesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlAttributesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts deleted file mode 100644 index 2da60886a09d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlAttributesOnPayloadCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { XmlAttributesOnPayloadInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlAttributesOnPayloadCommand, - serializeAws_restXmlXmlAttributesOnPayloadCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlAttributesOnPayloadCommandInput extends XmlAttributesOnPayloadInputOutput {} -export interface XmlAttributesOnPayloadCommandOutput extends XmlAttributesOnPayloadInputOutput, __MetadataBearer {} - -/** - * This example serializes an XML attributes on a document targeted by httpPayload. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlAttributesOnPayloadCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlAttributesOnPayloadCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlAttributesOnPayloadCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlAttributesOnPayloadCommandInput} for command's `input` shape. - * @see {@link XmlAttributesOnPayloadCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlAttributesOnPayloadCommand extends $Command< - XmlAttributesOnPayloadCommandInput, - XmlAttributesOnPayloadCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlAttributesOnPayloadCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlAttributesOnPayloadCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlAttributesOnPayloadInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlAttributesOnPayloadInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlAttributesOnPayloadCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlAttributesOnPayloadCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlAttributesOnPayloadCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts deleted file mode 100644 index 9e5ab80cff31..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlBlobsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlBlobsInputOutput } from "../models/models_0"; -import { deserializeAws_restXmlXmlBlobsCommand, serializeAws_restXmlXmlBlobsCommand } from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlBlobsCommandInput extends XmlBlobsInputOutput {} -export interface XmlBlobsCommandOutput extends XmlBlobsInputOutput, __MetadataBearer {} - -/** - * Blobs are base64 encoded - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlBlobsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlBlobsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlBlobsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlBlobsCommandInput} for command's `input` shape. - * @see {@link XmlBlobsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlBlobsCommand extends $Command< - XmlBlobsCommandInput, - XmlBlobsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlBlobsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts deleted file mode 100644 index 4a07eeeb6df4..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyBlobsCommand.ts +++ /dev/null @@ -1,95 +0,0 @@ -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 { XmlBlobsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlEmptyBlobsCommand, - serializeAws_restXmlXmlEmptyBlobsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlEmptyBlobsCommandInput extends XmlBlobsInputOutput {} -export interface XmlEmptyBlobsCommandOutput extends XmlBlobsInputOutput, __MetadataBearer {} - -/** - * Blobs are base64 encoded - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlEmptyBlobsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlEmptyBlobsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlEmptyBlobsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlEmptyBlobsCommandInput} for command's `input` shape. - * @see {@link XmlEmptyBlobsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlEmptyBlobsCommand extends $Command< - XmlEmptyBlobsCommandInput, - XmlEmptyBlobsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyBlobsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlEmptyBlobsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlBlobsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyBlobsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlEmptyBlobsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlEmptyBlobsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts deleted file mode 100644 index 1198ed9ff3f3..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyListsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlListsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlEmptyListsCommand, - serializeAws_restXmlXmlEmptyListsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlEmptyListsCommandInput extends XmlListsInputOutput {} -export interface XmlEmptyListsCommandOutput extends XmlListsInputOutput, __MetadataBearer {} - -export class XmlEmptyListsCommand extends $Command< - XmlEmptyListsCommandInput, - XmlEmptyListsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyListsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlEmptyListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlEmptyListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlEmptyListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts deleted file mode 100644 index 0e5c07b7ca3e..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyMapsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlMapsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlEmptyMapsCommand, - serializeAws_restXmlXmlEmptyMapsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlEmptyMapsCommandInput extends XmlMapsInputOutput {} -export interface XmlEmptyMapsCommandOutput extends XmlMapsInputOutput, __MetadataBearer {} - -export class XmlEmptyMapsCommand extends $Command< - XmlEmptyMapsCommandInput, - XmlEmptyMapsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyMapsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlEmptyMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlEmptyMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlEmptyMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts deleted file mode 100644 index 7573d164a7b9..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEmptyStringsCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlEmptyStringsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlEmptyStringsCommand, - serializeAws_restXmlXmlEmptyStringsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlEmptyStringsCommandInput extends XmlEmptyStringsInputOutput {} -export interface XmlEmptyStringsCommandOutput extends XmlEmptyStringsInputOutput, __MetadataBearer {} - -export class XmlEmptyStringsCommand extends $Command< - XmlEmptyStringsCommandInput, - XmlEmptyStringsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEmptyStringsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlEmptyStringsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlEmptyStringsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlEmptyStringsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEmptyStringsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlEmptyStringsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlEmptyStringsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts deleted file mode 100644 index 5149ed4a3ee4..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlEnumsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlEnumsInputOutput } from "../models/models_0"; -import { deserializeAws_restXmlXmlEnumsCommand, serializeAws_restXmlXmlEnumsCommand } from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlEnumsCommandInput extends XmlEnumsInputOutput {} -export interface XmlEnumsCommandOutput extends XmlEnumsInputOutput, __MetadataBearer {} - -/** - * This example serializes enums as top level properties, in lists, sets, and maps. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlEnumsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlEnumsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlEnumsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlEnumsCommandInput} for command's `input` shape. - * @see {@link XmlEnumsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlEnumsCommand extends $Command< - XmlEnumsCommandInput, - XmlEnumsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlEnumsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlEnumsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlEnumsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlEnumsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlEnumsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlEnumsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlEnumsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts deleted file mode 100644 index 84f5a70b3c3f..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlListsCommand.ts +++ /dev/null @@ -1,103 +0,0 @@ -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 { XmlListsInputOutput } from "../models/models_0"; -import { deserializeAws_restXmlXmlListsCommand, serializeAws_restXmlXmlListsCommand } from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlListsCommandInput extends XmlListsInputOutput {} -export interface XmlListsCommandOutput extends XmlListsInputOutput, __MetadataBearer {} - -/** - * This test case serializes XML lists for the following cases for both - * input and output: - * - * 1. Normal XML lists. - * 2. Normal XML sets. - * 3. XML lists of lists. - * 4. XML lists with @xmlName on its members - * 5. Flattened XML lists. - * 6. Flattened XML lists with @xmlName. - * 7. Flattened XML lists with @xmlNamespace. - * 8. Lists of structures. - * 9. Flattened XML list of structures - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlListsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlListsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlListsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlListsCommandInput} for command's `input` shape. - * @see {@link XmlListsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlListsCommand extends $Command< - XmlListsCommandInput, - XmlListsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlListsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlListsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlListsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlListsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlListsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlListsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts deleted file mode 100644 index ef2bae358dc6..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsCommand.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 { XmlMapsInputOutput } from "../models/models_0"; -import { deserializeAws_restXmlXmlMapsCommand, serializeAws_restXmlXmlMapsCommand } from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlMapsCommandInput extends XmlMapsInputOutput {} -export interface XmlMapsCommandOutput extends XmlMapsInputOutput, __MetadataBearer {} - -/** - * The example tests basic map serialization. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlMapsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlMapsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlMapsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlMapsCommandInput} for command's `input` shape. - * @see {@link XmlMapsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlMapsCommand extends $Command< - XmlMapsCommandInput, - XmlMapsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlMapsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlMapsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlMapsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlMapsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlMapsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlMapsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts deleted file mode 100644 index 33887182f973..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlMapsXmlNameCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlMapsXmlNameInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlMapsXmlNameCommand, - serializeAws_restXmlXmlMapsXmlNameCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlMapsXmlNameCommandInput extends XmlMapsXmlNameInputOutput {} -export interface XmlMapsXmlNameCommandOutput extends XmlMapsXmlNameInputOutput, __MetadataBearer {} - -export class XmlMapsXmlNameCommand extends $Command< - XmlMapsXmlNameCommandInput, - XmlMapsXmlNameCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlMapsXmlNameCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlMapsXmlNameCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlMapsXmlNameInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlMapsXmlNameInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlMapsXmlNameCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlMapsXmlNameCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlMapsXmlNameCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts deleted file mode 100644 index 30278ecbed6d..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlNamespacesCommand.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 { XmlNamespacesInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlNamespacesCommand, - serializeAws_restXmlXmlNamespacesCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlNamespacesCommandInput extends XmlNamespacesInputOutput {} -export interface XmlNamespacesCommandOutput extends XmlNamespacesInputOutput, __MetadataBearer {} - -export class XmlNamespacesCommand extends $Command< - XmlNamespacesCommandInput, - XmlNamespacesCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlNamespacesCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlNamespacesCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlNamespacesInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlNamespacesInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlNamespacesCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlNamespacesCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlNamespacesCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts deleted file mode 100644 index 54974057f855..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlTimestampsCommand.ts +++ /dev/null @@ -1,97 +0,0 @@ -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 { XmlTimestampsInputOutput } from "../models/models_0"; -import { - deserializeAws_restXmlXmlTimestampsCommand, - serializeAws_restXmlXmlTimestampsCommand, -} from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlTimestampsCommandInput extends XmlTimestampsInputOutput {} -export interface XmlTimestampsCommandOutput extends XmlTimestampsInputOutput, __MetadataBearer {} - -/** - * This tests how timestamps are serialized, including using the - * default format of date-time and various @timestampFormat trait - * values. - * @example - * Use a bare-bones client and the command you need to make an API call. - * ```javascript - * import { RestXmlProtocolClient, XmlTimestampsCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import - * // const { RestXmlProtocolClient, XmlTimestampsCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import - * const client = new RestXmlProtocolClient(config); - * const command = new XmlTimestampsCommand(input); - * const response = await client.send(command); - * ``` - * - * @see {@link XmlTimestampsCommandInput} for command's `input` shape. - * @see {@link XmlTimestampsCommandOutput} for command's `response` shape. - * @see {@link RestXmlProtocolClientResolvedConfig | config} for command's `input` shape. - * - */ -export class XmlTimestampsCommand extends $Command< - XmlTimestampsCommandInput, - XmlTimestampsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlTimestampsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlTimestampsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlTimestampsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlTimestampsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlTimestampsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlTimestampsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlTimestampsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts deleted file mode 100644 index 47e192821e31..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/XmlUnionsCommand.ts +++ /dev/null @@ -1,75 +0,0 @@ -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 { XmlUnionsInputOutput } from "../models/models_0"; -import { deserializeAws_restXmlXmlUnionsCommand, serializeAws_restXmlXmlUnionsCommand } from "../protocols/Aws_restXml"; -import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; - -export interface XmlUnionsCommandInput extends XmlUnionsInputOutput {} -export interface XmlUnionsCommandOutput extends XmlUnionsInputOutput, __MetadataBearer {} - -export class XmlUnionsCommand extends $Command< - XmlUnionsCommandInput, - XmlUnionsCommandOutput, - RestXmlProtocolClientResolvedConfig -> { - // Start section: command_properties - // End section: command_properties - - constructor(readonly input: XmlUnionsCommandInput) { - // Start section: command_constructor - super(); - // End section: command_constructor - } - - /** - * @internal - */ - resolveMiddleware( - clientStack: MiddlewareStack, - configuration: RestXmlProtocolClientResolvedConfig, - options?: __HttpHandlerOptions - ): Handler { - this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - - const stack = clientStack.concat(this.middlewareStack); - - const { logger } = configuration; - const clientName = "RestXmlProtocolClient"; - const commandName = "XmlUnionsCommand"; - const handlerExecutionContext: HandlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: XmlUnionsInputOutput.filterSensitiveLog, - outputFilterSensitiveLog: XmlUnionsInputOutput.filterSensitiveLog, - }; - const { requestHandler } = configuration; - return stack.resolve( - (request: FinalizeHandlerArguments) => - requestHandler.handle(request.request as __HttpRequest, options || {}), - handlerExecutionContext - ); - } - - private serialize(input: XmlUnionsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { - return serializeAws_restXmlXmlUnionsCommand(input, context); - } - - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { - return deserializeAws_restXmlXmlUnionsCommand(output, context); - } - - // Start section: command_body_extra - // End section: command_body_extra -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts b/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts deleted file mode 100644 index 74d2ea6c9bb3..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/commands/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -export * from "./AllQueryStringTypesCommand"; -export * from "./BodyWithXmlNameCommand"; -export * from "./ConstantAndVariableQueryStringCommand"; -export * from "./ConstantQueryStringCommand"; -export * from "./EmptyInputAndEmptyOutputCommand"; -export * from "./EndpointOperationCommand"; -export * from "./EndpointWithHostLabelHeaderOperationCommand"; -export * from "./EndpointWithHostLabelOperationCommand"; -export * from "./FlattenedXmlMapCommand"; -export * from "./FlattenedXmlMapWithXmlNameCommand"; -export * from "./FlattenedXmlMapWithXmlNamespaceCommand"; -export * from "./GreetingWithErrorsCommand"; -export * from "./HttpPayloadTraitsCommand"; -export * from "./HttpPayloadTraitsWithMediaTypeCommand"; -export * from "./HttpPayloadWithMemberXmlNameCommand"; -export * from "./HttpPayloadWithStructureCommand"; -export * from "./HttpPayloadWithXmlNameCommand"; -export * from "./HttpPayloadWithXmlNamespaceAndPrefixCommand"; -export * from "./HttpPayloadWithXmlNamespaceCommand"; -export * from "./HttpPrefixHeadersCommand"; -export * from "./HttpRequestWithFloatLabelsCommand"; -export * from "./HttpRequestWithGreedyLabelInPathCommand"; -export * from "./HttpRequestWithLabelsAndTimestampFormatCommand"; -export * from "./HttpRequestWithLabelsCommand"; -export * from "./HttpResponseCodeCommand"; -export * from "./IgnoreQueryParamsInResponseCommand"; -export * from "./InputAndOutputWithHeadersCommand"; -export * from "./NestedXmlMapsCommand"; -export * from "./NoInputAndNoOutputCommand"; -export * from "./NoInputAndOutputCommand"; -export * from "./NullAndEmptyHeadersClientCommand"; -export * from "./NullAndEmptyHeadersServerCommand"; -export * from "./OmitsNullSerializesEmptyStringCommand"; -export * from "./QueryIdempotencyTokenAutoFillCommand"; -export * from "./QueryParamsAsStringListMapCommand"; -export * from "./QueryPrecedenceCommand"; -export * from "./RecursiveShapesCommand"; -export * from "./SimpleScalarPropertiesCommand"; -export * from "./TimestampFormatHeadersCommand"; -export * from "./XmlAttributesCommand"; -export * from "./XmlAttributesOnPayloadCommand"; -export * from "./XmlBlobsCommand"; -export * from "./XmlEmptyBlobsCommand"; -export * from "./XmlEmptyListsCommand"; -export * from "./XmlEmptyMapsCommand"; -export * from "./XmlEmptyStringsCommand"; -export * from "./XmlEnumsCommand"; -export * from "./XmlListsCommand"; -export * from "./XmlMapsCommand"; -export * from "./XmlMapsXmlNameCommand"; -export * from "./XmlNamespacesCommand"; -export * from "./XmlTimestampsCommand"; -export * from "./XmlUnionsCommand"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts b/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts deleted file mode 100644 index f06accf756de..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/endpoints.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver"; -import { RegionInfoProvider } from "@aws-sdk/types"; - -const regionHash: RegionHash = {}; - -const partitionHash: PartitionHash = { - aws: { - regions: [ - "af-south-1", - "ap-east-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ], - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", - hostname: "restxml.{region}.amazonaws.com", - }, - "aws-cn": { - regions: ["cn-north-1", "cn-northwest-1"], - regionRegex: "^cn\\-\\w+\\-\\d+$", - hostname: "restxml.{region}.amazonaws.com.cn", - }, - "aws-iso": { - regions: ["us-iso-east-1", "us-iso-west-1"], - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - hostname: "restxml.{region}.c2s.ic.gov", - }, - "aws-iso-b": { - regions: ["us-isob-east-1"], - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - hostname: "restxml.{region}.sc2s.sgov.gov", - }, - "aws-us-gov": { - regions: ["us-gov-east-1", "us-gov-west-1"], - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - hostname: "restxml.{region}.amazonaws.com", - }, -}; - -export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) => - getRegionInfo(region, { - ...options, - signingService: "restxml", - regionHash, - partitionHash, - }); diff --git a/protocol_tests/aws-protocoltests-restxml/src/index.ts b/protocol_tests/aws-protocoltests-restxml/src/index.ts deleted file mode 100644 index 59ad9430b749..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./RestXmlProtocol"; -export * from "./RestXmlProtocolClient"; -export * from "./commands"; -export * from "./models"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/models/index.ts b/protocol_tests/aws-protocoltests-restxml/src/models/index.ts deleted file mode 100644 index 09c5d6e09b8c..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./models_0"; diff --git a/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts b/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts deleted file mode 100644 index 288c93cb643a..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/models/models_0.ts +++ /dev/null @@ -1,1141 +0,0 @@ -import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; - -export enum FooEnum { - BAR = "Bar", - BAZ = "Baz", - FOO = "Foo", - ONE = "1", - ZERO = "0", -} - -export interface AllQueryStringTypesInput { - queryString?: string; - queryStringList?: string[]; - queryStringSet?: string[]; - queryByte?: number; - queryShort?: number; - queryInteger?: number; - queryIntegerList?: number[]; - queryIntegerSet?: number[]; - queryLong?: number; - queryFloat?: number; - queryDouble?: number; - queryDoubleList?: number[]; - queryBoolean?: boolean; - queryBooleanList?: boolean[]; - queryTimestamp?: Date; - queryTimestampList?: Date[]; - queryEnum?: FooEnum | string; - queryEnumList?: (FooEnum | string)[]; - queryParamsMapOfStrings?: { [key: string]: string }; -} - -export namespace AllQueryStringTypesInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: AllQueryStringTypesInput): any => ({ - ...obj, - }); -} - -export interface PayloadWithXmlName { - name?: string; -} - -export namespace PayloadWithXmlName { - /** - * @internal - */ - export const filterSensitiveLog = (obj: PayloadWithXmlName): any => ({ - ...obj, - }); -} - -export interface BodyWithXmlNameInputOutput { - nested?: PayloadWithXmlName; -} - -export namespace BodyWithXmlNameInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: BodyWithXmlNameInputOutput): any => ({ - ...obj, - }); -} - -export interface ComplexNestedErrorData { - Foo?: string; -} - -export namespace ComplexNestedErrorData { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when a request is invalid. - */ -export interface ComplexError extends __SmithyException, $MetadataBearer { - name: "ComplexError"; - $fault: "client"; - Header?: string; - TopLevel?: string; - Nested?: ComplexNestedErrorData; -} - -export namespace ComplexError { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ComplexError): any => ({ - ...obj, - }); -} - -export interface ConstantAndVariableQueryStringInput { - baz?: string; - maybeSet?: string; -} - -export namespace ConstantAndVariableQueryStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ConstantAndVariableQueryStringInput): any => ({ - ...obj, - }); -} - -export interface ConstantQueryStringInput { - hello: string | undefined; -} - -export namespace ConstantQueryStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: ConstantQueryStringInput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputInput {} - -export namespace EmptyInputAndEmptyOutputInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ - ...obj, - }); -} - -export interface EmptyInputAndEmptyOutputOutput {} - -export namespace EmptyInputAndEmptyOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ - ...obj, - }); -} - -export interface HostLabelHeaderInput { - accountId: string | undefined; -} - -export namespace HostLabelHeaderInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelHeaderInput): any => ({ - ...obj, - }); -} - -export interface HostLabelInput { - label: string | undefined; -} - -export namespace HostLabelInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HostLabelInput): any => ({ - ...obj, - }); -} - -export interface FlattenedXmlMapInputOutput { - myMap?: { [key: string]: FooEnum | string }; -} - -export namespace FlattenedXmlMapInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapInputOutput): any => ({ - ...obj, - }); -} - -export interface FlattenedXmlMapWithXmlNameInputOutput { - myMap?: { [key: string]: string }; -} - -export namespace FlattenedXmlMapWithXmlNameInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNameInputOutput): any => ({ - ...obj, - }); -} - -export interface FlattenedXmlMapWithXmlNamespaceOutput { - myMap?: { [key: string]: string }; -} - -export namespace FlattenedXmlMapWithXmlNamespaceOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: FlattenedXmlMapWithXmlNamespaceOutput): any => ({ - ...obj, - }); -} - -export interface GreetingWithErrorsOutput { - greeting?: string; -} - -export namespace GreetingWithErrorsOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ - ...obj, - }); -} - -/** - * This error is thrown when an invalid greeting value is provided. - */ -export interface InvalidGreeting extends __SmithyException, $MetadataBearer { - name: "InvalidGreeting"; - $fault: "client"; - Message?: string; -} - -export namespace InvalidGreeting { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InvalidGreeting): any => ({ - ...obj, - }); -} - -export interface HttpPayloadTraitsInputOutput { - foo?: string; - blob?: Uint8Array; -} - -export namespace HttpPayloadTraitsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadTraitsInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPayloadTraitsWithMediaTypeInputOutput { - foo?: string; - blob?: Uint8Array; -} - -export namespace HttpPayloadTraitsWithMediaTypeInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadTraitsWithMediaTypeInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithMemberXmlNameInputOutput { - nested?: PayloadWithXmlName; -} - -export namespace HttpPayloadWithMemberXmlNameInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithMemberXmlNameInputOutput): any => ({ - ...obj, - }); -} - -export interface NestedPayload { - greeting?: string; - name?: string; -} - -export namespace NestedPayload { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedPayload): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithStructureInputOutput { - nested?: NestedPayload; -} - -export namespace HttpPayloadWithStructureInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithStructureInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithXmlNameInputOutput { - nested?: PayloadWithXmlName; -} - -export namespace HttpPayloadWithXmlNameInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithXmlNameInputOutput): any => ({ - ...obj, - }); -} - -export interface PayloadWithXmlNamespace { - name?: string; -} - -export namespace PayloadWithXmlNamespace { - /** - * @internal - */ - export const filterSensitiveLog = (obj: PayloadWithXmlNamespace): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithXmlNamespaceInputOutput { - nested?: PayloadWithXmlNamespace; -} - -export namespace HttpPayloadWithXmlNamespaceInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithXmlNamespaceInputOutput): any => ({ - ...obj, - }); -} - -export interface PayloadWithXmlNamespaceAndPrefix { - name?: string; -} - -export namespace PayloadWithXmlNamespaceAndPrefix { - /** - * @internal - */ - export const filterSensitiveLog = (obj: PayloadWithXmlNamespaceAndPrefix): any => ({ - ...obj, - }); -} - -export interface HttpPayloadWithXmlNamespaceAndPrefixInputOutput { - nested?: PayloadWithXmlNamespaceAndPrefix; -} - -export namespace HttpPayloadWithXmlNamespaceAndPrefixInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPayloadWithXmlNamespaceAndPrefixInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpPrefixHeadersInputOutput { - foo?: string; - fooMap?: { [key: string]: string }; -} - -export namespace HttpPrefixHeadersInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpPrefixHeadersInputOutput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithFloatLabelsInput { - float: number | undefined; - double: number | undefined; -} - -export namespace HttpRequestWithFloatLabelsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithFloatLabelsInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithGreedyLabelInPathInput { - foo: string | undefined; - baz: string | undefined; -} - -export namespace HttpRequestWithGreedyLabelInPathInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithGreedyLabelInPathInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithLabelsInput { - string: string | undefined; - short: number | undefined; - integer: number | undefined; - long: number | undefined; - float: number | undefined; - double: number | undefined; - /** - * Serialized in the path as true or false. - */ - boolean: boolean | undefined; - - /** - * Note that this member has no format, so it's serialized as an RFC 3399 date-time. - */ - timestamp: Date | undefined; -} - -export namespace HttpRequestWithLabelsInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithLabelsInput): any => ({ - ...obj, - }); -} - -export interface HttpRequestWithLabelsAndTimestampFormatInput { - memberEpochSeconds: Date | undefined; - memberHttpDate: Date | undefined; - memberDateTime: Date | undefined; - defaultFormat: Date | undefined; - targetEpochSeconds: Date | undefined; - targetHttpDate: Date | undefined; - targetDateTime: Date | undefined; -} - -export namespace HttpRequestWithLabelsAndTimestampFormatInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpRequestWithLabelsAndTimestampFormatInput): any => ({ - ...obj, - }); -} - -export interface HttpResponseCodeOutput { - Status?: number; -} - -export namespace HttpResponseCodeOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: HttpResponseCodeOutput): any => ({ - ...obj, - }); -} - -export interface IgnoreQueryParamsInResponseOutput { - baz?: string; -} - -export namespace IgnoreQueryParamsInResponseOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: IgnoreQueryParamsInResponseOutput): any => ({ - ...obj, - }); -} - -export interface InputAndOutputWithHeadersIO { - headerString?: string; - headerByte?: number; - headerShort?: number; - headerInteger?: number; - headerLong?: number; - headerFloat?: number; - headerDouble?: number; - headerTrueBool?: boolean; - headerFalseBool?: boolean; - headerStringList?: string[]; - headerStringSet?: string[]; - headerIntegerList?: number[]; - headerBooleanList?: boolean[]; - headerTimestampList?: Date[]; - headerEnum?: FooEnum | string; - headerEnumList?: (FooEnum | string)[]; -} - -export namespace InputAndOutputWithHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: InputAndOutputWithHeadersIO): any => ({ - ...obj, - }); -} - -export interface NestedXmlMapsInputOutput { - nestedMap?: { [key: string]: { [key: string]: FooEnum | string } }; - flatNestedMap?: { [key: string]: { [key: string]: FooEnum | string } }; -} - -export namespace NestedXmlMapsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NestedXmlMapsInputOutput): any => ({ - ...obj, - }); -} - -export interface NoInputAndOutputOutput {} - -export namespace NoInputAndOutputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ - ...obj, - }); -} - -export interface NullAndEmptyHeadersIO { - a?: string; - b?: string; - c?: string[]; -} - -export namespace NullAndEmptyHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: NullAndEmptyHeadersIO): any => ({ - ...obj, - }); -} - -export interface OmitsNullSerializesEmptyStringInput { - nullValue?: string; - emptyString?: string; -} - -export namespace OmitsNullSerializesEmptyStringInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: OmitsNullSerializesEmptyStringInput): any => ({ - ...obj, - }); -} - -export interface QueryIdempotencyTokenAutoFillInput { - token?: string; -} - -export namespace QueryIdempotencyTokenAutoFillInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ - ...obj, - }); -} - -export interface QueryParamsAsStringListMapInput { - qux?: string; - foo?: { [key: string]: string[] }; -} - -export namespace QueryParamsAsStringListMapInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryParamsAsStringListMapInput): any => ({ - ...obj, - }); -} - -export interface QueryPrecedenceInput { - foo?: string; - baz?: { [key: string]: string }; -} - -export namespace QueryPrecedenceInput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: QueryPrecedenceInput): any => ({ - ...obj, - }); -} - -export interface SimpleScalarPropertiesInputOutput { - foo?: string; - stringValue?: string; - trueBooleanValue?: boolean; - falseBooleanValue?: boolean; - byteValue?: number; - shortValue?: number; - integerValue?: number; - longValue?: number; - floatValue?: number; - doubleValue?: number; -} - -export namespace SimpleScalarPropertiesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: SimpleScalarPropertiesInputOutput): any => ({ - ...obj, - }); -} - -export interface TimestampFormatHeadersIO { - memberEpochSeconds?: Date; - memberHttpDate?: Date; - memberDateTime?: Date; - defaultFormat?: Date; - targetEpochSeconds?: Date; - targetHttpDate?: Date; - targetDateTime?: Date; -} - -export namespace TimestampFormatHeadersIO { - /** - * @internal - */ - export const filterSensitiveLog = (obj: TimestampFormatHeadersIO): any => ({ - ...obj, - }); -} - -export interface XmlAttributesInputOutput { - foo?: string; - attr?: string; -} - -export namespace XmlAttributesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlAttributesInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlAttributesOnPayloadInputOutput { - payload?: XmlAttributesInputOutput; -} - -export namespace XmlAttributesOnPayloadInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlAttributesOnPayloadInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlBlobsInputOutput { - data?: Uint8Array; -} - -export namespace XmlBlobsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlBlobsInputOutput): any => ({ - ...obj, - }); -} - -export interface StructureListMember { - a?: string; - b?: string; -} - -export namespace StructureListMember { - /** - * @internal - */ - export const filterSensitiveLog = (obj: StructureListMember): any => ({ - ...obj, - }); -} - -export interface XmlListsInputOutput { - stringList?: string[]; - stringSet?: string[]; - integerList?: number[]; - booleanList?: boolean[]; - timestampList?: Date[]; - enumList?: (FooEnum | string)[]; - /** - * A list of lists of strings. - */ - nestedStringList?: string[][]; - - renamedListMembers?: string[]; - flattenedList?: string[]; - flattenedList2?: string[]; - flattenedListWithMemberNamespace?: string[]; - flattenedListWithNamespace?: string[]; - structureList?: StructureListMember[]; - flattenedStructureList?: StructureListMember[]; -} - -export namespace XmlListsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlListsInputOutput): any => ({ - ...obj, - }); -} - -export interface GreetingStruct { - hi?: string; -} - -export namespace GreetingStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: GreetingStruct): any => ({ - ...obj, - }); -} - -export interface XmlMapsInputOutput { - myMap?: { [key: string]: GreetingStruct }; -} - -export namespace XmlMapsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlMapsInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlEmptyStringsInputOutput { - emptyString?: string; -} - -export namespace XmlEmptyStringsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlEmptyStringsInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlEnumsInputOutput { - fooEnum1?: FooEnum | string; - fooEnum2?: FooEnum | string; - fooEnum3?: FooEnum | string; - fooEnumList?: (FooEnum | string)[]; - fooEnumSet?: (FooEnum | string)[]; - fooEnumMap?: { [key: string]: FooEnum | string }; -} - -export namespace XmlEnumsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlEnumsInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlMapsXmlNameInputOutput { - myMap?: { [key: string]: GreetingStruct }; -} - -export namespace XmlMapsXmlNameInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlMapsXmlNameInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlNamespaceNested { - foo?: string; - values?: string[]; -} - -export namespace XmlNamespaceNested { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespaceNested): any => ({ - ...obj, - }); -} - -export interface XmlNamespacesInputOutput { - nested?: XmlNamespaceNested; -} - -export namespace XmlNamespacesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNamespacesInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlTimestampsInputOutput { - normal?: Date; - dateTime?: Date; - epochSeconds?: Date; - httpDate?: Date; -} - -export namespace XmlTimestampsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlTimestampsInputOutput): any => ({ - ...obj, - }); -} - -export interface XmlNestedUnionStruct { - stringValue?: string; - booleanValue?: boolean; - byteValue?: number; - shortValue?: number; - integerValue?: number; - longValue?: number; - floatValue?: number; - doubleValue?: number; -} - -export namespace XmlNestedUnionStruct { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlNestedUnionStruct): any => ({ - ...obj, - }); -} - -export type XmlUnionShape = - | XmlUnionShape.BooleanValueMember - | XmlUnionShape.ByteValueMember - | XmlUnionShape.DoubleValueMember - | XmlUnionShape.FloatValueMember - | XmlUnionShape.IntegerValueMember - | XmlUnionShape.LongValueMember - | XmlUnionShape.ShortValueMember - | XmlUnionShape.StringValueMember - | XmlUnionShape.StructValueMember - | XmlUnionShape.UnionValueMember - | XmlUnionShape.$UnknownMember; - -export namespace XmlUnionShape { - export interface StringValueMember { - stringValue: string; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface BooleanValueMember { - stringValue?: never; - booleanValue: boolean; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface ByteValueMember { - stringValue?: never; - booleanValue?: never; - byteValue: number; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface ShortValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue: number; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface IntegerValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue: number; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface LongValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue: number; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface FloatValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue: number; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface DoubleValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue: number; - unionValue?: never; - structValue?: never; - $unknown?: never; - } - - export interface UnionValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue: XmlUnionShape; - structValue?: never; - $unknown?: never; - } - - export interface StructValueMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue: XmlNestedUnionStruct; - $unknown?: never; - } - - export interface $UnknownMember { - stringValue?: never; - booleanValue?: never; - byteValue?: never; - shortValue?: never; - integerValue?: never; - longValue?: never; - floatValue?: never; - doubleValue?: never; - unionValue?: never; - structValue?: never; - $unknown: [string, any]; - } - - export interface Visitor { - stringValue: (value: string) => T; - booleanValue: (value: boolean) => T; - byteValue: (value: number) => T; - shortValue: (value: number) => T; - integerValue: (value: number) => T; - longValue: (value: number) => T; - floatValue: (value: number) => T; - doubleValue: (value: number) => T; - unionValue: (value: XmlUnionShape) => T; - structValue: (value: XmlNestedUnionStruct) => T; - _: (name: string, value: any) => T; - } - - export const visit = (value: XmlUnionShape, visitor: Visitor): T => { - if (value.stringValue !== undefined) return visitor.stringValue(value.stringValue); - if (value.booleanValue !== undefined) return visitor.booleanValue(value.booleanValue); - if (value.byteValue !== undefined) return visitor.byteValue(value.byteValue); - if (value.shortValue !== undefined) return visitor.shortValue(value.shortValue); - if (value.integerValue !== undefined) return visitor.integerValue(value.integerValue); - if (value.longValue !== undefined) return visitor.longValue(value.longValue); - if (value.floatValue !== undefined) return visitor.floatValue(value.floatValue); - if (value.doubleValue !== undefined) return visitor.doubleValue(value.doubleValue); - if (value.unionValue !== undefined) return visitor.unionValue(value.unionValue); - if (value.structValue !== undefined) return visitor.structValue(value.structValue); - return visitor._(value.$unknown[0], value.$unknown[1]); - }; - - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlUnionShape): any => { - if (obj.stringValue !== undefined) return { stringValue: obj.stringValue }; - if (obj.booleanValue !== undefined) return { booleanValue: obj.booleanValue }; - if (obj.byteValue !== undefined) return { byteValue: obj.byteValue }; - if (obj.shortValue !== undefined) return { shortValue: obj.shortValue }; - if (obj.integerValue !== undefined) return { integerValue: obj.integerValue }; - if (obj.longValue !== undefined) return { longValue: obj.longValue }; - if (obj.floatValue !== undefined) return { floatValue: obj.floatValue }; - if (obj.doubleValue !== undefined) return { doubleValue: obj.doubleValue }; - if (obj.unionValue !== undefined) return { unionValue: XmlUnionShape.filterSensitiveLog(obj.unionValue) }; - if (obj.structValue !== undefined) return { structValue: XmlNestedUnionStruct.filterSensitiveLog(obj.structValue) }; - if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; - }; -} - -export interface RecursiveShapesInputOutputNested1 { - foo?: string; - nested?: RecursiveShapesInputOutputNested2; -} - -export namespace RecursiveShapesInputOutputNested1 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested1): any => ({ - ...obj, - }); -} - -export interface RecursiveShapesInputOutputNested2 { - bar?: string; - recursiveMember?: RecursiveShapesInputOutputNested1; -} - -export namespace RecursiveShapesInputOutputNested2 { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested2): any => ({ - ...obj, - }); -} - -export interface XmlUnionsInputOutput { - unionValue?: XmlUnionShape; -} - -export namespace XmlUnionsInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: XmlUnionsInputOutput): any => ({ - ...obj, - ...(obj.unionValue && { unionValue: XmlUnionShape.filterSensitiveLog(obj.unionValue) }), - }); -} - -export interface RecursiveShapesInputOutput { - nested?: RecursiveShapesInputOutputNested1; -} - -export namespace RecursiveShapesInputOutput { - /** - * @internal - */ - export const filterSensitiveLog = (obj: RecursiveShapesInputOutput): any => ({ - ...obj, - }); -} diff --git a/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts deleted file mode 100644 index b969d18f04e9..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts +++ /dev/null @@ -1,6221 +0,0 @@ -import { - HttpRequest as __HttpRequest, - HttpResponse as __HttpResponse, - isValidHostname as __isValidHostname, -} from "@aws-sdk/protocol-http"; -import { - dateToUtcString as __dateToUtcString, - expectNonNull as __expectNonNull, - expectObject as __expectObject, - expectString as __expectString, - expectUnion as __expectUnion, - extendedEncodeURIComponent as __extendedEncodeURIComponent, - getArrayIfSingleItem as __getArrayIfSingleItem, - getValueFromTextNode as __getValueFromTextNode, - parseBoolean as __parseBoolean, - parseEpochTimestamp as __parseEpochTimestamp, - parseRfc3339DateTime as __parseRfc3339DateTime, - parseRfc7231DateTime as __parseRfc7231DateTime, - splitEvery as __splitEvery, - strictParseByte as __strictParseByte, - strictParseDouble as __strictParseDouble, - strictParseFloat as __strictParseFloat, - strictParseInt32 as __strictParseInt32, - strictParseLong as __strictParseLong, - strictParseShort as __strictParseShort, -} from "@aws-sdk/smithy-client"; -import { - Endpoint as __Endpoint, - MetadataBearer as __MetadataBearer, - ResponseMetadata as __ResponseMetadata, - SerdeContext as __SerdeContext, - SmithyException as __SmithyException, -} from "@aws-sdk/types"; -import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; -import { v4 as generateIdempotencyToken } from "uuid"; - -import { - AllQueryStringTypesCommandInput, - AllQueryStringTypesCommandOutput, -} from "../commands/AllQueryStringTypesCommand"; -import { BodyWithXmlNameCommandInput, BodyWithXmlNameCommandOutput } from "../commands/BodyWithXmlNameCommand"; -import { - ConstantAndVariableQueryStringCommandInput, - ConstantAndVariableQueryStringCommandOutput, -} from "../commands/ConstantAndVariableQueryStringCommand"; -import { - ConstantQueryStringCommandInput, - ConstantQueryStringCommandOutput, -} from "../commands/ConstantQueryStringCommand"; -import { - EmptyInputAndEmptyOutputCommandInput, - EmptyInputAndEmptyOutputCommandOutput, -} from "../commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; -import { - EndpointWithHostLabelHeaderOperationCommandInput, - EndpointWithHostLabelHeaderOperationCommandOutput, -} from "../commands/EndpointWithHostLabelHeaderOperationCommand"; -import { - EndpointWithHostLabelOperationCommandInput, - EndpointWithHostLabelOperationCommandOutput, -} from "../commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommandInput, FlattenedXmlMapCommandOutput } from "../commands/FlattenedXmlMapCommand"; -import { - FlattenedXmlMapWithXmlNameCommandInput, - FlattenedXmlMapWithXmlNameCommandOutput, -} from "../commands/FlattenedXmlMapWithXmlNameCommand"; -import { - FlattenedXmlMapWithXmlNamespaceCommandInput, - FlattenedXmlMapWithXmlNamespaceCommandOutput, -} from "../commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; -import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand"; -import { - HttpPayloadTraitsWithMediaTypeCommandInput, - HttpPayloadTraitsWithMediaTypeCommandOutput, -} from "../commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { - HttpPayloadWithMemberXmlNameCommandInput, - HttpPayloadWithMemberXmlNameCommandOutput, -} from "../commands/HttpPayloadWithMemberXmlNameCommand"; -import { - HttpPayloadWithStructureCommandInput, - HttpPayloadWithStructureCommandOutput, -} from "../commands/HttpPayloadWithStructureCommand"; -import { - HttpPayloadWithXmlNameCommandInput, - HttpPayloadWithXmlNameCommandOutput, -} from "../commands/HttpPayloadWithXmlNameCommand"; -import { - HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - HttpPayloadWithXmlNamespaceAndPrefixCommandOutput, -} from "../commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; -import { - HttpPayloadWithXmlNamespaceCommandInput, - HttpPayloadWithXmlNamespaceCommandOutput, -} from "../commands/HttpPayloadWithXmlNamespaceCommand"; -import { HttpPrefixHeadersCommandInput, HttpPrefixHeadersCommandOutput } from "../commands/HttpPrefixHeadersCommand"; -import { - HttpRequestWithFloatLabelsCommandInput, - HttpRequestWithFloatLabelsCommandOutput, -} from "../commands/HttpRequestWithFloatLabelsCommand"; -import { - HttpRequestWithGreedyLabelInPathCommandInput, - HttpRequestWithGreedyLabelInPathCommandOutput, -} from "../commands/HttpRequestWithGreedyLabelInPathCommand"; -import { - HttpRequestWithLabelsAndTimestampFormatCommandInput, - HttpRequestWithLabelsAndTimestampFormatCommandOutput, -} from "../commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { - HttpRequestWithLabelsCommandInput, - HttpRequestWithLabelsCommandOutput, -} from "../commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommandInput, HttpResponseCodeCommandOutput } from "../commands/HttpResponseCodeCommand"; -import { - IgnoreQueryParamsInResponseCommandInput, - IgnoreQueryParamsInResponseCommandOutput, -} from "../commands/IgnoreQueryParamsInResponseCommand"; -import { - InputAndOutputWithHeadersCommandInput, - InputAndOutputWithHeadersCommandOutput, -} from "../commands/InputAndOutputWithHeadersCommand"; -import { NestedXmlMapsCommandInput, NestedXmlMapsCommandOutput } from "../commands/NestedXmlMapsCommand"; -import { NoInputAndNoOutputCommandInput, NoInputAndNoOutputCommandOutput } from "../commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommandInput, NoInputAndOutputCommandOutput } from "../commands/NoInputAndOutputCommand"; -import { - NullAndEmptyHeadersClientCommandInput, - NullAndEmptyHeadersClientCommandOutput, -} from "../commands/NullAndEmptyHeadersClientCommand"; -import { - NullAndEmptyHeadersServerCommandInput, - NullAndEmptyHeadersServerCommandOutput, -} from "../commands/NullAndEmptyHeadersServerCommand"; -import { - OmitsNullSerializesEmptyStringCommandInput, - OmitsNullSerializesEmptyStringCommandOutput, -} from "../commands/OmitsNullSerializesEmptyStringCommand"; -import { - QueryIdempotencyTokenAutoFillCommandInput, - QueryIdempotencyTokenAutoFillCommandOutput, -} from "../commands/QueryIdempotencyTokenAutoFillCommand"; -import { - QueryParamsAsStringListMapCommandInput, - QueryParamsAsStringListMapCommandOutput, -} from "../commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommandInput, QueryPrecedenceCommandOutput } from "../commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommandInput, RecursiveShapesCommandOutput } from "../commands/RecursiveShapesCommand"; -import { - SimpleScalarPropertiesCommandInput, - SimpleScalarPropertiesCommandOutput, -} from "../commands/SimpleScalarPropertiesCommand"; -import { - TimestampFormatHeadersCommandInput, - TimestampFormatHeadersCommandOutput, -} from "../commands/TimestampFormatHeadersCommand"; -import { XmlAttributesCommandInput, XmlAttributesCommandOutput } from "../commands/XmlAttributesCommand"; -import { - XmlAttributesOnPayloadCommandInput, - XmlAttributesOnPayloadCommandOutput, -} from "../commands/XmlAttributesOnPayloadCommand"; -import { XmlBlobsCommandInput, XmlBlobsCommandOutput } from "../commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommandInput, XmlEmptyBlobsCommandOutput } from "../commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommandInput, XmlEmptyListsCommandOutput } from "../commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommandInput, XmlEmptyMapsCommandOutput } from "../commands/XmlEmptyMapsCommand"; -import { XmlEmptyStringsCommandInput, XmlEmptyStringsCommandOutput } from "../commands/XmlEmptyStringsCommand"; -import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "../commands/XmlEnumsCommand"; -import { XmlListsCommandInput, XmlListsCommandOutput } from "../commands/XmlListsCommand"; -import { XmlMapsCommandInput, XmlMapsCommandOutput } from "../commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "../commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "../commands/XmlNamespacesCommand"; -import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "../commands/XmlTimestampsCommand"; -import { XmlUnionsCommandInput, XmlUnionsCommandOutput } from "../commands/XmlUnionsCommand"; -import { - ComplexError, - ComplexNestedErrorData, - FooEnum, - GreetingStruct, - InvalidGreeting, - NestedPayload, - PayloadWithXmlName, - PayloadWithXmlNamespace, - PayloadWithXmlNamespaceAndPrefix, - RecursiveShapesInputOutputNested1, - RecursiveShapesInputOutputNested2, - StructureListMember, - XmlAttributesInputOutput, - XmlNamespaceNested, - XmlNestedUnionStruct, - XmlUnionShape, -} from "../models/models_0"; - -export const serializeAws_restXmlAllQueryStringTypesCommand = async ( - input: AllQueryStringTypesCommandInput, - 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 || ""}` + "/AllQueryStringTypesInput"; - const query: any = { - ...(input.queryParamsMapOfStrings !== undefined && input.queryParamsMapOfStrings), - ...(input.queryString !== undefined && { String: input.queryString }), - ...(input.queryStringList !== undefined && { - StringList: (input.queryStringList || []).map((_entry) => _entry as any), - }), - ...(input.queryStringSet !== undefined && { - StringSet: (Array.from(input.queryStringSet.values()) || []).map((_entry) => _entry as any), - }), - ...(input.queryByte !== undefined && { Byte: input.queryByte.toString() }), - ...(input.queryShort !== undefined && { Short: input.queryShort.toString() }), - ...(input.queryInteger !== undefined && { Integer: input.queryInteger.toString() }), - ...(input.queryIntegerList !== undefined && { - IntegerList: (input.queryIntegerList || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryIntegerSet !== undefined && { - IntegerSet: (Array.from(input.queryIntegerSet.values()) || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryLong !== undefined && { Long: input.queryLong.toString() }), - ...(input.queryFloat !== undefined && { - Float: input.queryFloat % 1 == 0 ? input.queryFloat + ".0" : input.queryFloat.toString(), - }), - ...(input.queryDouble !== undefined && { - Double: input.queryDouble % 1 == 0 ? input.queryDouble + ".0" : input.queryDouble.toString(), - }), - ...(input.queryDoubleList !== undefined && { - DoubleList: (input.queryDoubleList || []).map( - (_entry) => (_entry % 1 == 0 ? _entry + ".0" : _entry.toString()) as any - ), - }), - ...(input.queryBoolean !== undefined && { Boolean: input.queryBoolean.toString() }), - ...(input.queryBooleanList !== undefined && { - BooleanList: (input.queryBooleanList || []).map((_entry) => _entry.toString() as any), - }), - ...(input.queryTimestamp !== undefined && { - Timestamp: (input.queryTimestamp.toISOString().split(".")[0] + "Z").toString(), - }), - ...(input.queryTimestampList !== undefined && { - TimestampList: (input.queryTimestampList || []).map( - (_entry) => (_entry.toISOString().split(".")[0] + "Z").toString() as any - ), - }), - ...(input.queryEnum !== undefined && { Enum: input.queryEnum }), - ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry as any) }), - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restXmlBodyWithXmlNameCommand = async ( - input: BodyWithXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BodyWithXmlName"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("Ahoy"); - if (input.nested !== undefined) { - const node = serializeAws_restXmlPayloadWithXmlName(input.nested, context).withName("nested"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlConstantAndVariableQueryStringCommand = async ( - input: ConstantAndVariableQueryStringCommandInput, - 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 || ""}` + "/ConstantAndVariableQueryString"; - const query: any = { - foo: "bar", - ...(input.baz !== undefined && { baz: input.baz }), - ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restXmlConstantQueryStringCommand = async ( - input: ConstantQueryStringCommandInput, - 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 || ""}` + "/ConstantQueryString/{hello}"; - if (input.hello !== undefined) { - const labelValue: string = input.hello; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: hello."); - } - resolvedPath = resolvedPath.replace("{hello}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: hello."); - } - const query: any = { - foo: "bar", - hello: "", - }; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); -}; - -export const serializeAws_restXmlEmptyInputAndEmptyOutputCommand = async ( - input: EmptyInputAndEmptyOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EmptyInputAndEmptyOutput"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlEndpointOperationCommand = async ( - input: EndpointOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointOperation"; - let body: any; - body = ""; - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo." + resolvedHostname; - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return new __HttpRequest({ - protocol, - hostname: resolvedHostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand = async ( - input: EndpointWithHostLabelHeaderOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - ...(isSerializableHeaderValue(input.accountId) && { "x-amz-account-id": input.accountId! }), - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelHeaderOperation"; - let body: any; - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "{accountId}." + resolvedHostname; - if (input.accountId === undefined) { - throw new Error("Empty value provided for input host prefix: accountId."); - } - resolvedHostname = resolvedHostname.replace("{accountId}", input.accountId!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return new __HttpRequest({ - protocol, - hostname: resolvedHostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlEndpointWithHostLabelOperationCommand = async ( - input: EndpointWithHostLabelOperationCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelOperation"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("HostLabelInput"); - if (input.label !== undefined) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.label)).withName("label"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "foo.{label}." + resolvedHostname; - if (input.label === undefined) { - throw new Error("Empty value provided for input host prefix: label."); - } - resolvedHostname = resolvedHostname.replace("{label}", input.label!); - if (!__isValidHostname(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); - } - } - return new __HttpRequest({ - protocol, - hostname: resolvedHostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlFlattenedXmlMapCommand = async ( - input: FlattenedXmlMapCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMap"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("FlattenedXmlMapInputOutput"); - if (input.myMap !== undefined) { - const nodes = serializeAws_restXmlFooEnumMap(input.myMap, context); - nodes.map((node: any) => { - node = node.withName("myMap"); - bodyNode.addChildNode(node); - }); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand = async ( - input: FlattenedXmlMapWithXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlName"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("FlattenedXmlMapWithXmlNameInputOutput"); - if (input.myMap !== undefined) { - const nodes = serializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap(input.myMap, context); - nodes.map((node: any) => { - node = node.withName("KVP"); - bodyNode.addChildNode(node); - }); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand = async ( - input: FlattenedXmlMapWithXmlNamespaceCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlNamespace"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlGreetingWithErrorsCommand = async ( - input: GreetingWithErrorsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GreetingWithErrors"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadTraitsCommand = async ( - input: HttpPayloadTraitsCommandInput, - 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 || ""}` + "/HttpPayloadTraits"; - let body: any; - if (input.blob !== undefined) { - body = input.blob; - } - let contents: any; - if (input.blob !== undefined) { - contents = input.blob; - body = contents; - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( - input: HttpPayloadTraitsWithMediaTypeCommandInput, - 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 || ""}` + "/HttpPayloadTraitsWithMediaType"; - let body: any; - if (input.blob !== undefined) { - body = input.blob; - } - let contents: any; - if (input.blob !== undefined) { - contents = input.blob; - body = contents; - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand = async ( - input: HttpPayloadWithMemberXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithMemberXmlName"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); - } - let contents: any; - if (input.nested !== undefined) { - contents = serializeAws_restXmlPayloadWithXmlName(input.nested, context); - contents = contents.withName("Hola"); - body = ''; - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadWithStructureCommand = async ( - input: HttpPayloadWithStructureCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restXmlNestedPayload(input.nested, context); - } - let contents: any; - if (input.nested !== undefined) { - contents = serializeAws_restXmlNestedPayload(input.nested, context); - body = ''; - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadWithXmlNameCommand = async ( - input: HttpPayloadWithXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlName"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); - } - let contents: any; - if (input.nested !== undefined) { - contents = serializeAws_restXmlPayloadWithXmlName(input.nested, context); - body = ''; - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand = async ( - input: HttpPayloadWithXmlNamespaceCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespace"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restXmlPayloadWithXmlNamespace(input.nested, context); - } - let contents: any; - if (input.nested !== undefined) { - contents = serializeAws_restXmlPayloadWithXmlNamespace(input.nested, context); - body = ''; - contents.addAttribute("xmlns", "http://foo.com"); - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = async ( - input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespaceAndPrefix"; - let body: any; - if (input.nested !== undefined) { - body = serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(input.nested, context); - } - let contents: any; - if (input.nested !== undefined) { - contents = serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(input.nested, context); - body = ''; - contents.addAttribute("xmlns:baz", "http://foo.com"); - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpPrefixHeadersCommand = async ( - input: HttpPrefixHeadersCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), - ...(input.fooMap !== undefined && - Object.keys(input.fooMap).reduce( - (acc: any, suffix: string) => ({ - ...acc, - [`x-foo-${suffix.toLowerCase()}`]: input.fooMap![suffix], - }), - {} - )), - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpRequestWithFloatLabelsCommand = async ( - input: HttpRequestWithFloatLabelsCommandInput, - 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 || ""}` + "/FloatHttpLabels/{float}/{double}"; - if (input.float !== undefined) { - const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: float."); - } - resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: float."); - } - if (input.double !== undefined) { - const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: double."); - } - resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: double."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand = async ( - input: HttpRequestWithGreedyLabelInPathCommandInput, - 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 || ""}` + - "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; - if (input.foo !== undefined) { - const labelValue: string = input.foo; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: foo."); - } - resolvedPath = resolvedPath.replace("{foo}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: foo."); - } - if (input.baz !== undefined) { - const labelValue: string = input.baz; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: baz."); - } - resolvedPath = resolvedPath.replace( - "{baz+}", - labelValue - .split("/") - .map((segment) => __extendedEncodeURIComponent(segment)) - .join("/") - ); - } else { - throw new Error("No value provided for input HTTP label: baz."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpRequestWithLabelsCommand = async ( - input: HttpRequestWithLabelsCommandInput, - 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 || ""}` + - "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; - if (input.string !== undefined) { - const labelValue: string = input.string; - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: string."); - } - resolvedPath = resolvedPath.replace("{string}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: string."); - } - if (input.short !== undefined) { - const labelValue: string = input.short.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: short."); - } - resolvedPath = resolvedPath.replace("{short}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: short."); - } - if (input.integer !== undefined) { - const labelValue: string = input.integer.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: integer."); - } - resolvedPath = resolvedPath.replace("{integer}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: integer."); - } - if (input.long !== undefined) { - const labelValue: string = input.long.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: long."); - } - resolvedPath = resolvedPath.replace("{long}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: long."); - } - if (input.float !== undefined) { - const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: float."); - } - resolvedPath = resolvedPath.replace("{float}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: float."); - } - if (input.double !== undefined) { - const labelValue: string = input.double % 1 == 0 ? input.double + ".0" : input.double.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: double."); - } - resolvedPath = resolvedPath.replace("{double}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: double."); - } - if (input.boolean !== undefined) { - const labelValue: string = input.boolean.toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: boolean."); - } - resolvedPath = resolvedPath.replace("{boolean}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: boolean."); - } - 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: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand = async ( - input: HttpRequestWithLabelsAndTimestampFormatCommandInput, - 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 || ""}` + - "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; - if (input.memberEpochSeconds !== undefined) { - const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberEpochSeconds."); - } - resolvedPath = resolvedPath.replace("{memberEpochSeconds}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberEpochSeconds."); - } - if (input.memberHttpDate !== undefined) { - const labelValue: string = __dateToUtcString(input.memberHttpDate).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberHttpDate."); - } - resolvedPath = resolvedPath.replace("{memberHttpDate}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberHttpDate."); - } - if (input.memberDateTime !== undefined) { - const labelValue: string = (input.memberDateTime.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: memberDateTime."); - } - resolvedPath = resolvedPath.replace("{memberDateTime}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: memberDateTime."); - } - if (input.defaultFormat !== undefined) { - const labelValue: string = (input.defaultFormat.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: defaultFormat."); - } - resolvedPath = resolvedPath.replace("{defaultFormat}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: defaultFormat."); - } - if (input.targetEpochSeconds !== undefined) { - const labelValue: string = Math.round(input.targetEpochSeconds.getTime() / 1000).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetEpochSeconds."); - } - resolvedPath = resolvedPath.replace("{targetEpochSeconds}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetEpochSeconds."); - } - if (input.targetHttpDate !== undefined) { - const labelValue: string = __dateToUtcString(input.targetHttpDate).toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetHttpDate."); - } - resolvedPath = resolvedPath.replace("{targetHttpDate}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetHttpDate."); - } - if (input.targetDateTime !== undefined) { - const labelValue: string = (input.targetDateTime.toISOString().split(".")[0] + "Z").toString(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: targetDateTime."); - } - resolvedPath = resolvedPath.replace("{targetDateTime}", __extendedEncodeURIComponent(labelValue)); - } else { - throw new Error("No value provided for input HTTP label: targetDateTime."); - } - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlHttpResponseCodeCommand = async ( - input: HttpResponseCodeCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpResponseCode"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlIgnoreQueryParamsInResponseCommand = async ( - input: IgnoreQueryParamsInResponseCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/IgnoreQueryParamsInResponse"; - let body: any; - body = ""; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlInputAndOutputWithHeadersCommand = async ( - input: InputAndOutputWithHeadersCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), - ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), - ...(isSerializableHeaderValue(input.headerShort) && { "x-short": input.headerShort!.toString() }), - ...(isSerializableHeaderValue(input.headerInteger) && { "x-integer": input.headerInteger!.toString() }), - ...(isSerializableHeaderValue(input.headerLong) && { "x-long": input.headerLong!.toString() }), - ...(isSerializableHeaderValue(input.headerFloat) && { - "x-float": input.headerFloat! % 1 == 0 ? input.headerFloat! + ".0" : input.headerFloat!.toString(), - }), - ...(isSerializableHeaderValue(input.headerDouble) && { - "x-double": input.headerDouble! % 1 == 0 ? input.headerDouble! + ".0" : input.headerDouble!.toString(), - }), - ...(isSerializableHeaderValue(input.headerTrueBool) && { "x-boolean1": input.headerTrueBool!.toString() }), - ...(isSerializableHeaderValue(input.headerFalseBool) && { "x-boolean2": input.headerFalseBool!.toString() }), - ...(isSerializableHeaderValue(input.headerStringList) && { - "x-stringlist": (input.headerStringList! || []).map((_entry) => _entry as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerStringSet) && { - "x-stringset": (Array.from(input.headerStringSet!.values()) || []).map((_entry) => _entry as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerIntegerList) && { - "x-integerlist": (input.headerIntegerList! || []).map((_entry) => _entry.toString() as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerBooleanList) && { - "x-booleanlist": (input.headerBooleanList! || []).map((_entry) => _entry.toString() as any).join(", "), - }), - ...(isSerializableHeaderValue(input.headerTimestampList) && { - "x-timestamplist": (input.headerTimestampList! || []) - .map((_entry) => __dateToUtcString(_entry).toString() as any) - .join(", "), - }), - ...(isSerializableHeaderValue(input.headerEnum) && { "x-enum": input.headerEnum! }), - ...(isSerializableHeaderValue(input.headerEnumList) && { - "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry as any).join(", "), - }), - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; - let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlNestedXmlMapsCommand = async ( - input: NestedXmlMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NestedXmlMaps"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("NestedXmlMapsInputOutput"); - if (input.flatNestedMap !== undefined) { - const nodes = serializeAws_restXmlNestedMap(input.flatNestedMap, context); - nodes.map((node: any) => { - node = node.withName("flatNestedMap"); - bodyNode.addChildNode(node); - }); - } - if (input.nestedMap !== undefined) { - const nodes = serializeAws_restXmlNestedMap(input.nestedMap, context); - const containerNode = new __XmlNode("nestedMap"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlNoInputAndNoOutputCommand = async ( - input: NoInputAndNoOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - 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_restXmlNoInputAndOutputCommand = async ( - input: NoInputAndOutputCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - 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_restXmlNullAndEmptyHeadersClientCommand = 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_restXmlNullAndEmptyHeadersServerCommand = 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_restXmlOmitsNullSerializesEmptyStringCommand = 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_restXmlQueryIdempotencyTokenAutoFillCommand = 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_restXmlQueryParamsAsStringListMapCommand = 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_restXmlQueryPrecedenceCommand = 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_restXmlRecursiveShapesCommand = async ( - input: RecursiveShapesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("RecursiveShapesInputOutput"); - if (input.nested !== undefined) { - const node = serializeAws_restXmlRecursiveShapesInputOutputNested1(input.nested, context).withName("nested"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlSimpleScalarPropertiesCommand = async ( - input: SimpleScalarPropertiesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("SimpleScalarPropertiesInputOutput"); - if (input.byteValue !== undefined) { - const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(input.byteValue))).withName("byteValue"); - bodyNode.addChildNode(node); - } - if (input.doubleValue !== undefined) { - const node = new __XmlNode("Double") - .addChildNode(new __XmlText(String(input.doubleValue))) - .withName("DoubleDribble"); - bodyNode.addChildNode(node); - } - if (input.falseBooleanValue !== undefined) { - const node = new __XmlNode("Boolean") - .addChildNode(new __XmlText(String(input.falseBooleanValue))) - .withName("falseBooleanValue"); - bodyNode.addChildNode(node); - } - if (input.floatValue !== undefined) { - const node = new __XmlNode("Float").addChildNode(new __XmlText(String(input.floatValue))).withName("floatValue"); - bodyNode.addChildNode(node); - } - if (input.integerValue !== undefined) { - const node = new __XmlNode("Integer") - .addChildNode(new __XmlText(String(input.integerValue))) - .withName("integerValue"); - bodyNode.addChildNode(node); - } - if (input.longValue !== undefined) { - const node = new __XmlNode("Long").addChildNode(new __XmlText(String(input.longValue))).withName("longValue"); - bodyNode.addChildNode(node); - } - if (input.shortValue !== undefined) { - const node = new __XmlNode("Short").addChildNode(new __XmlText(String(input.shortValue))).withName("shortValue"); - bodyNode.addChildNode(node); - } - if (input.stringValue !== undefined) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.stringValue)).withName("stringValue"); - bodyNode.addChildNode(node); - } - if (input.trueBooleanValue !== undefined) { - const node = new __XmlNode("Boolean") - .addChildNode(new __XmlText(String(input.trueBooleanValue))) - .withName("trueBooleanValue"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlTimestampFormatHeadersCommand = 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 serializeAws_restXmlXmlAttributesCommand = async ( - input: XmlAttributesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributes"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlAttributesInputOutput"); - if (input.attr !== undefined) { - bodyNode.addAttribute("test", input.attr); - } - if (input.foo !== undefined) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlAttributesOnPayloadCommand = async ( - input: XmlAttributesOnPayloadCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributesOnPayload"; - let body: any; - if (input.payload !== undefined) { - body = serializeAws_restXmlXmlAttributesInputOutput(input.payload, context); - } - let contents: any; - if (input.payload !== undefined) { - contents = serializeAws_restXmlXmlAttributesInputOutput(input.payload, context); - body = ''; - body += contents.toString(); - } - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlBlobsCommand = async ( - input: XmlBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlBlobs"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlBlobsInputOutput"); - if (input.data !== undefined) { - const node = new __XmlNode("Blob").addChildNode(new __XmlText(context.base64Encoder(input.data))).withName("data"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlEmptyBlobsCommand = async ( - input: XmlEmptyBlobsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyBlobs"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlBlobsInputOutput"); - if (input.data !== undefined) { - const node = new __XmlNode("Blob").addChildNode(new __XmlText(context.base64Encoder(input.data))).withName("data"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlEmptyListsCommand = async ( - input: XmlEmptyListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyLists"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlListsInputOutput"); - if (input.booleanList !== undefined) { - const nodes = serializeAws_restXmlBooleanList(input.booleanList, context); - const containerNode = new __XmlNode("booleanList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.enumList !== undefined) { - const nodes = serializeAws_restXmlFooEnumList(input.enumList, context); - const containerNode = new __XmlNode("enumList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.flattenedList !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList, context); - nodes.map((node: any) => { - node = node.withName("flattenedList"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedList2 !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList2, context); - nodes.map((node: any) => { - node = node.withName("customName"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedListWithMemberNamespace !== undefined) { - const nodes = serializeAws_restXmlListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); - nodes.map((node: any) => { - node = node.withName("flattenedListWithMemberNamespace"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedListWithNamespace !== undefined) { - const nodes = serializeAws_restXmlListWithNamespace(input.flattenedListWithNamespace, context); - nodes.map((node: any) => { - node = node.withName("flattenedListWithNamespace"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedStructureList !== undefined) { - const nodes = serializeAws_restXmlStructureList(input.flattenedStructureList, context); - nodes.map((node: any) => { - node = node.withName("flattenedStructureList"); - bodyNode.addChildNode(node); - }); - } - if (input.integerList !== undefined) { - const nodes = serializeAws_restXmlIntegerList(input.integerList, context); - const containerNode = new __XmlNode("integerList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.nestedStringList !== undefined) { - const nodes = serializeAws_restXmlNestedStringList(input.nestedStringList, context); - const containerNode = new __XmlNode("nestedStringList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.renamedListMembers !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.renamedListMembers, context); - const containerNode = new __XmlNode("renamed"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.stringList !== undefined) { - const nodes = serializeAws_restXmlStringList(input.stringList, context); - const containerNode = new __XmlNode("stringList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.stringSet !== undefined) { - const nodes = serializeAws_restXmlStringSet(input.stringSet, context); - const containerNode = new __XmlNode("stringSet"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.structureList !== undefined) { - const nodes = serializeAws_restXmlStructureList(input.structureList, context); - const containerNode = new __XmlNode("myStructureList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.timestampList !== undefined) { - const nodes = serializeAws_restXmlTimestampList(input.timestampList, context); - const containerNode = new __XmlNode("timestampList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlEmptyMapsCommand = async ( - input: XmlEmptyMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyMaps"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlMapsInputOutput"); - if (input.myMap !== undefined) { - const nodes = serializeAws_restXmlXmlMapsInputOutputMap(input.myMap, context); - const containerNode = new __XmlNode("myMap"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlEmptyStringsCommand = async ( - input: XmlEmptyStringsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyStrings"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlEmptyStringsInputOutput"); - if (input.emptyString !== undefined) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.emptyString)).withName("emptyString"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlEnumsCommand = async ( - input: XmlEnumsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEnums"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlEnumsInputOutput"); - if (input.fooEnum1 !== undefined) { - const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum1)).withName("fooEnum1"); - bodyNode.addChildNode(node); - } - if (input.fooEnum2 !== undefined) { - const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum2)).withName("fooEnum2"); - bodyNode.addChildNode(node); - } - if (input.fooEnum3 !== undefined) { - const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input.fooEnum3)).withName("fooEnum3"); - bodyNode.addChildNode(node); - } - if (input.fooEnumList !== undefined) { - const nodes = serializeAws_restXmlFooEnumList(input.fooEnumList, context); - const containerNode = new __XmlNode("fooEnumList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.fooEnumMap !== undefined) { - const nodes = serializeAws_restXmlFooEnumMap(input.fooEnumMap, context); - const containerNode = new __XmlNode("fooEnumMap"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.fooEnumSet !== undefined) { - const nodes = serializeAws_restXmlFooEnumSet(input.fooEnumSet, context); - const containerNode = new __XmlNode("fooEnumSet"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlListsCommand = async ( - input: XmlListsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlLists"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlListsInputOutput"); - if (input.booleanList !== undefined) { - const nodes = serializeAws_restXmlBooleanList(input.booleanList, context); - const containerNode = new __XmlNode("booleanList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.enumList !== undefined) { - const nodes = serializeAws_restXmlFooEnumList(input.enumList, context); - const containerNode = new __XmlNode("enumList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.flattenedList !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList, context); - nodes.map((node: any) => { - node = node.withName("flattenedList"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedList2 !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.flattenedList2, context); - nodes.map((node: any) => { - node = node.withName("customName"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedListWithMemberNamespace !== undefined) { - const nodes = serializeAws_restXmlListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); - nodes.map((node: any) => { - node = node.withName("flattenedListWithMemberNamespace"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedListWithNamespace !== undefined) { - const nodes = serializeAws_restXmlListWithNamespace(input.flattenedListWithNamespace, context); - nodes.map((node: any) => { - node = node.withName("flattenedListWithNamespace"); - bodyNode.addChildNode(node); - }); - } - if (input.flattenedStructureList !== undefined) { - const nodes = serializeAws_restXmlStructureList(input.flattenedStructureList, context); - nodes.map((node: any) => { - node = node.withName("flattenedStructureList"); - bodyNode.addChildNode(node); - }); - } - if (input.integerList !== undefined) { - const nodes = serializeAws_restXmlIntegerList(input.integerList, context); - const containerNode = new __XmlNode("integerList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.nestedStringList !== undefined) { - const nodes = serializeAws_restXmlNestedStringList(input.nestedStringList, context); - const containerNode = new __XmlNode("nestedStringList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.renamedListMembers !== undefined) { - const nodes = serializeAws_restXmlRenamedListMembers(input.renamedListMembers, context); - const containerNode = new __XmlNode("renamed"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.stringList !== undefined) { - const nodes = serializeAws_restXmlStringList(input.stringList, context); - const containerNode = new __XmlNode("stringList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.stringSet !== undefined) { - const nodes = serializeAws_restXmlStringSet(input.stringSet, context); - const containerNode = new __XmlNode("stringSet"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.structureList !== undefined) { - const nodes = serializeAws_restXmlStructureList(input.structureList, context); - const containerNode = new __XmlNode("myStructureList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - if (input.timestampList !== undefined) { - const nodes = serializeAws_restXmlTimestampList(input.timestampList, context); - const containerNode = new __XmlNode("timestampList"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlMapsCommand = async ( - input: XmlMapsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMaps"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlMapsInputOutput"); - if (input.myMap !== undefined) { - const nodes = serializeAws_restXmlXmlMapsInputOutputMap(input.myMap, context); - const containerNode = new __XmlNode("myMap"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlMapsXmlNameCommand = async ( - input: XmlMapsXmlNameCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMapsXmlName"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlMapsXmlNameInputOutput"); - if (input.myMap !== undefined) { - const nodes = serializeAws_restXmlXmlMapsXmlNameInputOutputMap(input.myMap, context); - const containerNode = new __XmlNode("myMap"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlNamespacesCommand = async ( - input: XmlNamespacesCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlNamespaces"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlNamespacesInputOutput"); - bodyNode.addAttribute("xmlns", "http://foo.com"); - if (input.nested !== undefined) { - const node = serializeAws_restXmlXmlNamespaceNested(input.nested, context).withName("nested"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlTimestampsCommand = async ( - input: XmlTimestampsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlTimestamps"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlTimestampsInputOutput"); - if (input.dateTime !== undefined) { - const node = new __XmlNode("Timestamp") - .addChildNode(new __XmlText((input.dateTime.toISOString().split(".")[0] + "Z").toString())) - .withName("dateTime"); - bodyNode.addChildNode(node); - } - if (input.epochSeconds !== undefined) { - const node = new __XmlNode("Timestamp") - .addChildNode(new __XmlText(Math.round(input.epochSeconds.getTime() / 1000).toString())) - .withName("epochSeconds"); - bodyNode.addChildNode(node); - } - if (input.httpDate !== undefined) { - const node = new __XmlNode("Timestamp") - .addChildNode(new __XmlText(__dateToUtcString(input.httpDate).toString())) - .withName("httpDate"); - bodyNode.addChildNode(node); - } - if (input.normal !== undefined) { - const node = new __XmlNode("Timestamp") - .addChildNode(new __XmlText(input.normal.toISOString().split(".")[0] + "Z")) - .withName("normal"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); -}; - -export const serializeAws_restXmlXmlUnionsCommand = async ( - input: XmlUnionsCommandInput, - context: __SerdeContext -): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers: any = { - "content-type": "application/xml", - }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlUnions"; - let body: any; - body = ''; - const bodyNode = new __XmlNode("XmlUnionsInputOutput"); - if (input.unionValue !== undefined) { - const node = serializeAws_restXmlXmlUnionShape(input.unionValue, context).withName("unionValue"); - bodyNode.addChildNode(node); - } - body += bodyNode.toString(); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "PUT", - headers, - path: resolvedPath, - body, - }); -}; - -export const deserializeAws_restXmlAllQueryStringTypesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlAllQueryStringTypesCommandError(output, context); - } - const contents: AllQueryStringTypesCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlAllQueryStringTypesCommandError = 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 = loadRestXmlErrorCode(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_restXmlBodyWithXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlBodyWithXmlNameCommandError(output, context); - } - const contents: BodyWithXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["nested"] !== undefined) { - contents.nested = deserializeAws_restXmlPayloadWithXmlName(data["nested"], context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlBodyWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlConstantAndVariableQueryStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlConstantAndVariableQueryStringCommandError(output, context); - } - const contents: ConstantAndVariableQueryStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlConstantAndVariableQueryStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlConstantQueryStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlConstantQueryStringCommandError(output, context); - } - const contents: ConstantQueryStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlConstantQueryStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlEmptyInputAndEmptyOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlEmptyInputAndEmptyOutputCommandError(output, context); - } - const contents: EmptyInputAndEmptyOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlEmptyInputAndEmptyOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlEndpointOperationCommandError(output, context); - } - const contents: EndpointOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlEndpointOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointWithHostLabelHeaderOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommandError(output, context); - } - const contents: EndpointWithHostLabelHeaderOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlEndpointWithHostLabelHeaderOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlEndpointWithHostLabelOperationCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlEndpointWithHostLabelOperationCommandError(output, context); - } - const contents: EndpointWithHostLabelOperationCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlEndpointWithHostLabelOperationCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlFlattenedXmlMapCommandError(output, context); - } - const contents: FlattenedXmlMapCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.myMap === "") { - contents.myMap = {}; - } - if (data["myMap"] !== undefined) { - contents.myMap = deserializeAws_restXmlFooEnumMap(__getArrayIfSingleItem(data["myMap"]), context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlFlattenedXmlMapCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapWithXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommandError(output, context); - } - const contents: FlattenedXmlMapWithXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.KVP === "") { - contents.myMap = {}; - } - if (data["KVP"] !== undefined) { - contents.myMap = deserializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap( - __getArrayIfSingleItem(data["KVP"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlFlattenedXmlMapWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlFlattenedXmlMapWithXmlNamespaceCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommandError(output, context); - } - const contents: FlattenedXmlMapWithXmlNamespaceCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.KVP === "") { - contents.myMap = {}; - } - if (data["KVP"] !== undefined) { - contents.myMap = deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceOutputMap( - __getArrayIfSingleItem(data["KVP"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommandError = 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 = loadRestXmlErrorCode(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_restXmlGreetingWithErrorsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlGreetingWithErrorsCommandError(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_restXmlGreetingWithErrorsCommandError = 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 = loadRestXmlErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ComplexError": - case "aws.protocoltests.restxml#ComplexError": - response = { - ...(await deserializeAws_restXmlComplexErrorResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - case "InvalidGreeting": - case "aws.protocoltests.restxml#InvalidGreeting": - response = { - ...(await deserializeAws_restXmlInvalidGreetingResponse(parsedOutput, context)), - name: errorCode, - $metadata: deserializeMetadata(output), - }; - break; - 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_restXmlHttpPayloadTraitsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadTraitsCommandError(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_restXmlHttpPayloadTraitsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommandError(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_restXmlHttpPayloadTraitsWithMediaTypeCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithMemberXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommandError(output, context); - } - const contents: HttpPayloadWithMemberXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = deserializeAws_restXmlPayloadWithXmlName(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpPayloadWithMemberXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithStructureCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadWithStructureCommandError(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_restXmlNestedPayload(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpPayloadWithStructureCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadWithXmlNameCommandError(output, context); - } - const contents: HttpPayloadWithXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = deserializeAws_restXmlPayloadWithXmlName(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpPayloadWithXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNamespaceCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommandError(output, context); - } - const contents: HttpPayloadWithXmlNamespaceCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = deserializeAws_restXmlPayloadWithXmlNamespace(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpPayloadWithXmlNamespaceCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommandError(output, context); - } - const contents: HttpPayloadWithXmlNamespaceAndPrefixCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = deserializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpPrefixHeadersCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpPrefixHeadersCommandError(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_restXmlHttpPrefixHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithFloatLabelsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpRequestWithFloatLabelsCommandError(output, context); - } - const contents: HttpRequestWithFloatLabelsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpRequestWithFloatLabelsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithGreedyLabelInPathCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommandError(output, context); - } - const contents: HttpRequestWithGreedyLabelInPathCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpRequestWithGreedyLabelInPathCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithLabelsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpRequestWithLabelsCommandError(output, context); - } - const contents: HttpRequestWithLabelsCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpRequestWithLabelsCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpRequestWithLabelsAndTimestampFormatCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommandError(output, context); - } - const contents: HttpRequestWithLabelsAndTimestampFormatCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommandError = 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 = loadRestXmlErrorCode(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_restXmlHttpResponseCodeCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlHttpResponseCodeCommandError(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_restXmlHttpResponseCodeCommandError = 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 = loadRestXmlErrorCode(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_restXmlIgnoreQueryParamsInResponseCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlIgnoreQueryParamsInResponseCommandError(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) { - contents.baz = __expectString(data["baz"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlIgnoreQueryParamsInResponseCommandError = 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 = loadRestXmlErrorCode(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_restXmlInputAndOutputWithHeadersCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlInputAndOutputWithHeadersCommandError(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_restXmlInputAndOutputWithHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlNestedXmlMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlNestedXmlMapsCommandError(output, context); - } - const contents: NestedXmlMapsCommandOutput = { - $metadata: deserializeMetadata(output), - flatNestedMap: undefined, - nestedMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.flatNestedMap === "") { - contents.flatNestedMap = {}; - } - if (data["flatNestedMap"] !== undefined) { - contents.flatNestedMap = deserializeAws_restXmlNestedMap(__getArrayIfSingleItem(data["flatNestedMap"]), context); - } - if (data.nestedMap === "") { - contents.nestedMap = {}; - } - if (data["nestedMap"] !== undefined && data["nestedMap"]["entry"] !== undefined) { - contents.nestedMap = deserializeAws_restXmlNestedMap(__getArrayIfSingleItem(data["nestedMap"]["entry"]), context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlNestedXmlMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlNoInputAndNoOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlNoInputAndNoOutputCommandError(output, context); - } - const contents: NoInputAndNoOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlNoInputAndNoOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlNoInputAndOutputCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlNoInputAndOutputCommandError(output, context); - } - const contents: NoInputAndOutputCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlNoInputAndOutputCommandError = 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 = loadRestXmlErrorCode(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_restXmlNullAndEmptyHeadersClientCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlNullAndEmptyHeadersClientCommandError(output, context); - } - const contents: NullAndEmptyHeadersClientCommandOutput = { - $metadata: deserializeMetadata(output), - a: undefined, - b: undefined, - c: undefined, - }; - if (output.headers["x-a"] !== undefined) { - contents.a = output.headers["x-a"]; - } - if (output.headers["x-b"] !== undefined) { - contents.b = output.headers["x-b"]; - } - if (output.headers["x-c"] !== undefined) { - contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlNullAndEmptyHeadersClientCommandError = 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 = loadRestXmlErrorCode(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_restXmlNullAndEmptyHeadersServerCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlNullAndEmptyHeadersServerCommandError(output, context); - } - const contents: NullAndEmptyHeadersServerCommandOutput = { - $metadata: deserializeMetadata(output), - a: undefined, - b: undefined, - c: undefined, - }; - if (output.headers["x-a"] !== undefined) { - contents.a = output.headers["x-a"]; - } - if (output.headers["x-b"] !== undefined) { - contents.b = output.headers["x-b"]; - } - if (output.headers["x-c"] !== undefined) { - contents.c = (output.headers["x-c"] || "").split(",").map((_entry) => _entry.trim() as any); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlNullAndEmptyHeadersServerCommandError = 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 = loadRestXmlErrorCode(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_restXmlOmitsNullSerializesEmptyStringCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlOmitsNullSerializesEmptyStringCommandError(output, context); - } - const contents: OmitsNullSerializesEmptyStringCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlOmitsNullSerializesEmptyStringCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryIdempotencyTokenAutoFillCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommandError(output, context); - } - const contents: QueryIdempotencyTokenAutoFillCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlQueryIdempotencyTokenAutoFillCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryParamsAsStringListMapCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlQueryParamsAsStringListMapCommandError(output, context); - } - const contents: QueryParamsAsStringListMapCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlQueryParamsAsStringListMapCommandError = 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 = loadRestXmlErrorCode(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_restXmlQueryPrecedenceCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlQueryPrecedenceCommandError(output, context); - } - const contents: QueryPrecedenceCommandOutput = { - $metadata: deserializeMetadata(output), - }; - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlQueryPrecedenceCommandError = 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 = loadRestXmlErrorCode(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_restXmlRecursiveShapesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlRecursiveShapesCommandError(output, context); - } - const contents: RecursiveShapesCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["nested"] !== undefined) { - contents.nested = deserializeAws_restXmlRecursiveShapesInputOutputNested1(data["nested"], context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlRecursiveShapesCommandError = 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 = loadRestXmlErrorCode(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_restXmlSimpleScalarPropertiesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlSimpleScalarPropertiesCommandError(output, context); - } - const contents: SimpleScalarPropertiesCommandOutput = { - $metadata: deserializeMetadata(output), - byteValue: undefined, - doubleValue: undefined, - falseBooleanValue: undefined, - floatValue: undefined, - foo: undefined, - integerValue: undefined, - longValue: undefined, - shortValue: undefined, - stringValue: undefined, - trueBooleanValue: undefined, - }; - if (output.headers["x-foo"] !== undefined) { - contents.foo = output.headers["x-foo"]; - } - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["byteValue"] !== undefined) { - contents.byteValue = __strictParseByte(data["byteValue"]) as number; - } - if (data["DoubleDribble"] !== undefined) { - contents.doubleValue = __strictParseFloat(data["DoubleDribble"]) as number; - } - if (data["falseBooleanValue"] !== undefined) { - contents.falseBooleanValue = __parseBoolean(data["falseBooleanValue"]); - } - if (data["floatValue"] !== undefined) { - contents.floatValue = __strictParseFloat(data["floatValue"]) as number; - } - if (data["integerValue"] !== undefined) { - contents.integerValue = __strictParseInt32(data["integerValue"]) as number; - } - if (data["longValue"] !== undefined) { - contents.longValue = __strictParseLong(data["longValue"]) as number; - } - if (data["shortValue"] !== undefined) { - contents.shortValue = __strictParseShort(data["shortValue"]) as number; - } - if (data["stringValue"] !== undefined) { - contents.stringValue = __expectString(data["stringValue"]); - } - if (data["trueBooleanValue"] !== undefined) { - contents.trueBooleanValue = __parseBoolean(data["trueBooleanValue"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlSimpleScalarPropertiesCommandError = 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 = loadRestXmlErrorCode(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_restXmlTimestampFormatHeadersCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlTimestampFormatHeadersCommandError(output, context); - } - const contents: TimestampFormatHeadersCommandOutput = { - $metadata: deserializeMetadata(output), - defaultFormat: undefined, - memberDateTime: undefined, - memberEpochSeconds: undefined, - memberHttpDate: undefined, - targetDateTime: undefined, - targetEpochSeconds: undefined, - targetHttpDate: undefined, - }; - if (output.headers["x-memberepochseconds"] !== undefined) { - contents.memberEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-memberepochseconds"])); - } - if (output.headers["x-memberhttpdate"] !== undefined) { - contents.memberHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-memberhttpdate"])); - } - if (output.headers["x-memberdatetime"] !== undefined) { - contents.memberDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-memberdatetime"])); - } - if (output.headers["x-defaultformat"] !== undefined) { - contents.defaultFormat = __expectNonNull(__parseRfc7231DateTime(output.headers["x-defaultformat"])); - } - if (output.headers["x-targetepochseconds"] !== undefined) { - contents.targetEpochSeconds = __expectNonNull(__parseEpochTimestamp(output.headers["x-targetepochseconds"])); - } - if (output.headers["x-targethttpdate"] !== undefined) { - contents.targetHttpDate = __expectNonNull(__parseRfc7231DateTime(output.headers["x-targethttpdate"])); - } - if (output.headers["x-targetdatetime"] !== undefined) { - contents.targetDateTime = __expectNonNull(__parseRfc3339DateTime(output.headers["x-targetdatetime"])); - } - await collectBody(output.body, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlTimestampFormatHeadersCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlAttributesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlAttributesCommandError(output, context); - } - const contents: XmlAttributesCommandOutput = { - $metadata: deserializeMetadata(output), - attr: undefined, - foo: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["test"] !== undefined) { - contents.attr = __expectString(data["test"]); - } - if (data["foo"] !== undefined) { - contents.foo = __expectString(data["foo"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlAttributesCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlAttributesOnPayloadCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlAttributesOnPayloadCommandError(output, context); - } - const contents: XmlAttributesOnPayloadCommandOutput = { - $metadata: deserializeMetadata(output), - payload: undefined, - }; - const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context)); - contents.payload = deserializeAws_restXmlXmlAttributesInputOutput(data, context); - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlAttributesOnPayloadCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlBlobsCommandError(output, context); - } - const contents: XmlBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - data: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["data"] !== undefined) { - contents.data = context.base64Decoder(data["data"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlBlobsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyBlobsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlEmptyBlobsCommandError(output, context); - } - const contents: XmlEmptyBlobsCommandOutput = { - $metadata: deserializeMetadata(output), - data: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["data"] !== undefined) { - contents.data = context.base64Decoder(data["data"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlEmptyBlobsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlEmptyListsCommandError(output, context); - } - const contents: XmlEmptyListsCommandOutput = { - $metadata: deserializeMetadata(output), - booleanList: undefined, - enumList: undefined, - flattenedList: undefined, - flattenedList2: undefined, - flattenedListWithMemberNamespace: undefined, - flattenedListWithNamespace: undefined, - flattenedStructureList: undefined, - integerList: undefined, - nestedStringList: undefined, - renamedListMembers: 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 === "") { - contents.booleanList = []; - } - if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { - contents.booleanList = deserializeAws_restXmlBooleanList( - __getArrayIfSingleItem(data["booleanList"]["member"]), - context - ); - } - if (data.enumList === "") { - contents.enumList = []; - } - if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { - contents.enumList = deserializeAws_restXmlFooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); - } - if (data.flattenedList === "") { - contents.flattenedList = []; - } - if (data["flattenedList"] !== undefined) { - contents.flattenedList = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["flattenedList"]), - context - ); - } - if (data.customName === "") { - contents.flattenedList2 = []; - } - if (data["customName"] !== undefined) { - contents.flattenedList2 = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["customName"]), - context - ); - } - if (data.flattenedListWithMemberNamespace === "") { - contents.flattenedListWithMemberNamespace = []; - } - if (data["flattenedListWithMemberNamespace"] !== undefined) { - contents.flattenedListWithMemberNamespace = deserializeAws_restXmlListWithMemberNamespace( - __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), - context - ); - } - if (data.flattenedListWithNamespace === "") { - contents.flattenedListWithNamespace = []; - } - if (data["flattenedListWithNamespace"] !== undefined) { - contents.flattenedListWithNamespace = deserializeAws_restXmlListWithNamespace( - __getArrayIfSingleItem(data["flattenedListWithNamespace"]), - context - ); - } - if (data.flattenedStructureList === "") { - contents.flattenedStructureList = []; - } - if (data["flattenedStructureList"] !== undefined) { - contents.flattenedStructureList = deserializeAws_restXmlStructureList( - __getArrayIfSingleItem(data["flattenedStructureList"]), - context - ); - } - if (data.integerList === "") { - contents.integerList = []; - } - if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { - contents.integerList = deserializeAws_restXmlIntegerList( - __getArrayIfSingleItem(data["integerList"]["member"]), - context - ); - } - if (data.nestedStringList === "") { - contents.nestedStringList = []; - } - if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { - contents.nestedStringList = deserializeAws_restXmlNestedStringList( - __getArrayIfSingleItem(data["nestedStringList"]["member"]), - context - ); - } - if (data.renamed === "") { - contents.renamedListMembers = []; - } - if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { - contents.renamedListMembers = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["renamed"]["item"]), - context - ); - } - if (data.stringList === "") { - contents.stringList = []; - } - if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { - contents.stringList = deserializeAws_restXmlStringList( - __getArrayIfSingleItem(data["stringList"]["member"]), - context - ); - } - if (data.stringSet === "") { - contents.stringSet = []; - } - if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { - contents.stringSet = deserializeAws_restXmlStringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); - } - if (data.myStructureList === "") { - contents.structureList = []; - } - if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { - contents.structureList = deserializeAws_restXmlStructureList( - __getArrayIfSingleItem(data["myStructureList"]["item"]), - context - ); - } - if (data.timestampList === "") { - contents.timestampList = []; - } - if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { - contents.timestampList = deserializeAws_restXmlTimestampList( - __getArrayIfSingleItem(data["timestampList"]["member"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlEmptyListsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlEmptyMapsCommandError(output, context); - } - const contents: XmlEmptyMapsCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.myMap === "") { - contents.myMap = {}; - } - if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = deserializeAws_restXmlXmlMapsInputOutputMap( - __getArrayIfSingleItem(data["myMap"]["entry"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlEmptyMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEmptyStringsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlEmptyStringsCommandError(output, context); - } - const contents: XmlEmptyStringsCommandOutput = { - $metadata: deserializeMetadata(output), - emptyString: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["emptyString"] !== undefined) { - contents.emptyString = __expectString(data["emptyString"]); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlEmptyStringsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlEnumsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlEnumsCommandError(output, context); - } - const contents: XmlEnumsCommandOutput = { - $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) { - contents.fooEnum1 = __expectString(data["fooEnum1"]); - } - if (data["fooEnum2"] !== undefined) { - contents.fooEnum2 = __expectString(data["fooEnum2"]); - } - if (data["fooEnum3"] !== undefined) { - contents.fooEnum3 = __expectString(data["fooEnum3"]); - } - if (data.fooEnumList === "") { - contents.fooEnumList = []; - } - if (data["fooEnumList"] !== undefined && data["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = deserializeAws_restXmlFooEnumList( - __getArrayIfSingleItem(data["fooEnumList"]["member"]), - context - ); - } - if (data.fooEnumMap === "") { - contents.fooEnumMap = {}; - } - if (data["fooEnumMap"] !== undefined && data["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = deserializeAws_restXmlFooEnumMap( - __getArrayIfSingleItem(data["fooEnumMap"]["entry"]), - context - ); - } - if (data.fooEnumSet === "") { - contents.fooEnumSet = []; - } - if (data["fooEnumSet"] !== undefined && data["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = deserializeAws_restXmlFooEnumSet( - __getArrayIfSingleItem(data["fooEnumSet"]["member"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlEnumsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlListsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlListsCommandError(output, context); - } - const contents: XmlListsCommandOutput = { - $metadata: deserializeMetadata(output), - booleanList: undefined, - enumList: undefined, - flattenedList: undefined, - flattenedList2: undefined, - flattenedListWithMemberNamespace: undefined, - flattenedListWithNamespace: undefined, - flattenedStructureList: undefined, - integerList: undefined, - nestedStringList: undefined, - renamedListMembers: 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 === "") { - contents.booleanList = []; - } - if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { - contents.booleanList = deserializeAws_restXmlBooleanList( - __getArrayIfSingleItem(data["booleanList"]["member"]), - context - ); - } - if (data.enumList === "") { - contents.enumList = []; - } - if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { - contents.enumList = deserializeAws_restXmlFooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); - } - if (data.flattenedList === "") { - contents.flattenedList = []; - } - if (data["flattenedList"] !== undefined) { - contents.flattenedList = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["flattenedList"]), - context - ); - } - if (data.customName === "") { - contents.flattenedList2 = []; - } - if (data["customName"] !== undefined) { - contents.flattenedList2 = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["customName"]), - context - ); - } - if (data.flattenedListWithMemberNamespace === "") { - contents.flattenedListWithMemberNamespace = []; - } - if (data["flattenedListWithMemberNamespace"] !== undefined) { - contents.flattenedListWithMemberNamespace = deserializeAws_restXmlListWithMemberNamespace( - __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), - context - ); - } - if (data.flattenedListWithNamespace === "") { - contents.flattenedListWithNamespace = []; - } - if (data["flattenedListWithNamespace"] !== undefined) { - contents.flattenedListWithNamespace = deserializeAws_restXmlListWithNamespace( - __getArrayIfSingleItem(data["flattenedListWithNamespace"]), - context - ); - } - if (data.flattenedStructureList === "") { - contents.flattenedStructureList = []; - } - if (data["flattenedStructureList"] !== undefined) { - contents.flattenedStructureList = deserializeAws_restXmlStructureList( - __getArrayIfSingleItem(data["flattenedStructureList"]), - context - ); - } - if (data.integerList === "") { - contents.integerList = []; - } - if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { - contents.integerList = deserializeAws_restXmlIntegerList( - __getArrayIfSingleItem(data["integerList"]["member"]), - context - ); - } - if (data.nestedStringList === "") { - contents.nestedStringList = []; - } - if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { - contents.nestedStringList = deserializeAws_restXmlNestedStringList( - __getArrayIfSingleItem(data["nestedStringList"]["member"]), - context - ); - } - if (data.renamed === "") { - contents.renamedListMembers = []; - } - if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { - contents.renamedListMembers = deserializeAws_restXmlRenamedListMembers( - __getArrayIfSingleItem(data["renamed"]["item"]), - context - ); - } - if (data.stringList === "") { - contents.stringList = []; - } - if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { - contents.stringList = deserializeAws_restXmlStringList( - __getArrayIfSingleItem(data["stringList"]["member"]), - context - ); - } - if (data.stringSet === "") { - contents.stringSet = []; - } - if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { - contents.stringSet = deserializeAws_restXmlStringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); - } - if (data.myStructureList === "") { - contents.structureList = []; - } - if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { - contents.structureList = deserializeAws_restXmlStructureList( - __getArrayIfSingleItem(data["myStructureList"]["item"]), - context - ); - } - if (data.timestampList === "") { - contents.timestampList = []; - } - if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { - contents.timestampList = deserializeAws_restXmlTimestampList( - __getArrayIfSingleItem(data["timestampList"]["member"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlListsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlMapsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlMapsCommandError(output, context); - } - const contents: XmlMapsCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.myMap === "") { - contents.myMap = {}; - } - if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = deserializeAws_restXmlXmlMapsInputOutputMap( - __getArrayIfSingleItem(data["myMap"]["entry"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlMapsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlMapsXmlNameCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlMapsXmlNameCommandError(output, context); - } - const contents: XmlMapsXmlNameCommandOutput = { - $metadata: deserializeMetadata(output), - myMap: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.myMap === "") { - contents.myMap = {}; - } - if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = deserializeAws_restXmlXmlMapsXmlNameInputOutputMap( - __getArrayIfSingleItem(data["myMap"]["entry"]), - context - ); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlMapsXmlNameCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlNamespacesCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlNamespacesCommandError(output, context); - } - const contents: XmlNamespacesCommandOutput = { - $metadata: deserializeMetadata(output), - nested: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["nested"] !== undefined) { - contents.nested = deserializeAws_restXmlXmlNamespaceNested(data["nested"], context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlNamespacesCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlTimestampsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlTimestampsCommandError(output, context); - } - const contents: XmlTimestampsCommandOutput = { - $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) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTime(data["dateTime"])); - } - if (data["epochSeconds"] !== undefined) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(data["epochSeconds"])); - } - if (data["httpDate"] !== undefined) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data["httpDate"])); - } - if (data["normal"] !== undefined) { - contents.normal = __expectNonNull(__parseRfc3339DateTime(data["normal"])); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlTimestampsCommandError = 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 = loadRestXmlErrorCode(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_restXmlXmlUnionsCommand = async ( - output: __HttpResponse, - context: __SerdeContext -): Promise => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return deserializeAws_restXmlXmlUnionsCommandError(output, context); - } - const contents: XmlUnionsCommandOutput = { - $metadata: deserializeMetadata(output), - unionValue: undefined, - }; - const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data["unionValue"] !== undefined) { - contents.unionValue = deserializeAws_restXmlXmlUnionShape(__expectUnion(data["unionValue"]), context); - } - return Promise.resolve(contents); -}; - -const deserializeAws_restXmlXmlUnionsCommandError = 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 = loadRestXmlErrorCode(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)); -}; - -const deserializeAws_restXmlComplexErrorResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const contents: ComplexError = { - name: "ComplexError", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - Header: undefined, - Nested: undefined, - TopLevel: undefined, - }; - if (parsedOutput.headers["x-header"] !== undefined) { - contents.Header = parsedOutput.headers["x-header"]; - } - const data: any = parsedOutput.body.Error; - if (data["Nested"] !== undefined) { - contents.Nested = deserializeAws_restXmlComplexNestedErrorData(data["Nested"], context); - } - if (data["TopLevel"] !== undefined) { - contents.TopLevel = __expectString(data["TopLevel"]); - } - return contents; -}; - -const deserializeAws_restXmlInvalidGreetingResponse = async ( - parsedOutput: any, - context: __SerdeContext -): Promise => { - const contents: InvalidGreeting = { - name: "InvalidGreeting", - $fault: "client", - $metadata: deserializeMetadata(parsedOutput), - Message: undefined, - }; - const data: any = parsedOutput.body.Error; - if (data["Message"] !== undefined) { - contents.Message = __expectString(data["Message"]); - } - return contents; -}; - -const serializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap = ( - input: { [key: string]: string }, - context: __SerdeContext -): any => { - return Object.keys(input) - .filter((key) => input[key] != null) - .map((key) => { - const entryNode = new __XmlNode("entry"); - const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("K"); - entryNode.addChildNode(keyNode); - let node; - node = new __XmlNode("String").addChildNode(new __XmlText(input[key])); - entryNode.addChildNode(node.withName("V")); - return entryNode; - }); -}; - -const serializeAws_restXmlListWithMemberNamespace = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - node.addAttribute("xmlns", "https://xml-member.example.com"); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlListWithNamespace = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlNestedMap = ( - input: { [key: string]: { [key: string]: FooEnum | string } }, - context: __SerdeContext -): any => { - return Object.keys(input) - .filter((key) => input[key] != null) - .map((key) => { - const entryNode = new __XmlNode("entry"); - const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); - entryNode.addChildNode(keyNode); - let node; - node = serializeAws_restXmlFooEnumMap(input[key], context); - entryNode.addChildNode( - node.reduce((acc: __XmlNode, workingNode: any) => { - return acc.addChildNode(workingNode); - }, new __XmlNode("value")) - ); - return entryNode; - }); -}; - -const serializeAws_restXmlNestedPayload = (input: NestedPayload, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("NestedPayload"); - if (input.greeting !== undefined && input.greeting !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.greeting)).withName("greeting"); - bodyNode.addChildNode(node); - } - if (input.name !== undefined && input.name !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlPayloadWithXmlName = (input: PayloadWithXmlName, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("Hello"); - if (input.name !== undefined && input.name !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlPayloadWithXmlNamespace = (input: PayloadWithXmlNamespace, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("PayloadWithXmlNamespace"); - if (input.name !== undefined && input.name !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix = ( - input: PayloadWithXmlNamespaceAndPrefix, - context: __SerdeContext -): any => { - const bodyNode = new __XmlNode("PayloadWithXmlNamespaceAndPrefix"); - if (input.name !== undefined && input.name !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.name)).withName("name"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlRecursiveShapesInputOutputNested1 = ( - input: RecursiveShapesInputOutputNested1, - context: __SerdeContext -): any => { - const bodyNode = new __XmlNode("RecursiveShapesInputOutputNested1"); - if (input.foo !== undefined && input.foo !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); - bodyNode.addChildNode(node); - } - if (input.nested !== undefined && input.nested !== null) { - const node = serializeAws_restXmlRecursiveShapesInputOutputNested2(input.nested, context).withName("nested"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlRecursiveShapesInputOutputNested2 = ( - input: RecursiveShapesInputOutputNested2, - context: __SerdeContext -): any => { - const bodyNode = new __XmlNode("RecursiveShapesInputOutputNested2"); - if (input.bar !== undefined && input.bar !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.bar)).withName("bar"); - bodyNode.addChildNode(node); - } - if (input.recursiveMember !== undefined && input.recursiveMember !== null) { - const node = serializeAws_restXmlRecursiveShapesInputOutputNested1(input.recursiveMember, context).withName( - "recursiveMember" - ); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlRenamedListMembers = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - return node.withName("item"); - }); -}; - -const serializeAws_restXmlStructureList = (input: StructureListMember[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = serializeAws_restXmlStructureListMember(entry, context); - return node.withName("item"); - }); -}; - -const serializeAws_restXmlStructureListMember = (input: StructureListMember, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("StructureListMember"); - if (input.a !== undefined && input.a !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.a)).withName("value"); - bodyNode.addChildNode(node); - } - if (input.b !== undefined && input.b !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.b)).withName("other"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlXmlAttributesInputOutput = ( - input: XmlAttributesInputOutput, - context: __SerdeContext -): any => { - const bodyNode = new __XmlNode("XmlAttributesInputOutput"); - if (input.foo !== undefined && input.foo !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); - bodyNode.addChildNode(node); - } - if (input.attr !== undefined && input.attr !== null) { - bodyNode.addAttribute("test", input.attr); - } - return bodyNode; -}; - -const serializeAws_restXmlXmlMapsInputOutputMap = ( - input: { [key: string]: GreetingStruct }, - context: __SerdeContext -): any => { - return Object.keys(input) - .filter((key) => input[key] != null) - .map((key) => { - const entryNode = new __XmlNode("entry"); - const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); - entryNode.addChildNode(keyNode); - let node; - node = serializeAws_restXmlGreetingStruct(input[key], context); - entryNode.addChildNode(node.withName("value")); - return entryNode; - }); -}; - -const serializeAws_restXmlXmlMapsXmlNameInputOutputMap = ( - input: { [key: string]: GreetingStruct }, - context: __SerdeContext -): any => { - return Object.keys(input) - .filter((key) => input[key] != null) - .map((key) => { - const entryNode = new __XmlNode("entry"); - const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("Attribute"); - entryNode.addChildNode(keyNode); - let node; - node = serializeAws_restXmlGreetingStruct(input[key], context); - entryNode.addChildNode(node.withName("Setting")); - return entryNode; - }); -}; - -const serializeAws_restXmlXmlNamespacedList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - node.addAttribute("xmlns", "http://bux.com"); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlXmlNamespaceNested = (input: XmlNamespaceNested, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("XmlNamespaceNested"); - if (input.foo !== undefined && input.foo !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.foo)).withName("foo"); - node.addAttribute("xmlns:baz", "http://baz.com"); - bodyNode.addChildNode(node); - } - if (input.values !== undefined && input.values !== null) { - const nodes = serializeAws_restXmlXmlNamespacedList(input.values, context); - const containerNode = new __XmlNode("values"); - containerNode.addAttribute("xmlns", "http://qux.com"); - nodes.map((node: any) => { - containerNode.addChildNode(node); - }); - bodyNode.addChildNode(containerNode); - } - return bodyNode; -}; - -const serializeAws_restXmlXmlNestedUnionStruct = (input: XmlNestedUnionStruct, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("XmlNestedUnionStruct"); - if (input.stringValue !== undefined && input.stringValue !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.stringValue)).withName("stringValue"); - bodyNode.addChildNode(node); - } - if (input.booleanValue !== undefined && input.booleanValue !== null) { - const node = new __XmlNode("Boolean") - .addChildNode(new __XmlText(String(input.booleanValue))) - .withName("booleanValue"); - bodyNode.addChildNode(node); - } - if (input.byteValue !== undefined && input.byteValue !== null) { - const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(input.byteValue))).withName("byteValue"); - bodyNode.addChildNode(node); - } - if (input.shortValue !== undefined && input.shortValue !== null) { - const node = new __XmlNode("Short").addChildNode(new __XmlText(String(input.shortValue))).withName("shortValue"); - bodyNode.addChildNode(node); - } - if (input.integerValue !== undefined && input.integerValue !== null) { - const node = new __XmlNode("Integer") - .addChildNode(new __XmlText(String(input.integerValue))) - .withName("integerValue"); - bodyNode.addChildNode(node); - } - if (input.longValue !== undefined && input.longValue !== null) { - const node = new __XmlNode("Long").addChildNode(new __XmlText(String(input.longValue))).withName("longValue"); - bodyNode.addChildNode(node); - } - if (input.floatValue !== undefined && input.floatValue !== null) { - const node = new __XmlNode("Float").addChildNode(new __XmlText(String(input.floatValue))).withName("floatValue"); - bodyNode.addChildNode(node); - } - if (input.doubleValue !== undefined && input.doubleValue !== null) { - const node = new __XmlNode("Double").addChildNode(new __XmlText(String(input.doubleValue))).withName("doubleValue"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlXmlUnionShape = (input: XmlUnionShape, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("XmlUnionShape"); - XmlUnionShape.visit(input, { - stringValue: (value) => { - const node = new __XmlNode("String").addChildNode(new __XmlText(value)).withName("stringValue"); - bodyNode.addChildNode(node); - }, - booleanValue: (value) => { - const node = new __XmlNode("Boolean").addChildNode(new __XmlText(String(value))).withName("booleanValue"); - bodyNode.addChildNode(node); - }, - byteValue: (value) => { - const node = new __XmlNode("Byte").addChildNode(new __XmlText(String(value))).withName("byteValue"); - bodyNode.addChildNode(node); - }, - shortValue: (value) => { - const node = new __XmlNode("Short").addChildNode(new __XmlText(String(value))).withName("shortValue"); - bodyNode.addChildNode(node); - }, - integerValue: (value) => { - const node = new __XmlNode("Integer").addChildNode(new __XmlText(String(value))).withName("integerValue"); - bodyNode.addChildNode(node); - }, - longValue: (value) => { - const node = new __XmlNode("Long").addChildNode(new __XmlText(String(value))).withName("longValue"); - bodyNode.addChildNode(node); - }, - floatValue: (value) => { - const node = new __XmlNode("Float").addChildNode(new __XmlText(String(value))).withName("floatValue"); - bodyNode.addChildNode(node); - }, - doubleValue: (value) => { - const node = new __XmlNode("Double").addChildNode(new __XmlText(String(value))).withName("doubleValue"); - bodyNode.addChildNode(node); - }, - unionValue: (value) => { - const node = serializeAws_restXmlXmlUnionShape(value, context).withName("unionValue"); - bodyNode.addChildNode(node); - }, - structValue: (value) => { - const node = serializeAws_restXmlXmlNestedUnionStruct(value, context).withName("structValue"); - bodyNode.addChildNode(node); - }, - _: (name: string, value: any) => { - if (!(value instanceof __XmlNode || value instanceof __XmlText)) { - throw new Error("Unable to serialize unknown union members in XML."); - } - bodyNode.addChildNode(new __XmlNode(name).addChildNode(value)); - }, - }); - return bodyNode; -}; - -const serializeAws_restXmlBooleanList = (input: boolean[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("PrimitiveBoolean").addChildNode(new __XmlText(String(entry))); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlFooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(entry)); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlFooEnumMap = (input: { [key: string]: FooEnum | string }, context: __SerdeContext): any => { - return Object.keys(input) - .filter((key) => input[key] != null) - .map((key) => { - const entryNode = new __XmlNode("entry"); - const keyNode = new __XmlNode("String").addChildNode(new __XmlText(key)).withName("key"); - entryNode.addChildNode(keyNode); - let node; - node = new __XmlNode("FooEnum").addChildNode(new __XmlText(input[key])); - entryNode.addChildNode(node.withName("value")); - return entryNode; - }); -}; - -const serializeAws_restXmlFooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("FooEnum").addChildNode(new __XmlText(entry)); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlGreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - const bodyNode = new __XmlNode("GreetingStruct"); - if (input.hi !== undefined && input.hi !== null) { - const node = new __XmlNode("String").addChildNode(new __XmlText(input.hi)).withName("hi"); - bodyNode.addChildNode(node); - } - return bodyNode; -}; - -const serializeAws_restXmlIntegerList = (input: number[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("Integer").addChildNode(new __XmlText(String(entry))); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlNestedStringList = (input: string[][], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = serializeAws_restXmlStringList(entry, context); - return node.reduce((acc: __XmlNode, workingNode: any) => { - return acc.addChildNode(workingNode); - }, new __XmlNode("member")); - }); -}; - -const serializeAws_restXmlStringList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlStringSet = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("String").addChildNode(new __XmlText(entry)); - return node.withName("member"); - }); -}; - -const serializeAws_restXmlTimestampList = (input: Date[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - if (entry === null) { - return null as any; - } - const node = new __XmlNode("Timestamp").addChildNode(new __XmlText(entry.toISOString().split(".")[0] + "Z")); - return node.withName("member"); - }); -}; - -const deserializeAws_restXmlComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - const contents: any = { - Foo: undefined, - }; - if (output["Foo"] !== undefined) { - contents.Foo = __expectString(output["Foo"]); - } - return contents; -}; - -const deserializeAws_restXmlFlattenedXmlMapWithXmlNameInputOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["V"] === null) { - return acc; - } - return { - ...acc, - [pair["K"]]: __expectString(pair["V"]) as any, - }; - }, {}); -}; - -const deserializeAws_restXmlFlattenedXmlMapWithXmlNamespaceOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["V"] === null) { - return acc; - } - return { - ...acc, - [pair["K"]]: __expectString(pair["V"]) as any, - }; - }, {}); -}; - -const deserializeAws_restXmlListWithMemberNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlListWithNamespace = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlNestedMap = ( - output: any, - context: __SerdeContext -): { [key: string]: { [key: string]: FooEnum | string } } => { - return output.reduce((acc: any, pair: any) => { - if (__getArrayIfSingleItem(pair["value"]["entry"]) === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: deserializeAws_restXmlFooEnumMap(__getArrayIfSingleItem(pair["value"]["entry"]), context), - }; - }, {}); -}; - -const deserializeAws_restXmlNestedPayload = (output: any, context: __SerdeContext): NestedPayload => { - const contents: any = { - greeting: undefined, - name: undefined, - }; - if (output["greeting"] !== undefined) { - contents.greeting = __expectString(output["greeting"]); - } - if (output["name"] !== undefined) { - contents.name = __expectString(output["name"]); - } - return contents; -}; - -const deserializeAws_restXmlPayloadWithXmlName = (output: any, context: __SerdeContext): PayloadWithXmlName => { - const contents: any = { - name: undefined, - }; - if (output["name"] !== undefined) { - contents.name = __expectString(output["name"]); - } - return contents; -}; - -const deserializeAws_restXmlPayloadWithXmlNamespace = ( - output: any, - context: __SerdeContext -): PayloadWithXmlNamespace => { - const contents: any = { - name: undefined, - }; - if (output["name"] !== undefined) { - contents.name = __expectString(output["name"]); - } - return contents; -}; - -const deserializeAws_restXmlPayloadWithXmlNamespaceAndPrefix = ( - output: any, - context: __SerdeContext -): PayloadWithXmlNamespaceAndPrefix => { - const contents: any = { - name: undefined, - }; - if (output["name"] !== undefined) { - contents.name = __expectString(output["name"]); - } - return contents; -}; - -const deserializeAws_restXmlRecursiveShapesInputOutputNested1 = ( - output: any, - context: __SerdeContext -): RecursiveShapesInputOutputNested1 => { - const contents: any = { - foo: undefined, - nested: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output["nested"] !== undefined) { - contents.nested = deserializeAws_restXmlRecursiveShapesInputOutputNested2(output["nested"], context); - } - return contents; -}; - -const deserializeAws_restXmlRecursiveShapesInputOutputNested2 = ( - output: any, - context: __SerdeContext -): RecursiveShapesInputOutputNested2 => { - const contents: any = { - bar: undefined, - recursiveMember: undefined, - }; - if (output["bar"] !== undefined) { - contents.bar = __expectString(output["bar"]); - } - if (output["recursiveMember"] !== undefined) { - contents.recursiveMember = deserializeAws_restXmlRecursiveShapesInputOutputNested1( - output["recursiveMember"], - context - ); - } - return contents; -}; - -const deserializeAws_restXmlRenamedListMembers = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlStructureList = (output: any, context: __SerdeContext): StructureListMember[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_restXmlStructureListMember(entry, context); - }); -}; - -const deserializeAws_restXmlStructureListMember = (output: any, context: __SerdeContext): StructureListMember => { - const contents: any = { - a: undefined, - b: undefined, - }; - if (output["value"] !== undefined) { - contents.a = __expectString(output["value"]); - } - if (output["other"] !== undefined) { - contents.b = __expectString(output["other"]); - } - return contents; -}; - -const deserializeAws_restXmlXmlAttributesInputOutput = ( - output: any, - context: __SerdeContext -): XmlAttributesInputOutput => { - const contents: any = { - foo: undefined, - attr: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output["test"] !== undefined) { - contents.attr = __expectString(output["test"]); - } - return contents; -}; - -const deserializeAws_restXmlXmlMapsInputOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return output.reduce((acc: any, pair: any) => { - if (pair["value"] === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: deserializeAws_restXmlGreetingStruct(pair["value"], context), - }; - }, {}); -}; - -const deserializeAws_restXmlXmlMapsXmlNameInputOutputMap = ( - output: any, - context: __SerdeContext -): { [key: string]: GreetingStruct } => { - return output.reduce((acc: any, pair: any) => { - if (pair["Setting"] === null) { - return acc; - } - return { - ...acc, - [pair["Attribute"]]: deserializeAws_restXmlGreetingStruct(pair["Setting"], context), - }; - }, {}); -}; - -const deserializeAws_restXmlXmlNamespacedList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlXmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespaceNested => { - const contents: any = { - foo: undefined, - values: undefined, - }; - if (output["foo"] !== undefined) { - contents.foo = __expectString(output["foo"]); - } - if (output.values === "") { - contents.values = []; - } - if (output["values"] !== undefined && output["values"]["member"] !== undefined) { - contents.values = deserializeAws_restXmlXmlNamespacedList( - __getArrayIfSingleItem(output["values"]["member"]), - context - ); - } - return contents; -}; - -const deserializeAws_restXmlXmlNestedUnionStruct = (output: any, context: __SerdeContext): XmlNestedUnionStruct => { - const contents: any = { - stringValue: undefined, - booleanValue: undefined, - byteValue: undefined, - shortValue: undefined, - integerValue: undefined, - longValue: undefined, - floatValue: undefined, - doubleValue: undefined, - }; - if (output["stringValue"] !== undefined) { - contents.stringValue = __expectString(output["stringValue"]); - } - if (output["booleanValue"] !== undefined) { - contents.booleanValue = __parseBoolean(output["booleanValue"]); - } - if (output["byteValue"] !== undefined) { - contents.byteValue = __strictParseByte(output["byteValue"]) as number; - } - if (output["shortValue"] !== undefined) { - contents.shortValue = __strictParseShort(output["shortValue"]) as number; - } - if (output["integerValue"] !== undefined) { - contents.integerValue = __strictParseInt32(output["integerValue"]) as number; - } - if (output["longValue"] !== undefined) { - contents.longValue = __strictParseLong(output["longValue"]) as number; - } - if (output["floatValue"] !== undefined) { - contents.floatValue = __strictParseFloat(output["floatValue"]) as number; - } - if (output["doubleValue"] !== undefined) { - contents.doubleValue = __strictParseFloat(output["doubleValue"]) as number; - } - return contents; -}; - -const deserializeAws_restXmlXmlUnionShape = (output: any, context: __SerdeContext): XmlUnionShape => { - if (output["stringValue"] !== undefined) { - return { - stringValue: __expectString(output["stringValue"]) as any, - }; - } - if (output["booleanValue"] !== undefined) { - return { - booleanValue: __parseBoolean(output["booleanValue"]), - }; - } - if (output["byteValue"] !== undefined) { - return { - byteValue: __strictParseByte(output["byteValue"]) as number, - }; - } - if (output["shortValue"] !== undefined) { - return { - shortValue: __strictParseShort(output["shortValue"]) as number, - }; - } - if (output["integerValue"] !== undefined) { - return { - integerValue: __strictParseInt32(output["integerValue"]) as number, - }; - } - if (output["longValue"] !== undefined) { - return { - longValue: __strictParseLong(output["longValue"]) as number, - }; - } - if (output["floatValue"] !== undefined) { - return { - floatValue: __strictParseFloat(output["floatValue"]) as number, - }; - } - if (output["doubleValue"] !== undefined) { - return { - doubleValue: __strictParseFloat(output["doubleValue"]) as number, - }; - } - if (output["unionValue"] !== undefined) { - return { - unionValue: deserializeAws_restXmlXmlUnionShape(__expectUnion(output["unionValue"]), context), - }; - } - if (output["structValue"] !== undefined) { - return { - structValue: deserializeAws_restXmlXmlNestedUnionStruct(output["structValue"], context), - }; - } - return { $unknown: Object.entries(output)[0] }; -}; - -const deserializeAws_restXmlBooleanList = (output: any, context: __SerdeContext): boolean[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __parseBoolean(entry); - }); -}; - -const deserializeAws_restXmlFooEnumList = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlFooEnumMap = ( - output: any, - context: __SerdeContext -): { [key: string]: FooEnum | string } => { - return output.reduce((acc: any, pair: any) => { - if (pair["value"] === null) { - return acc; - } - return { - ...acc, - [pair["key"]]: __expectString(pair["value"]) as any, - }; - }, {}); -}; - -const deserializeAws_restXmlFooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string)[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlGreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - const contents: any = { - hi: undefined, - }; - if (output["hi"] !== undefined) { - contents.hi = __expectString(output["hi"]); - } - return contents; -}; - -const deserializeAws_restXmlIntegerList = (output: any, context: __SerdeContext): number[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __strictParseInt32(entry) as number; - }); -}; - -const deserializeAws_restXmlNestedStringList = (output: any, context: __SerdeContext): string[][] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return deserializeAws_restXmlStringList(__getArrayIfSingleItem(entry["member"]), context); - }); -}; - -const deserializeAws_restXmlStringList = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlStringSet = (output: any, context: __SerdeContext): string[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectString(entry) as any; - }); -}; - -const deserializeAws_restXmlTimestampList = (output: any, context: __SerdeContext): Date[] => { - return (output || []) - .filter((e: any) => e != null) - .map((entry: any) => { - if (entry === null) { - return null as any; - } - return __expectNonNull(__parseRfc3339DateTime(entry)); - }); -}; - -const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"], -}); - -// Collect low-level response body stream to Uint8Array. -const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { - if (streamBody instanceof Uint8Array) { - return Promise.resolve(streamBody); - } - return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); -}; - -// Encode Uint8Array data into string with utf-8. -const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => - collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); - -const isSerializableHeaderValue = (value: any): boolean => - value !== undefined && - value !== null && - value !== "" && - (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && - (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); - -const parseBody = (streamBody: any, context: __SerdeContext): any => - collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - const parsedObj = xmlParse(encoded, { - attributeNamePrefix: "", - ignoreAttributes: false, - parseNodeValue: false, - trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; - } - return __getValueFromTextNode(parsedObjToReturn); - } - return {}; - }); - -const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string => { - if (data.Error.Code !== undefined) { - return data.Error.Code; - } - if (output.statusCode == 404) { - return "NotFound"; - } - return ""; -}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts deleted file mode 100644 index c57b26caa429..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Sha256 } from "@aws-crypto/sha256-browser"; -import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; -import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "browser", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, - requestHandler: config?.requestHandler ?? new FetchHttpHandler(), - retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: config?.sha256 ?? Sha256, - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts deleted file mode 100644 index e9c95d1f87ba..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.native.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Sha256 } from "@aws-crypto/sha256-js"; - -import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; -import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { - const browserDefaults = getBrowserRuntimeConfig(config); - return { - ...browserDefaults, - ...config, - runtime: "react-native", - sha256: config?.sha256 ?? Sha256, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts deleted file mode 100644 index e40141e9507e..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.shared.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Logger as __Logger } from "@aws-sdk/types"; -import { parseUrl } from "@aws-sdk/url-parser"; - -import { defaultRegionInfoProvider } from "./endpoints"; -import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => ({ - apiVersion: "2019-12-16", - disableHostPrefix: config?.disableHostPrefix ?? false, - logger: config?.logger ?? ({} as __Logger), - regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider, - serviceId: config?.serviceId ?? "Rest Xml Protocol", - urlParser: config?.urlParser ?? parseUrl, -}); diff --git a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts b/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts deleted file mode 100644 index 5b405c2b22a5..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/src/runtimeConfig.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-ignore: package.json will be imported from dist folders -import packageInfo from "../package.json"; // eslint-disable-line - -import { Hash } from "@aws-sdk/hash-node"; -import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; -import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; -import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; -import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; -import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; - -/** - * @internal - */ -export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { - emitWarningIfUnsupportedVersion(process.version); - const clientSharedValues = getSharedRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - base64Decoder: config?.base64Decoder ?? fromBase64, - base64Encoder: config?.base64Encoder ?? toBase64, - bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, - defaultUserAgentProvider: - config?.defaultUserAgentProvider ?? - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), - maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: config?.requestHandler ?? new NodeHttpHandler(), - retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: config?.sha256 ?? Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? streamCollector, - utf8Decoder: config?.utf8Decoder ?? fromUtf8, - utf8Encoder: config?.utf8Encoder ?? toUtf8, - }; -}; diff --git a/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts b/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts deleted file mode 100644 index 2e3316feba2a..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/test/functional/restxml.spec.ts +++ /dev/null @@ -1,6778 +0,0 @@ -import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; -import { buildQueryString } from "@aws-sdk/querystring-builder"; -import { Encoder as __Encoder } from "@aws-sdk/types"; -import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; -import { Readable } from "stream"; - -import { AllQueryStringTypesCommand } from "../../src/commands/AllQueryStringTypesCommand"; -import { BodyWithXmlNameCommand } from "../../src/commands/BodyWithXmlNameCommand"; -import { ConstantAndVariableQueryStringCommand } from "../../src/commands/ConstantAndVariableQueryStringCommand"; -import { ConstantQueryStringCommand } from "../../src/commands/ConstantQueryStringCommand"; -import { EmptyInputAndEmptyOutputCommand } from "../../src/commands/EmptyInputAndEmptyOutputCommand"; -import { EndpointOperationCommand } from "../../src/commands/EndpointOperationCommand"; -import { EndpointWithHostLabelHeaderOperationCommand } from "../../src/commands/EndpointWithHostLabelHeaderOperationCommand"; -import { EndpointWithHostLabelOperationCommand } from "../../src/commands/EndpointWithHostLabelOperationCommand"; -import { FlattenedXmlMapCommand } from "../../src/commands/FlattenedXmlMapCommand"; -import { FlattenedXmlMapWithXmlNameCommand } from "../../src/commands/FlattenedXmlMapWithXmlNameCommand"; -import { FlattenedXmlMapWithXmlNamespaceCommand } from "../../src/commands/FlattenedXmlMapWithXmlNamespaceCommand"; -import { GreetingWithErrorsCommand } from "../../src/commands/GreetingWithErrorsCommand"; -import { HttpPayloadTraitsCommand } from "../../src/commands/HttpPayloadTraitsCommand"; -import { HttpPayloadTraitsWithMediaTypeCommand } from "../../src/commands/HttpPayloadTraitsWithMediaTypeCommand"; -import { HttpPayloadWithMemberXmlNameCommand } from "../../src/commands/HttpPayloadWithMemberXmlNameCommand"; -import { HttpPayloadWithStructureCommand } from "../../src/commands/HttpPayloadWithStructureCommand"; -import { HttpPayloadWithXmlNameCommand } from "../../src/commands/HttpPayloadWithXmlNameCommand"; -import { HttpPayloadWithXmlNamespaceAndPrefixCommand } from "../../src/commands/HttpPayloadWithXmlNamespaceAndPrefixCommand"; -import { HttpPayloadWithXmlNamespaceCommand } from "../../src/commands/HttpPayloadWithXmlNamespaceCommand"; -import { HttpPrefixHeadersCommand } from "../../src/commands/HttpPrefixHeadersCommand"; -import { HttpRequestWithFloatLabelsCommand } from "../../src/commands/HttpRequestWithFloatLabelsCommand"; -import { HttpRequestWithGreedyLabelInPathCommand } from "../../src/commands/HttpRequestWithGreedyLabelInPathCommand"; -import { HttpRequestWithLabelsAndTimestampFormatCommand } from "../../src/commands/HttpRequestWithLabelsAndTimestampFormatCommand"; -import { HttpRequestWithLabelsCommand } from "../../src/commands/HttpRequestWithLabelsCommand"; -import { HttpResponseCodeCommand } from "../../src/commands/HttpResponseCodeCommand"; -import { IgnoreQueryParamsInResponseCommand } from "../../src/commands/IgnoreQueryParamsInResponseCommand"; -import { InputAndOutputWithHeadersCommand } from "../../src/commands/InputAndOutputWithHeadersCommand"; -import { NestedXmlMapsCommand } from "../../src/commands/NestedXmlMapsCommand"; -import { NoInputAndNoOutputCommand } from "../../src/commands/NoInputAndNoOutputCommand"; -import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputCommand"; -import { NullAndEmptyHeadersClientCommand } from "../../src/commands/NullAndEmptyHeadersClientCommand"; -import { OmitsNullSerializesEmptyStringCommand } from "../../src/commands/OmitsNullSerializesEmptyStringCommand"; -import { QueryIdempotencyTokenAutoFillCommand } from "../../src/commands/QueryIdempotencyTokenAutoFillCommand"; -import { QueryParamsAsStringListMapCommand } from "../../src/commands/QueryParamsAsStringListMapCommand"; -import { QueryPrecedenceCommand } from "../../src/commands/QueryPrecedenceCommand"; -import { RecursiveShapesCommand } from "../../src/commands/RecursiveShapesCommand"; -import { SimpleScalarPropertiesCommand } from "../../src/commands/SimpleScalarPropertiesCommand"; -import { TimestampFormatHeadersCommand } from "../../src/commands/TimestampFormatHeadersCommand"; -import { XmlAttributesCommand } from "../../src/commands/XmlAttributesCommand"; -import { XmlAttributesOnPayloadCommand } from "../../src/commands/XmlAttributesOnPayloadCommand"; -import { XmlBlobsCommand } from "../../src/commands/XmlBlobsCommand"; -import { XmlEmptyBlobsCommand } from "../../src/commands/XmlEmptyBlobsCommand"; -import { XmlEmptyListsCommand } from "../../src/commands/XmlEmptyListsCommand"; -import { XmlEmptyMapsCommand } from "../../src/commands/XmlEmptyMapsCommand"; -import { XmlEmptyStringsCommand } from "../../src/commands/XmlEmptyStringsCommand"; -import { XmlEnumsCommand } from "../../src/commands/XmlEnumsCommand"; -import { XmlListsCommand } from "../../src/commands/XmlListsCommand"; -import { XmlMapsCommand } from "../../src/commands/XmlMapsCommand"; -import { XmlMapsXmlNameCommand } from "../../src/commands/XmlMapsXmlNameCommand"; -import { XmlNamespacesCommand } from "../../src/commands/XmlNamespacesCommand"; -import { XmlTimestampsCommand } from "../../src/commands/XmlTimestampsCommand"; -import { XmlUnionsCommand } from "../../src/commands/XmlUnionsCommand"; -import { ComplexError, InvalidGreeting } from "../../src/models/models_0"; -import { RestXmlProtocolClient } from "../../src/RestXmlProtocolClient"; - -/** - * Throws an expected exception that contains the serialized request. - */ -class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error { - constructor(readonly request: HttpRequest) { - super(); - } -} - -/** - * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a - * request. The thrown exception contains the serialized request. - */ -class RequestSerializationTestHandler implements HttpHandler { - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request)); - } -} - -/** - * Returns a resolved Promise of the specified response contents. - */ -class ResponseDeserializationTestHandler implements HttpHandler { - isSuccess: boolean; - code: number; - headers: HeaderBag; - body: String; - - constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) { - this.isSuccess = isSuccess; - this.code = code; - if (headers === undefined) { - this.headers = {}; - } else { - this.headers = headers; - } - if (body === undefined) { - body = ""; - } - this.body = body; - } - - handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> { - return Promise.resolve({ - response: { - statusCode: this.code, - headers: this.headers, - body: Readable.from([this.body]), - }, - }); - } -} - -interface comparableParts { - [key: string]: string; -} - -/** - * Generates a standard map of un-equal values given input parts. - */ -const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => { - const unequalParts: any = {}; - Object.keys(expectedParts).forEach((key) => { - if (generatedParts[key] === undefined) { - unequalParts[key] = { exp: expectedParts[key], gen: undefined }; - } else if (!equivalentContents(expectedParts[key], generatedParts[key])) { - unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] }; - } - }); - - Object.keys(generatedParts).forEach((key) => { - if (expectedParts[key] === undefined) { - unequalParts[key] = { exp: undefined, gen: generatedParts[key] }; - } - }); - - if (Object.keys(unequalParts).length !== 0) { - return unequalParts; - } - return undefined; -}; - -/** - * Compares all types for equivalent contents, doing nested - * equality checks based on non-`$metadata` - * properties that have defined values. - */ -const equivalentContents = (expected: any, generated: any): boolean => { - const localExpected = expected; - - // Short circuit on equality. - if (localExpected == generated) { - return true; - } - - // If a test fails with an issue in the below 6 lines, it's likely - // due to an issue in the nestedness or existence of the property - // being compared. - delete localExpected["$metadata"]; - delete generated["$metadata"]; - Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]); - Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]); - - const expectedProperties = Object.getOwnPropertyNames(localExpected); - const generatedProperties = Object.getOwnPropertyNames(generated); - - // Short circuit on different property counts. - if (expectedProperties.length != generatedProperties.length) { - return false; - } - - // Compare properties directly. - for (let index = 0; index < expectedProperties.length; index++) { - const propertyName = expectedProperties[index]; - if (!equivalentContents(localExpected[propertyName], generated[propertyName])) { - return false; - } - } - - return true; -}; - -const clientParams = { - region: "us-west-2", - credentials: { accessKeyId: "key", secretAccessKey: "secret" }, -}; - -/** - * Serializes query string parameters with all supported types - */ -it("AllQueryStringTypes:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryString: "Hello there", - - queryStringList: ["a", "b", "c"], - - queryStringSet: ["a", "b", "c"], - - queryByte: 1, - - queryShort: 2, - - queryInteger: 3, - - queryIntegerList: [ - 1, - - 2, - - 3, - ], - - queryIntegerSet: [ - 1, - - 2, - - 3, - ], - - queryLong: 4, - - queryFloat: 1.1, - - queryDouble: 1.1, - - queryDoubleList: [ - 1.1, - - 2.1, - - 3.1, - ], - - queryBoolean: true, - - queryBooleanList: [true, false, true], - - queryTimestamp: new Date(1000), - - queryTimestampList: [new Date(1000), new Date(2000), new Date(3000)], - - queryEnum: "Foo", - - queryEnumList: ["Foo", "Baz", "Bar"], - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("String=Hello%20there"); - expect(queryString).toContain("StringList=a"); - expect(queryString).toContain("StringList=b"); - expect(queryString).toContain("StringList=c"); - expect(queryString).toContain("StringSet=a"); - expect(queryString).toContain("StringSet=b"); - expect(queryString).toContain("StringSet=c"); - expect(queryString).toContain("Byte=1"); - expect(queryString).toContain("Short=2"); - expect(queryString).toContain("Integer=3"); - expect(queryString).toContain("IntegerList=1"); - expect(queryString).toContain("IntegerList=2"); - expect(queryString).toContain("IntegerList=3"); - expect(queryString).toContain("IntegerSet=1"); - expect(queryString).toContain("IntegerSet=2"); - expect(queryString).toContain("IntegerSet=3"); - expect(queryString).toContain("Long=4"); - expect(queryString).toContain("Float=1.1"); - expect(queryString).toContain("Double=1.1"); - expect(queryString).toContain("DoubleList=1.1"); - expect(queryString).toContain("DoubleList=2.1"); - expect(queryString).toContain("DoubleList=3.1"); - expect(queryString).toContain("Boolean=true"); - expect(queryString).toContain("BooleanList=true"); - expect(queryString).toContain("BooleanList=false"); - expect(queryString).toContain("BooleanList=true"); - expect(queryString).toContain("Timestamp=1970-01-01T00%3A00%3A01Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A01Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A02Z"); - expect(queryString).toContain("TimestampList=1970-01-01T00%3A00%3A03Z"); - expect(queryString).toContain("Enum=Foo"); - expect(queryString).toContain("EnumList=Foo"); - expect(queryString).toContain("EnumList=Baz"); - expect(queryString).toContain("EnumList=Bar"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Handles query string maps - */ -it("RestXmlQueryStringMap:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryParamsMapOfStrings: { - QueryParamsStringKeyA: "Foo", - - QueryParamsStringKeyB: "Bar", - } as any, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("QueryParamsStringKeyA=Foo"); - expect(queryString).toContain("QueryParamsStringKeyB=Bar"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling NaN float query values. - */ -it("RestXmlSupportsNaNFloatQueryValues:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: NaN, - - queryDouble: NaN, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=NaN"); - expect(queryString).toContain("Double=NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float query values. - */ -it("RestXmlSupportsInfinityFloatQueryValues:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: Infinity, - - queryDouble: Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=Infinity"); - expect(queryString).toContain("Double=Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float query values. - */ -it("RestXmlSupportsNegativeInfinityFloatQueryValues:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new AllQueryStringTypesCommand({ - queryFloat: -Infinity, - - queryDouble: -Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/AllQueryStringTypesInput"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Float=-Infinity"); - expect(queryString).toContain("Double=-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes a payload using a wrapper name based on the xmlName - */ -it("BodyWithXmlName:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new BodyWithXmlNameCommand({ - nested: { - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/BodyWithXmlName"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Phreddy`; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a payload using a wrapper name based on the xmlName - */ -it("BodyWithXmlName:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - `Phreddy` - ), - }); - - const params: any = {}; - const command = new BodyWithXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Mixes constant and variable query string parameters - */ -it("ConstantAndVariableQueryStringMissingOneValue:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantAndVariableQueryStringCommand({ - baz: "bam", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantAndVariableQueryString"); - - expect(r.query["maybeSet"]).toBeUndefined(); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("baz=bam"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Mixes constant and variable query string parameters - */ -it("ConstantAndVariableQueryStringAllValues:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantAndVariableQueryStringCommand({ - baz: "bam", - - maybeSet: "yes", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantAndVariableQueryString"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("baz=bam"); - expect(queryString).toContain("maybeSet=yes"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Includes constant query string parameters - */ -it("ConstantQueryString:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new ConstantQueryStringCommand({ - hello: "hi", - } as any); - 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("GET"); - expect(r.path).toBe("/ConstantQueryString/hi"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("foo=bar"); - expect(queryString).toContain("hello"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Empty input serializes no payload - */ -it("EmptyInputAndEmptyOutput:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EmptyInputAndEmptyOutputCommand({} as any); - 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("/EmptyInputAndEmptyOutput"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Empty output serializes no payload - */ -it("EmptyInputAndEmptyOutput:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new EmptyInputAndEmptyOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait. - */ -it("RestXmlEndpointTrait:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointOperationCommand({}); - 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("/EndpointOperation"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. The label must also - * be serialized in into any other location it is bound to, such - * as the body or in this case an http header. - */ -it("RestXmlEndpointTraitWithHostLabelAndHttpBinding:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelHeaderOperationCommand({ - accountId: "bar", - } as any); - 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("/EndpointWithHostLabelHeaderOperation"); - - expect(r.headers["x-amz-account-id"]).toBeDefined(); - expect(r.headers["x-amz-account-id"]).toBe("bar"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Operations can prepend to the given host if they define the - * endpoint trait, and can use the host label trait to define - * further customization based on user input. - */ -it("RestXmlEndpointTraitWithHostLabel:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - endpoint: "https://example.com", - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new EndpointWithHostLabelOperationCommand({ - label: "bar", - } as any); - 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("/EndpointWithHostLabelOperation"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened XML maps in requests - */ -it("FlattenedXmlMap:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new FlattenedXmlMapCommand({ - myMap: { - foo: "Foo", - - baz: "Baz", - } as any, - } as any); - 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("/FlattenedXmlMap"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - foo - Foo - - - baz - Baz - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened XML maps in responses - */ -it("FlattenedXmlMap:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - foo - Foo - - - baz - Baz - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: "Foo", - - baz: "Baz", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes flattened XML maps in requests that have xmlName on members - */ -it("FlattenedXmlMapWithXmlName:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new FlattenedXmlMapWithXmlNameCommand({ - myMap: { - a: "A", - - b: "B", - } as any, - } as any); - 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("/FlattenedXmlMapWithXmlName"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - a - A - - - b - B - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes flattened XML maps in responses that have xmlName on members - */ -it("FlattenedXmlMapWithXmlName:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - a - A - - - b - B - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapWithXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - a: "A", - - b: "B", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes flattened XML maps in responses that have xmlNamespace and xmlName on members - */ -it("RestXmlFlattenedXmlMapWithXmlNamespace:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - a - A - - - b - B - - ` - ), - }); - - const params: any = {}; - const command = new FlattenedXmlMapWithXmlNamespaceCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - a: "A", - - b: "B", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that operations with errors successfully know how to deserialize the successful response - */ -it("GreetingWithErrors:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-greeting": "Hello", - }, - `` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - greeting: "Hello", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Parses simple XML errors - */ -it("InvalidGreetingError:Error:GreetingWithErrors", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "content-type": "application/xml", - }, - ` - - Sender - InvalidGreeting - Hi - setting - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "InvalidGreeting") { - console.log(err); - fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - message: "Hi", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -it("ComplexError:Error:GreetingWithErrors", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - false, - 400, - { - "x-header": "Header", - "content-type": "application/xml", - }, - ` - - Sender - ComplexError - Hi - Top level - - bar - - - foo-id - - ` - ), - }); - - const params: any = {}; - const command = new GreetingWithErrorsCommand(params); - - try { - await client.send(command); - } catch (err) { - if (err.name !== "ComplexError") { - console.log(err); - fail(`Expected a ComplexError to be thrown, got ${err.name} instead`); - return; - } - const r: any = err; - expect(r["$metadata"].httpStatusCode).toBe(400); - const paramsToValidate: any = [ - { - Header: "Header", - - TopLevel: "Top level", - - Nested: { - Foo: "bar", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); - return; - } - fail("Expected an exception to be thrown from response"); -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("HttpPayloadTraitsWithBlob:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/HttpPayloadTraits"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("HttpPayloadTraitsWithNoBlobBody:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsCommand({ - foo: "Foo", - } as any); - 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("/HttpPayloadTraits"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes a blob in the HTTP payload - */ -it("HttpPayloadTraitsWithBlob:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes an empty blob in the HTTP payload - */ -it("HttpPayloadTraitsWithNoBlobBody:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("HttpPayloadTraitsWithMediaTypeWithBlob:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadTraitsWithMediaTypeCommand({ - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - } as any); - 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("/HttpPayloadTraitsWithMediaType"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("text/plain"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `blobby blob blob`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a blob in the HTTP payload with a content-type - */ -it("HttpPayloadTraitsWithMediaTypeWithBlob:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "text/plain", - }, - `blobby blob blob` - ), - }); - - const params: any = {}; - const command = new HttpPayloadTraitsWithMediaTypeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - blob: Uint8Array.from("blobby blob blob", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload using a wrapper name based on member xmlName - */ -it("HttpPayloadWithMemberXmlName:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithMemberXmlNameCommand({ - nested: { - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithMemberXmlName"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Phreddy`; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload using a wrapper name based on member xmlName - */ -it("HttpPayloadWithMemberXmlName:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - `Phreddy` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithMemberXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload - */ -it("HttpPayloadWithStructure:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithStructureCommand({ - nested: { - greeting: "hello", - - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithStructure"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - hello - Phreddy - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload - */ -it("HttpPayloadWithStructure:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - hello - Phreddy - - ` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithStructureCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - greeting: "hello", - - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload using a wrapper name based on xmlName - */ -it("HttpPayloadWithXmlName:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithXmlNameCommand({ - nested: { - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithXmlName"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = `Phreddy`; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload using a wrapper name based on xmlName - */ -it("HttpPayloadWithXmlName:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - `Phreddy` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload using a wrapper with an XML namespace - */ -it("HttpPayloadWithXmlNamespace:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithXmlNamespaceCommand({ - nested: { - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithXmlNamespace"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - Phreddy - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload using a wrapper with an XML namespace - */ -it("HttpPayloadWithXmlNamespace:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - Phreddy - ` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithXmlNamespaceCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes a structure in the payload using a wrapper with an XML namespace - */ -it("HttpPayloadWithXmlNamespaceAndPrefix:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand({ - nested: { - name: "Phreddy", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/HttpPayloadWithXmlNamespaceAndPrefix"); - expect(r.headers["content-length"]).toBeDefined(); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - Phreddy - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes a structure in the payload using a wrapper with an XML namespace - */ -it("HttpPayloadWithXmlNamespaceAndPrefix:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - Phreddy - ` - ), - }); - - const params: any = {}; - const command = new HttpPayloadWithXmlNamespaceAndPrefixCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - name: "Phreddy", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Adds headers by prefix - */ -it("HttpPrefixHeadersArePresent:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPrefixHeadersCommand({ - foo: "Foo", - - fooMap: { - Abc: "Abc value", - - Def: "Def value", - } as any, - } as any); - 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("GET"); - expect(r.path).toBe("/HttpPrefixHeaders"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - expect(r.headers["x-foo-abc"]).toBeDefined(); - expect(r.headers["x-foo-abc"]).toBe("Abc value"); - expect(r.headers["x-foo-def"]).toBeDefined(); - expect(r.headers["x-foo-def"]).toBe("Def value"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * No prefix headers are serialized because the value is empty - */ -it("HttpPrefixHeadersAreNotPresent:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpPrefixHeadersCommand({ - foo: "Foo", - - fooMap: {} as any, - } as any); - 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("GET"); - expect(r.path).toBe("/HttpPrefixHeaders"); - - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Adds headers by prefix - */ -it("HttpPrefixHeadersArePresent:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "x-foo-abc": "Abc value", - "x-foo-def": "Def value", - }, - `` - ), - }); - - const params: any = {}; - const command = new HttpPrefixHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - fooMap: { - abc: "Abc value", - - def: "Def value", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * No prefix headers are serialized because the value is empty - */ -it("HttpPrefixHeadersAreNotPresent:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new HttpPrefixHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - fooMap: {}, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float label values. - */ -it("RestXmlSupportsNaNFloatLabels:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: NaN, - - double: NaN, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/NaN/NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float label values. - */ -it("RestXmlSupportsInfinityFloatLabels:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: Infinity, - - double: Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/Infinity/Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float label values. - */ -it("RestXmlSupportsNegativeInfinityFloatLabels:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithFloatLabelsCommand({ - float: -Infinity, - - double: -Infinity, - } as any); - 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("GET"); - expect(r.path).toBe("/FloatHttpLabels/-Infinity/-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes greedy labels and normal labels - */ -it("HttpRequestWithGreedyLabelInPath:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithGreedyLabelInPathCommand({ - foo: "hello", - - baz: "there/guy", - } as any); - 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("GET"); - expect(r.path).toBe("/HttpRequestWithGreedyLabelInPath/foo/hello/baz/there/guy"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Sends a GET request that uses URI label bindings - */ -it("InputWithHeadersAndAllParams:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithLabelsCommand({ - string: "string", - - short: 1, - - integer: 2, - - long: 3, - - float: 4.1, - - double: 5.1, - - boolean: true, - - timestamp: new Date(1576540098000), - } as any); - 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("GET"); - expect(r.path).toBe("/HttpRequestWithLabels/string/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes different timestamp formats in URI labels - */ -it("HttpRequestWithLabelsAndTimestampFormat:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new HttpRequestWithLabelsAndTimestampFormatCommand({ - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - } as any); - 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("GET"); - expect(r.path).toBe( - "/HttpRequestWithLabelsAndTimestampFormat/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z/2019-12-16T23%3A48%3A18Z/1576540098/Mon%2C%2016%20Dec%202019%2023%3A48%3A18%20GMT/2019-12-16T23%3A48%3A18Z" - ); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Binds the http response code to an output structure. - */ -it("RestXmlHttpResponseCode:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 201, - { - "content-type": "application/xml", - }, - `` - ), - }); - - const params: any = {}; - const command = new HttpResponseCodeCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(201); - const paramsToValidate: any = [ - { - Status: 201, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Query parameters must be ignored when serializing the output of an operation - */ -it("IgnoreQueryParamsInResponse:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - `bam` - ), - }); - - const params: any = {}; - const command = new IgnoreQueryParamsInResponseCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - baz: "bam", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests requests with string header bindings - */ -it("InputAndOutputWithStringHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerString: "Hello", - - headerStringList: ["a", "b", "c"], - - headerStringSet: ["a", "b", "c"], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-string"]).toBeDefined(); - expect(r.headers["x-string"]).toBe("Hello"); - expect(r.headers["x-stringlist"]).toBeDefined(); - expect(r.headers["x-stringlist"]).toBe("a, b, c"); - expect(r.headers["x-stringset"]).toBeDefined(); - expect(r.headers["x-stringset"]).toBe("a, b, c"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with numeric header bindings - */ -it("InputAndOutputWithNumericHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerByte: 1, - - headerShort: 123, - - headerInteger: 123, - - headerLong: 123, - - headerFloat: 1.1, - - headerDouble: 1.1, - - headerIntegerList: [ - 1, - - 2, - - 3, - ], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-byte"]).toBeDefined(); - expect(r.headers["x-byte"]).toBe("1"); - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("1.1"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("1.1"); - expect(r.headers["x-integer"]).toBeDefined(); - expect(r.headers["x-integer"]).toBe("123"); - expect(r.headers["x-integerlist"]).toBeDefined(); - expect(r.headers["x-integerlist"]).toBe("1, 2, 3"); - expect(r.headers["x-long"]).toBeDefined(); - expect(r.headers["x-long"]).toBe("123"); - expect(r.headers["x-short"]).toBeDefined(); - expect(r.headers["x-short"]).toBe("123"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with boolean header bindings - */ -it("InputAndOutputWithBooleanHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerTrueBool: true, - - headerFalseBool: false, - - headerBooleanList: [true, false, true], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-boolean1"]).toBeDefined(); - expect(r.headers["x-boolean1"]).toBe("true"); - expect(r.headers["x-boolean2"]).toBeDefined(); - expect(r.headers["x-boolean2"]).toBe("false"); - expect(r.headers["x-booleanlist"]).toBeDefined(); - expect(r.headers["x-booleanlist"]).toBe("true, false, true"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with timestamp header bindings - */ -it("InputAndOutputWithTimestampHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-timestamplist"]).toBeDefined(); - expect(r.headers["x-timestamplist"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests requests with enum header bindings - */ -it("InputAndOutputWithEnumHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerEnum: "Foo", - - headerEnumList: ["Foo", "Bar", "Baz"], - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-enum"]).toBeDefined(); - expect(r.headers["x-enum"]).toBe("Foo"); - expect(r.headers["x-enumlist"]).toBeDefined(); - expect(r.headers["x-enumlist"]).toBe("Foo, Bar, Baz"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling NaN float header values. - */ -it("RestXmlSupportsNaNFloatHeaderInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: NaN, - - headerDouble: NaN, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("NaN"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("NaN"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling Infinity float header values. - */ -it("RestXmlSupportsInfinityFloatHeaderInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: Infinity, - - headerDouble: Infinity, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("Infinity"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Supports handling -Infinity float header values. - */ -it("RestXmlSupportsNegativeInfinityFloatHeaderInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new InputAndOutputWithHeadersCommand({ - headerFloat: -Infinity, - - headerDouble: -Infinity, - } as any); - 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("/InputAndOutputWithHeaders"); - - expect(r.headers["x-double"]).toBeDefined(); - expect(r.headers["x-double"]).toBe("-Infinity"); - expect(r.headers["x-float"]).toBeDefined(); - expect(r.headers["x-float"]).toBe("-Infinity"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests responses with string header bindings - */ -it("InputAndOutputWithStringHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-stringlist": "a, b, c", - "x-stringset": "a, b, c", - "x-string": "Hello", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerString: "Hello", - - headerStringList: ["a", "b", "c"], - - headerStringSet: ["a", "b", "c"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with numeric header bindings - */ -it("InputAndOutputWithNumericHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-float": "1.1", - "x-byte": "1", - "x-long": "123", - "x-integer": "123", - "x-integerlist": "1, 2, 3", - "x-double": "1.1", - "x-short": "123", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerByte: 1, - - headerShort: 123, - - headerInteger: 123, - - headerLong: 123, - - headerFloat: 1.1, - - headerDouble: 1.1, - - headerIntegerList: [ - 1, - - 2, - - 3, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with boolean header bindings - */ -it("InputAndOutputWithBooleanHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-booleanlist": "true, false, true", - "x-boolean1": "true", - "x-boolean2": "false", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerTrueBool: true, - - headerFalseBool: false, - - headerBooleanList: [true, false, true], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with timestamp header bindings - */ -it("InputAndOutputWithTimestampHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-timestamplist": "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerTimestampList: [new Date(1576540098000), new Date(1576540098000)], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with enum header bindings - */ -it("InputAndOutputWithEnumHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-enumlist": "Foo, Bar, Baz", - "x-enum": "Foo", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerEnum: "Foo", - - headerEnumList: ["Foo", "Bar", "Baz"], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float header values. - */ -it("RestXmlSupportsNaNFloatHeaderOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-float": "NaN", - "x-double": "NaN", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: NaN, - - headerDouble: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float header values. - */ -it("RestXmlSupportsInfinityFloatHeaderOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-float": "Infinity", - "x-double": "Infinity", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: Infinity, - - headerDouble: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float header values. - */ -it("RestXmlSupportsNegativeInfinityFloatHeaderOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-float": "-Infinity", - "x-double": "-Infinity", - }, - `` - ), - }); - - const params: any = {}; - const command = new InputAndOutputWithHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - headerFloat: -Infinity, - - headerDouble: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests requests with nested maps. - */ -it("NestedXmlMapRequest:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NestedXmlMapsCommand({ - nestedMap: { - foo: { - bar: "Bar", - } as any, - } as any, - } as any); - 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("/NestedXmlMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - foo - - - bar - Bar - - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests requests with nested flat maps. Since maps can only be - * flattened when they're structure members, only the outer map is flat. - */ -it("FlatNestedXmlMapRequest:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NestedXmlMapsCommand({ - flatNestedMap: { - foo: { - bar: "Bar", - } as any, - } as any, - } as any); - 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("/NestedXmlMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - foo - - - bar - Bar - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests responses with nested maps. - */ -it("NestedXmlMapResponse:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - foo - - - bar - Bar - - - - - ` - ), - }); - - const params: any = {}; - const command = new NestedXmlMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nestedMap: { - foo: { - bar: "Bar", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests responses with nested flat maps. Since maps can only be - * flattened when they're structure members, only the outer map is flat. - */ -it("FlatNestedXmlMapResponse:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - foo - - - bar - Bar - - - - ` - ), - }); - - const params: any = {}; - const command = new NestedXmlMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - flatNestedMap: { - foo: { - bar: "Bar", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * No input serializes no payload - */ -it("NoInputAndNoOutput:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndNoOutputCommand({}); - 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("/NoInputAndNoOutput"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * No output serializes no payload - */ -it("NoInputAndNoOutput:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new NoInputAndNoOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * No input serializes no payload - */ -it("NoInputAndOutput:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NoInputAndOutputCommand({}); - 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("/NoInputAndOutputOutput"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Empty output serializes no payload - */ -it("NoInputAndOutput:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), - }); - - const params: any = {}; - const command = new NoInputAndOutputCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); -}); - -/** - * Do not send null values, empty strings, or empty lists over the wire in headers - */ -it("NullAndEmptyHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new NullAndEmptyHeadersClientCommand({ - a: null, - - b: "", - - c: [], - } as any); - 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("GET"); - expect(r.path).toBe("/NullAndEmptyHeadersClient"); - - expect(r.headers["x-a"]).toBeUndefined(); - expect(r.headers["x-b"]).toBeUndefined(); - expect(r.headers["x-c"]).toBeUndefined(); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Omits null query values - */ -it("RestXmlOmitsNullQuery:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OmitsNullSerializesEmptyStringCommand({ - nullValue: null, - } as any); - 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("GET"); - expect(r.path).toBe("/OmitsNullSerializesEmptyString"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes empty query strings - */ -it("RestXmlSerializesEmptyString:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new OmitsNullSerializesEmptyStringCommand({ - emptyString: "", - } as any); - 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("GET"); - expect(r.path).toBe("/OmitsNullSerializesEmptyString"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("Empty="); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Automatically adds idempotency token when not set - */ -it("QueryIdempotencyTokenAutoFill:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/QueryIdempotencyTokenAutoFill"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Uses the given idempotency token as-is - */ -it("QueryIdempotencyTokenAutoFillIsSet:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryIdempotencyTokenAutoFillCommand({ - token: "00000000-0000-4000-8000-000000000000", - } as any); - 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("/QueryIdempotencyTokenAutoFill"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("token=00000000-0000-4000-8000-000000000000"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serialize query params from map of list strings - */ -it("RestXmlQueryParamsStringListMap:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryParamsAsStringListMapCommand({ - qux: "named", - - foo: { - baz: ["bar", "qux"], - } as any, - } as any); - 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("/StringListMap"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("corge=named"); - expect(queryString).toContain("baz=bar"); - expect(queryString).toContain("baz=qux"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Prefer named query parameters when serializing - */ -it("RestXmlQueryPrecedence:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new QueryPrecedenceCommand({ - foo: "named", - - baz: { - bar: "fromMap", - - qux: "alsoFromMap", - } as any, - } as any); - 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("/Precedence"); - - const queryString = buildQueryString(r.query); - expect(queryString).toContain("bar=named"); - expect(queryString).toContain("qux=alsoFromMap"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Serializes recursive structures - */ -it("RecursiveShapes:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new RecursiveShapesCommand({ - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - } as any, - } as any, - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/RecursiveShapes"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - Foo1 - - Bar1 - - Foo2 - - Bar2 - - - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes recursive structures - */ -it("RecursiveShapes:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - Foo1 - - Bar1 - - Foo2 - - Bar2 - - - - - - ` - ), - }); - - const params: any = {}; - const command = new RecursiveShapesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo1", - - nested: { - bar: "Bar1", - - recursiveMember: { - foo: "Foo2", - - nested: { - bar: "Bar2", - }, - }, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("SimpleScalarProperties:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - foo: "Foo", - - stringValue: "string", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - string - true - false - 1 - 2 - 3 - 4 - 5.5 - 6.5 - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes string with escaping - */ -it("SimpleScalarPropertiesWithEscapedCharacter:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - foo: "Foo", - - stringValue: "", - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - <string> - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes string containing white space - */ -it("SimpleScalarPropertiesWithWhiteSpace:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - foo: "Foo", - - stringValue: " string with white space ", - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - string with white space - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes string containing exclusively whitespace - */ -it("SimpleScalarPropertiesPureWhiteSpace:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - foo: "Foo", - - stringValue: " ", - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - expect(r.headers["x-foo"]).toBeDefined(); - expect(r.headers["x-foo"]).toBe("Foo"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling NaN float values. - */ -it("RestXmlSupportsNaNFloatInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: NaN, - - doubleValue: NaN, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - NaN - NaN - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling Infinity float values. - */ -it("RestXmlSupportsInfinityFloatInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: Infinity, - - doubleValue: Infinity, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - Infinity - Infinity - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Supports handling -Infinity float values. - */ -it("RestXmlSupportsNegativeInfinityFloatInputs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new SimpleScalarPropertiesCommand({ - floatValue: -Infinity, - - doubleValue: -Infinity, - } as any); - 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("PUT"); - expect(r.path).toBe("/SimpleScalarProperties"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - -Infinity - -Infinity - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("SimpleScalarProperties:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - string - true - false - 1 - 2 - 3 - 4 - 5.5 - 6.5 - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: "string", - - trueBooleanValue: true, - - falseBooleanValue: false, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes string with escaping. - * - * This validates the three escape types: literal, decimal and hexadecimal. It also validates that unescaping properly - * handles the case where unescaping an & produces a newly formed escape sequence (this should not be re-unescaped). - * - * Servers may produce different output, this test is designed different unescapes clients must handle - * - */ -it("SimpleScalarPropertiesComplexEscapes:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - escaped data: &lt; - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: "escaped data: <\r\n", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes string with escaping - */ -it("SimpleScalarPropertiesWithEscapedCharacter:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - <string> - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: "", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties with xml preamble, comments and CDATA - */ -it("SimpleScalarPropertiesWithXMLPreamble:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - - - string - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: "string", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes string containing white space - */ -it("SimpleScalarPropertiesWithWhiteSpace:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - - string with white space - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: " string with white space ", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes string containing white space - */ -it("SimpleScalarPropertiesPureWhiteSpace:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-foo": "Foo", - "content-type": "application/xml", - }, - ` - - - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "Foo", - - stringValue: " ", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling NaN float values. - */ -it("RestXmlSupportsNaNFloatOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - NaN - NaN - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: NaN, - - doubleValue: NaN, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling Infinity float values. - */ -it("RestXmlSupportsInfinityFloatOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - Infinity - Infinity - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: Infinity, - - doubleValue: Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Supports handling -Infinity float values. - */ -it("RestXmlSupportsNegativeInfinityFloatOutputs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - -Infinity - -Infinity - - ` - ), - }); - - const params: any = {}; - const command = new SimpleScalarPropertiesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - floatValue: -Infinity, - - doubleValue: -Infinity, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests how timestamp request headers are serialized - */ -it("TimestampFormatHeaders:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new TimestampFormatHeadersCommand({ - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - } as any); - 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("/TimestampFormatHeaders"); - - expect(r.headers["x-defaultformat"]).toBeDefined(); - expect(r.headers["x-defaultformat"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - expect(r.headers["x-memberdatetime"]).toBeDefined(); - expect(r.headers["x-memberdatetime"]).toBe("2019-12-16T23:48:18Z"); - expect(r.headers["x-memberepochseconds"]).toBeDefined(); - expect(r.headers["x-memberepochseconds"]).toBe("1576540098"); - expect(r.headers["x-memberhttpdate"]).toBeDefined(); - expect(r.headers["x-memberhttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - expect(r.headers["x-targetdatetime"]).toBeDefined(); - expect(r.headers["x-targetdatetime"]).toBe("2019-12-16T23:48:18Z"); - expect(r.headers["x-targetepochseconds"]).toBeDefined(); - expect(r.headers["x-targetepochseconds"]).toBe("1576540098"); - expect(r.headers["x-targethttpdate"]).toBeDefined(); - expect(r.headers["x-targethttpdate"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT"); - - expect(r.body).toBeFalsy(); - } -}); - -/** - * Tests how timestamp response headers are serialized - */ -it("TimestampFormatHeaders:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "x-targetepochseconds": "1576540098", - "x-memberdatetime": "2019-12-16T23:48:18Z", - "x-defaultformat": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-memberepochseconds": "1576540098", - "x-targethttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-memberhttpdate": "Mon, 16 Dec 2019 23:48:18 GMT", - "x-targetdatetime": "2019-12-16T23:48:18Z", - }, - `` - ), - }); - - const params: any = {}; - const command = new TimestampFormatHeadersCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - memberEpochSeconds: new Date(1576540098000), - - memberHttpDate: new Date(1576540098000), - - memberDateTime: new Date(1576540098000), - - defaultFormat: new Date(1576540098000), - - targetEpochSeconds: new Date(1576540098000), - - targetHttpDate: new Date(1576540098000), - - targetDateTime: new Date(1576540098000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML attributes on the synthesized document - */ -it("XmlAttributes:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlAttributesCommand({ - foo: "hi", - - attr: "test", - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlAttributes"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - hi - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes XML attributes with escaped characters on the synthesized document - */ -it("XmlAttributesWithEscaping:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlAttributesCommand({ - foo: "hi", - - attr: "", - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlAttributes"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - hi - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("XmlAttributes:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - hi - - ` - ), - }); - - const params: any = {}; - const command = new XmlAttributesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - foo: "hi", - - attr: "test", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML attributes on the synthesized document - */ -it("XmlAttributesOnPayload:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlAttributesOnPayloadCommand({ - payload: { - foo: "hi", - - attr: "test", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlAttributesOnPayload"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - hi - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("XmlAttributesOnPayload:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - hi - - ` - ), - }); - - const params: any = {}; - const command = new XmlAttributesOnPayloadCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - payload: { - foo: "hi", - - attr: "test", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Blobs are base64 encoded - */ -it("XmlBlobs:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlBlobsCommand({ - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - } as any); - 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("/XmlBlobs"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - dmFsdWU= - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Blobs are base64 encoded - */ -it("XmlBlobs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - dmFsdWU= - - ` - ), - }); - - const params: any = {}; - const command = new XmlBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("value", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty blobs are deserialized as empty string - */ -it("XmlEmptyBlobs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty self closed blobs are deserialized as empty string - */ -it("XmlEmptySelfClosedBlobs:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyBlobsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - data: Uint8Array.from("", (c) => c.charCodeAt(0)), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes Empty XML lists - */ -it("XmlEmptyLists:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlEmptyListsCommand({ - stringList: [], - - stringSet: [], - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlEmptyLists"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes Empty XML lists - */ -it("XmlEmptyLists:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: [], - - stringSet: [], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes Empty XML maps - */ -it("XmlEmptyMaps:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlEmptyMapsCommand({ - myMap: {} as any, - } as any); - 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("/XmlEmptyMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes Empty XML maps - */ -it("XmlEmptyMaps:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: {}, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Deserializes Empty Self-closed XML maps - */ -it("XmlEmptySelfClosedMaps:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: {}, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes xml empty strings - */ -it("XmlEmptyStrings:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlEmptyStringsCommand({ - emptyString: "", - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlEmptyStrings"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Deserializes xml empty strings - */ -it("XmlEmptyStrings:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyStringsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - emptyString: "", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Empty self closed string are deserialized as empty string - */ -it("XmlEmptySelfClosedStrings:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEmptyStringsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - emptyString: "", - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes simple scalar properties - */ -it("XmlEnums:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlEnumsCommand({ - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlEnums"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - Foo - 0 - 1 - - Foo - 0 - - - Foo - 0 - - - - hi - Foo - - - zero - 0 - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes simple scalar properties - */ -it("XmlEnums:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - Foo - 0 - 1 - - Foo - 0 - - - Foo - 0 - - - - hi - Foo - - - zero - 0 - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlEnumsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - fooEnum1: "Foo", - - fooEnum2: "0", - - fooEnum3: "1", - - fooEnumList: ["Foo", "0"], - - fooEnumSet: ["Foo", "0"], - - fooEnumMap: { - hi: "Foo", - - zero: "0", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests for XML list serialization - */ -it("XmlLists:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlListsCommand({ - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - renamedListMembers: ["foo", "bar"], - - flattenedList: ["hi", "bye"], - - flattenedList2: ["yep", "nope"], - - structureList: [ - { - a: "1", - - b: "2", - } as any, - - { - a: "3", - - b: "4", - } as any, - ], - - flattenedStructureList: [ - { - a: "5", - - b: "6", - } as any, - - { - a: "7", - - b: "8", - } as any, - ], - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlLists"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - foo - bar - - - foo - bar - - - 1 - 2 - - - true - false - - - 2014-04-29T18:30:38Z - 2014-04-29T18:30:38Z - - - Foo - 0 - - - - foo - bar - - - baz - qux - - - - foo - bar - - hi - bye - yep - nope - - - 1 - 2 - - - 3 - 4 - - - - 5 - 6 - - - 7 - 8 - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests for XML list serialization - */ -it("XmlLists:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - foo - bar - - - foo - bar - - - 1 - 2 - - - true - false - - - 2014-04-29T18:30:38Z - 2014-04-29T18:30:38Z - - - Foo - 0 - - - - foo - bar - - - baz - qux - - - - foo - bar - - hi - bye - yep - nope - a - b - a - b - - - 1 - 2 - - - 3 - 4 - - - - 5 - 6 - - - 7 - 8 - - - ` - ), - }); - - const params: any = {}; - const command = new XmlListsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - stringList: ["foo", "bar"], - - stringSet: ["foo", "bar"], - - integerList: [ - 1, - - 2, - ], - - booleanList: [true, false], - - timestampList: [new Date(1398796238000), new Date(1398796238000)], - - enumList: ["Foo", "0"], - - nestedStringList: [ - ["foo", "bar"], - - ["baz", "qux"], - ], - - renamedListMembers: ["foo", "bar"], - - flattenedList: ["hi", "bye"], - - flattenedList2: ["yep", "nope"], - - flattenedListWithMemberNamespace: ["a", "b"], - - flattenedListWithNamespace: ["a", "b"], - - structureList: [ - { - a: "1", - - b: "2", - }, - - { - a: "3", - - b: "4", - }, - ], - - flattenedStructureList: [ - { - a: "5", - - b: "6", - }, - - { - a: "7", - - b: "8", - }, - ], - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests for XML map serialization - */ -it("XmlMaps:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlMapsCommand({ - myMap: { - foo: { - hi: "there", - } as any, - - baz: { - hi: "bye", - } as any, - } as any, - } as any); - 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("/XmlMaps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - foo - - there - - - - baz - - bye - - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests for XML map serialization - */ -it("XmlMaps:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - foo - - there - - - - baz - - bye - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlMapsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML maps that have xmlName on members - */ -it("XmlMapsXmlName:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlMapsXmlNameCommand({ - myMap: { - foo: { - hi: "there", - } as any, - - baz: { - hi: "bye", - } as any, - } as any, - } as any); - 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("/XmlMapsXmlName"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - foo - - there - - - - baz - - bye - - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes XML lists - */ -it("XmlMapsXmlName:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - foo - - there - - - - baz - - bye - - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlMapsXmlNameCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - myMap: { - foo: { - hi: "there", - }, - - baz: { - hi: "bye", - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes XML namespaces - */ -it("XmlNamespaces:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlNamespacesCommand({ - nested: { - foo: "Foo", - - values: ["Bar", "Baz"], - } as any, - } as any); - 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("/XmlNamespaces"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - Foo - - Bar - Baz - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes XML namespaces - */ -it("XmlNamespaces:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - Foo - - Bar - Baz - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlNamespacesCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - nested: { - foo: "Foo", - - values: ["Bar", "Baz"], - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Tests how normal timestamps are serialized - */ -it("XmlTimestamps:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlTimestampsCommand({ - normal: new Date(1398796238000), - } as any); - 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("/XmlTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - 2014-04-29T18:30:38Z - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("XmlTimestampsWithDateTimeFormat:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlTimestampsCommand({ - dateTime: new Date(1398796238000), - } as any); - 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("/XmlTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - 2014-04-29T18:30:38Z - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("XmlTimestampsWithEpochSecondsFormat:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlTimestampsCommand({ - epochSeconds: new Date(1398796238000), - } as any); - 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("/XmlTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - 1398796238 - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("XmlTimestampsWithHttpDateFormat:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlTimestampsCommand({ - httpDate: new Date(1398796238000), - } as any); - 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("/XmlTimestamps"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - Tue, 29 Apr 2014 18:30:38 GMT - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Tests how normal timestamps are serialized - */ -it("XmlTimestamps:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - 2014-04-29T18:30:38Z - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - normal: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of date-time works like normal timestamps - */ -it("XmlTimestampsWithDateTimeFormat:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - 2014-04-29T18:30:38Z - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - dateTime: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of epoch-seconds works - */ -it("XmlTimestampsWithEpochSecondsFormat:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - 1398796238 - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - epochSeconds: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Ensures that the timestampFormat of http-date works - */ -it("XmlTimestampsWithHttpDateFormat:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - Tue, 29 Apr 2014 18:30:38 GMT - - ` - ), - }); - - const params: any = {}; - const command = new XmlTimestampsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - httpDate: new Date(1398796238000), - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes union struct member - */ -it("XmlUnionsWithStructMember:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlUnionsCommand({ - unionValue: { - structValue: { - stringValue: "string", - - booleanValue: true, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - string - true - 1 - 2 - 3 - 4 - 5.5 - 6.5 - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * serialize union string member - */ -it("XmlUnionsWithStringMember:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlUnionsCommand({ - unionValue: { - stringValue: "some string", - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - some string - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes union boolean member - */ -it("XmlUnionsWithBooleanMember:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlUnionsCommand({ - unionValue: { - booleanValue: true, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - true - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes union union member - */ -it("XmlUnionsWithUnionMember:Request", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new RequestSerializationTestHandler(), - }); - - const command = new XmlUnionsCommand({ - unionValue: { - unionValue: { - booleanValue: true, - } as any, - } as any, - } as any); - 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("PUT"); - expect(r.path).toBe("/XmlUnions"); - - expect(r.headers["content-type"]).toBeDefined(); - expect(r.headers["content-type"]).toBe("application/xml"); - - expect(r.body).toBeDefined(); - const utf8Encoder = client.config.utf8Encoder; - const bodyString = ` - - - true - - - - `; - const unequalParts: any = compareEquivalentXmlBodies(bodyString, r.body.toString()); - expect(unequalParts).toBeUndefined(); - } -}); - -/** - * Serializes union struct member - */ -it("XmlUnionsWithStructMember:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - string - true - 1 - 2 - 3 - 4 - 5.5 - 6.5 - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - unionValue: { - structValue: { - stringValue: "string", - - booleanValue: true, - - byteValue: 1, - - shortValue: 2, - - integerValue: 3, - - longValue: 4, - - floatValue: 5.5, - - doubleValue: 6.5, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes union string member - */ -it("XmlUnionsWithStringMember:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - some string - - - ` - ), - }); - - const params: any = {}; - const command = new XmlUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - unionValue: { - stringValue: "some string", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes union boolean member - */ -it("XmlUnionsWithBooleanMember:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - true - - - ` - ), - }); - - const params: any = {}; - const command = new XmlUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - unionValue: { - booleanValue: true, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * Serializes union union member - */ -it("XmlUnionsWithUnionMember:Response", async () => { - const client = new RestXmlProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/xml", - }, - ` - - - true - - - - ` - ), - }); - - const params: any = {}; - const command = new XmlUnionsCommand(params); - - let r: any; - try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got err."); - return; - } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - unionValue: { - unionValue: { - booleanValue: true, - }, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); - -/** - * 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); -}; - -/** - * Returns a map of key names that were un-equal to value objects showing the - * discrepancies between the components. - */ -const compareEquivalentXmlBodies = (expectedBody: string, generatedBody: string): Object => { - const parseConfig = { - attributeNamePrefix: "", - ignoreAttributes: false, - parseNodeValue: false, - trimValues: false, - tagValueProcessor: (val: any, tagName: any) => (val.trim() === "" ? "" : decodeHTML(val)), - }; - - const parseXmlBody = (body: string) => { - const parsedObj = xmlParse(body, parseConfig); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; - } - return parsedObj; - }; - - const expectedParts = parseXmlBody(expectedBody); - const generatedParts = parseXmlBody(generatedBody); - - return compareParts(expectedParts, generatedParts); -}; diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json deleted file mode 100644 index 4c72364cd1a0..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/tsconfig.es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es5", - "module": "esnext", - "moduleResolution": "node", - "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], - "outDir": "dist-es" - } -} diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.json deleted file mode 100644 index 2d7dc445bb52..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "target": "ES2018", - "module": "commonjs", - "strict": true, - "downlevelIteration": true, - "importHelpers": true, - "noEmitHelpers": true, - "incremental": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "rootDir": "src", - "outDir": "dist-cjs", - "removeComments": true - }, - "typedocOptions": { - "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], - "excludeNotExported": true, - "excludePrivate": true, - "hideGenerator": true, - "ignoreCompilerErrors": true, - "includeDeclarations": true, - "stripInternal": true, - "readme": "README.md", - "mode": "file", - "out": "docs", - "theme": "minimal", - "plugin": ["@aws-sdk/service-client-documentation-generator"] - }, - "exclude": ["test/**/*"] -} diff --git a/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json b/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json deleted file mode 100644 index b7018298d8ae..000000000000 --- a/protocol_tests/aws-protocoltests-restxml/tsconfig.types.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "removeComments": false, - "declaration": true, - "declarationDir": "dist-types" - }, - "exclude": ["test/**/*", "dist-types/**/*"] -} From 6b7e8b14d2e9c435cbf7b2dab5eff3dcf62eae17 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:05:50 +0000 Subject: [PATCH 06/11] chore: use generate-clients n option to disable private clients --- scripts/generate-clients/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/generate-clients/index.js b/scripts/generate-clients/index.js index 1d9086d65c29..5dabd460f5c3 100644 --- a/scripts/generate-clients/index.js +++ b/scripts/generate-clients/index.js @@ -19,7 +19,7 @@ const { models, globs, output: clientsDir, - noProtocolTest, + noPrivateClients, s: serverOnly, } = yargs .alias("m", "models") @@ -33,9 +33,9 @@ const { .string("o") .describe("o", "The output directory for built clients") .default("o", SDK_CLIENTS_DIR) - .alias("n", "noProtocolTest") + .alias("n", "noPrivateClients") .boolean("n") - .describe("n", "Disable generating protocol test files") + .describe("n", "Disable generating private clients") .alias("s", "server-artifacts") .boolean("s") .describe("s", "Generate server artifacts instead of client ones") @@ -58,17 +58,17 @@ const { } await generateClients(models || globs); - if (!noProtocolTest) await generateProtocolTests(); + if (!noPrivateClients) await generateProtocolTests(); await eslintFixCode(); await prettifyCode(CODE_GEN_SDK_OUTPUT_DIR); - if (!noProtocolTest) await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + if (!noPrivateClients) await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); await copyToClients(CODE_GEN_SDK_OUTPUT_DIR, clientsDir); - if (!noProtocolTest) await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + if (!noPrivateClients) await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); emptyDirSync(CODE_GEN_SDK_OUTPUT_DIR); - if (!noProtocolTest) emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + if (!noPrivateClients) emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); emptyDirSync(TEMP_CODE_GEN_INPUT_DIR); rmdirSync(TEMP_CODE_GEN_INPUT_DIR); From 656ad6c78f8cce8a8698e6c79ec2eb9f39ead30e Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:08:43 +0000 Subject: [PATCH 07/11] chore: create constant for CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR --- scripts/generate-clients/code-gen-dir.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/generate-clients/code-gen-dir.js b/scripts/generate-clients/code-gen-dir.js index a328afd233a7..b4603978249f 100644 --- a/scripts/generate-clients/code-gen-dir.js +++ b/scripts/generate-clients/code-gen-dir.js @@ -12,6 +12,7 @@ const TEMP_CODE_GEN_INPUT_DIR = normalize(join(__dirname, ".aws-models")); const getCodeGenOutputDir = (dir) => normalize(join(__dirname, "..", "..", "codegen", dir, "build", "smithyprojections", dir)); const CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR = getCodeGenOutputDir("protocol-test-codegen"); +const CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR = getCodeGenOutputDir("generic-client-test-codegen"); const CODE_GEN_SDK_OUTPUT_DIR = getCodeGenOutputDir("sdk-codegen"); module.exports = { @@ -20,5 +21,6 @@ module.exports = { CODE_GEN_PROTOCOL_TESTS_ROOT, CODE_GEN_SDK_OUTPUT_DIR, CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, + CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR, TEMP_CODE_GEN_INPUT_DIR, }; From 6aac9d6c62c40fbe7e1ea3db4d366f1683a8d8ed Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:10:35 +0000 Subject: [PATCH 08/11] chore: call operations on CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR --- scripts/generate-clients/code-gen.js | 7 +++++++ scripts/generate-clients/index.js | 23 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/generate-clients/code-gen.js b/scripts/generate-clients/code-gen.js index 2c8f09c01f65..1d7609061732 100644 --- a/scripts/generate-clients/code-gen.js +++ b/scripts/generate-clients/code-gen.js @@ -54,7 +54,14 @@ const generateProtocolTests = async () => { }); }; +const generateGenericClient = async () => { + await spawnProcess("./gradlew", [":smithy-aws-typescript-codegen:clean", ":generic-client-test-codegen:build"], { + cwd: CODE_GEN_ROOT, + }); +}; + module.exports = { generateClients, + generateGenericClient, generateProtocolTests, }; diff --git a/scripts/generate-clients/index.js b/scripts/generate-clients/index.js index 5dabd460f5c3..194d1dacf967 100644 --- a/scripts/generate-clients/index.js +++ b/scripts/generate-clients/index.js @@ -2,10 +2,11 @@ const yargs = require("yargs"); const path = require("path"); const { emptyDirSync, rmdirSync } = require("fs-extra"); -const { generateClients, generateProtocolTests } = require("./code-gen"); +const { generateClients, generateGenericClient, generateProtocolTests } = require("./code-gen"); const { copyToClients, copyServerTests } = require("./copy-to-clients"); const { CODE_GEN_SDK_OUTPUT_DIR, + CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR, CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, TEMP_CODE_GEN_INPUT_DIR, } = require("./code-gen-dir"); @@ -58,17 +59,29 @@ const { } await generateClients(models || globs); - if (!noPrivateClients) await generateProtocolTests(); + if (!noPrivateClients) { + await generateGenericClient(); + await generateProtocolTests(); + } await eslintFixCode(); await prettifyCode(CODE_GEN_SDK_OUTPUT_DIR); - if (!noPrivateClients) await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + if (!noPrivateClients) { + await prettifyCode(CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR); + await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + } await copyToClients(CODE_GEN_SDK_OUTPUT_DIR, clientsDir); - if (!noPrivateClients) await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + if (!noPrivateClients) { + await copyToClients(CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + } emptyDirSync(CODE_GEN_SDK_OUTPUT_DIR); - if (!noPrivateClients) emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + if (!noPrivateClients) { + emptyDirSync(CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR); + emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + } emptyDirSync(TEMP_CODE_GEN_INPUT_DIR); rmdirSync(TEMP_CODE_GEN_INPUT_DIR); From 06a83833ea279f90f3370477604fc3d96ced7c46 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:45:50 +0000 Subject: [PATCH 09/11] chore: rename PROTOCOL_TESTS_CLIENTS_DIR to PRIVATE_CLIENTS_DIR --- scripts/generate-clients/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/generate-clients/index.js b/scripts/generate-clients/index.js index 194d1dacf967..6193548cae4b 100644 --- a/scripts/generate-clients/index.js +++ b/scripts/generate-clients/index.js @@ -14,7 +14,7 @@ const { prettifyCode } = require("./code-prettify"); const { eslintFixCode } = require("./code-eslint-fix"); const SDK_CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "clients")); -const PROTOCOL_TESTS_CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "private")); +const PRIVATE_CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "private")); const { models, @@ -49,7 +49,7 @@ const { await generateProtocolTests(); await eslintFixCode(); await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); - await copyServerTests(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + await copyServerTests(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PRIVATE_CLIENTS_DIR); emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); emptyDirSync(TEMP_CODE_GEN_INPUT_DIR); @@ -73,8 +73,8 @@ const { await copyToClients(CODE_GEN_SDK_OUTPUT_DIR, clientsDir); if (!noPrivateClients) { - await copyToClients(CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); - await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); + await copyToClients(CODE_GEN_GENERIC_CLIENT_OUTPUT_DIR, PRIVATE_CLIENTS_DIR); + await copyToClients(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PRIVATE_CLIENTS_DIR); } emptyDirSync(CODE_GEN_SDK_OUTPUT_DIR); From d4116fc0d95508e5420b916c1dcb46e66a6cfbd8 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:47:31 +0000 Subject: [PATCH 10/11] feat(private): add generic client aws-echo-service --- private/aws-echo-service/.gitignore | 9 + private/aws-echo-service/LICENSE | 201 +++++++++++++ private/aws-echo-service/jest.config.js | 4 + private/aws-echo-service/package.json | 94 +++++++ private/aws-echo-service/src/EchoService.ts | 52 ++++ .../aws-echo-service/src/EchoServiceClient.ts | 193 +++++++++++++ .../src/commands/EchoCommand.ts | 70 +++++ .../src/commands/LengthCommand.ts | 70 +++++ .../aws-echo-service/src/commands/index.ts | 2 + private/aws-echo-service/src/index.ts | 4 + private/aws-echo-service/src/models/index.ts | 1 + .../aws-echo-service/src/models/models_0.ts | 71 +++++ .../src/protocols/Aws_restJson1.ts | 265 ++++++++++++++++++ .../src/runtimeConfig.browser.ts | 36 +++ .../src/runtimeConfig.native.ts | 16 ++ .../src/runtimeConfig.shared.ts | 13 + private/aws-echo-service/src/runtimeConfig.ts | 39 +++ private/aws-echo-service/tsconfig.es.json | 10 + private/aws-echo-service/tsconfig.json | 32 +++ private/aws-echo-service/tsconfig.types.json | 10 + 20 files changed, 1192 insertions(+) create mode 100644 private/aws-echo-service/.gitignore create mode 100644 private/aws-echo-service/LICENSE create mode 100644 private/aws-echo-service/jest.config.js create mode 100644 private/aws-echo-service/package.json create mode 100644 private/aws-echo-service/src/EchoService.ts create mode 100644 private/aws-echo-service/src/EchoServiceClient.ts create mode 100644 private/aws-echo-service/src/commands/EchoCommand.ts create mode 100644 private/aws-echo-service/src/commands/LengthCommand.ts create mode 100644 private/aws-echo-service/src/commands/index.ts create mode 100644 private/aws-echo-service/src/index.ts create mode 100644 private/aws-echo-service/src/models/index.ts create mode 100644 private/aws-echo-service/src/models/models_0.ts create mode 100644 private/aws-echo-service/src/protocols/Aws_restJson1.ts create mode 100644 private/aws-echo-service/src/runtimeConfig.browser.ts create mode 100644 private/aws-echo-service/src/runtimeConfig.native.ts create mode 100644 private/aws-echo-service/src/runtimeConfig.shared.ts create mode 100644 private/aws-echo-service/src/runtimeConfig.ts create mode 100644 private/aws-echo-service/tsconfig.es.json create mode 100644 private/aws-echo-service/tsconfig.json create mode 100644 private/aws-echo-service/tsconfig.types.json diff --git a/private/aws-echo-service/.gitignore b/private/aws-echo-service/.gitignore new file mode 100644 index 000000000000..54f14c9aef25 --- /dev/null +++ b/private/aws-echo-service/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json diff --git a/private/aws-echo-service/LICENSE b/private/aws-echo-service/LICENSE new file mode 100644 index 000000000000..f9e0c8672bca --- /dev/null +++ b/private/aws-echo-service/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/private/aws-echo-service/jest.config.js b/private/aws-echo-service/jest.config.js new file mode 100644 index 000000000000..02eed352c6a8 --- /dev/null +++ b/private/aws-echo-service/jest.config.js @@ -0,0 +1,4 @@ +module.exports = { + preset: "ts-jest", + testMatch: ["**/*.spec.ts", "!**/*.browser.spec.ts", "!**/*.integ.spec.ts"], +}; diff --git a/private/aws-echo-service/package.json b/private/aws-echo-service/package.json new file mode 100644 index 000000000000..eec81b40fd99 --- /dev/null +++ b/private/aws-echo-service/package.json @@ -0,0 +1,94 @@ +{ + "name": "@aws-sdk/aws-echo-service", + "description": "@aws-sdk/aws-echo-service client", + "version": "1.0.0-alpha.1", + "scripts": { + "build": "yarn build:cjs && yarn build:es && yarn build:types", + "build:cjs": "tsc -p tsconfig.json", + "build:docs": "yarn clean:docs && typedoc ./", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "clean": "yarn clean:dist && yarn clean:docs", + "clean:dist": "rimraf ./dist-*", + "clean:docs": "rimraf ./docs", + "downlevel-dts": "downlevel-dts dist-types dist-types/ts3.4", + "test": "jest --coverage --passWithNoTests" + }, + "main": "./dist-cjs/index.js", + "types": "./dist-types/index.d.ts", + "module": "./dist-es/index.js", + "sideEffects": false, + "dependencies": { + "@aws-crypto/sha256-browser": "^1.1.0", + "@aws-crypto/sha256-js": "^1.1.0", + "@aws-sdk/config-resolver": "3.38.0", + "@aws-sdk/fetch-http-handler": "3.38.0", + "@aws-sdk/hash-node": "3.38.0", + "@aws-sdk/invalid-dependency": "3.38.0", + "@aws-sdk/middleware-content-length": "3.38.0", + "@aws-sdk/middleware-host-header": "3.38.0", + "@aws-sdk/middleware-logger": "3.38.0", + "@aws-sdk/middleware-retry": "3.38.0", + "@aws-sdk/middleware-serde": "3.38.0", + "@aws-sdk/middleware-stack": "3.38.0", + "@aws-sdk/middleware-user-agent": "3.38.0", + "@aws-sdk/node-config-provider": "3.38.0", + "@aws-sdk/node-http-handler": "3.38.0", + "@aws-sdk/protocol-http": "3.38.0", + "@aws-sdk/smithy-client": "3.38.0", + "@aws-sdk/types": "3.38.0", + "@aws-sdk/url-parser": "3.38.0", + "@aws-sdk/util-base64-browser": "3.37.0", + "@aws-sdk/util-base64-node": "3.37.0", + "@aws-sdk/util-body-length-browser": "3.37.0", + "@aws-sdk/util-body-length-node": "3.37.0", + "@aws-sdk/util-user-agent-browser": "3.38.0", + "@aws-sdk/util-user-agent-node": "3.38.0", + "@aws-sdk/util-utf8-browser": "3.37.0", + "@aws-sdk/util-utf8-node": "3.37.0", + "tslib": "^2.3.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "3.38.0", + "@types/node": "^12.7.5", + "@types/uuid": "^8.3.0", + "downlevel-dts": "0.7.0", + "jest": "^26.1.0", + "rimraf": "^3.0.0", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=10.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0", + "browser": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + "private": true, + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/aws-echo-service", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "clients/aws-echo-service" + } +} diff --git a/private/aws-echo-service/src/EchoService.ts b/private/aws-echo-service/src/EchoService.ts new file mode 100644 index 000000000000..784137ea54c0 --- /dev/null +++ b/private/aws-echo-service/src/EchoService.ts @@ -0,0 +1,52 @@ +import { EchoServiceClient } from "./EchoServiceClient"; +import { EchoCommand, EchoCommandInput, EchoCommandOutput } from "./commands/EchoCommand"; +import { LengthCommand, LengthCommandInput, LengthCommandOutput } from "./commands/LengthCommand"; +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +export class EchoService extends EchoServiceClient { + public echo(args: EchoCommandInput, options?: __HttpHandlerOptions): Promise; + public echo(args: EchoCommandInput, cb: (err: any, data?: EchoCommandOutput) => void): void; + public echo( + args: EchoCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: EchoCommandOutput) => void + ): void; + public echo( + args: EchoCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EchoCommandOutput) => void), + cb?: (err: any, data?: EchoCommandOutput) => void + ): Promise | void { + const command = new EchoCommand(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 length(args: LengthCommandInput, options?: __HttpHandlerOptions): Promise; + public length(args: LengthCommandInput, cb: (err: any, data?: LengthCommandOutput) => void): void; + public length( + args: LengthCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: LengthCommandOutput) => void + ): void; + public length( + args: LengthCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: LengthCommandOutput) => void), + cb?: (err: any, data?: LengthCommandOutput) => void + ): Promise | void { + const command = new LengthCommand(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); + } + } +} diff --git a/private/aws-echo-service/src/EchoServiceClient.ts b/private/aws-echo-service/src/EchoServiceClient.ts new file mode 100644 index 000000000000..19a591c790ee --- /dev/null +++ b/private/aws-echo-service/src/EchoServiceClient.ts @@ -0,0 +1,193 @@ +import { EchoCommandInput, EchoCommandOutput } from "./commands/EchoCommand"; +import { LengthCommandInput, LengthCommandOutput } from "./commands/LengthCommand"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; +import { + CustomEndpointsInputConfig, + CustomEndpointsResolvedConfig, + resolveCustomEndpointsConfig, +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + HostHeaderInputConfig, + HostHeaderResolvedConfig, + getHostHeaderPlugin, + resolveHostHeaderConfig, +} from "@aws-sdk/middleware-host-header"; +import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; +import { RetryInputConfig, RetryResolvedConfig, getRetryPlugin, resolveRetryConfig } from "@aws-sdk/middleware-retry"; +import { + UserAgentInputConfig, + UserAgentResolvedConfig, + getUserAgentPlugin, + resolveUserAgentConfig, +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration, +} from "@aws-sdk/smithy-client"; +import { + Provider, + Decoder as __Decoder, + Encoder as __Encoder, + Hash as __Hash, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Logger as __Logger, + Provider as __Provider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser, + UserAgent as __UserAgent, +} from "@aws-sdk/types"; + +export type ServiceInputTypes = EchoCommandInput | LengthCommandInput; + +export type ServiceOutputTypes = EchoCommandOutput | LengthCommandOutput; + +export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the {@link __Hash} interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + * @internal + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + * @internal + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + * @internal + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + * @internal + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array. + * @internal + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string. + * @internal + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array. + * @internal + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string. + * @internal + */ + utf8Encoder?: __Encoder; + + /** + * The runtime environment. + * @internal + */ + runtime?: string; + + /** + * Disable dyanamically changing the endpoint of the client based on the hostPrefix + * trait of an operation. + */ + disableHostPrefix?: boolean; + + /** + * Value for how many times a request will be made at most in case of retry. + */ + maxAttempts?: number | __Provider; + + /** + * Specifies which retry algorithm to use. + */ + retryMode?: string | __Provider; + + /** + * Optional logger for logging debug/info/warn/error. + */ + logger?: __Logger; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; +} + +type EchoServiceClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & + ClientDefaults & + CustomEndpointsInputConfig & + RetryInputConfig & + HostHeaderInputConfig & + UserAgentInputConfig; +/** + * The configuration interface of EchoServiceClient class constructor that set the region, credentials and other options. + */ +export interface EchoServiceClientConfig extends EchoServiceClientConfigType {} + +type EchoServiceClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & + Required & + CustomEndpointsResolvedConfig & + RetryResolvedConfig & + HostHeaderResolvedConfig & + UserAgentResolvedConfig; +/** + * The resolved configuration interface of EchoServiceClient class. This is resolved and normalized from the {@link EchoServiceClientConfig | constructor configuration interface}. + */ +export interface EchoServiceClientResolvedConfig extends EchoServiceClientResolvedConfigType {} + +export class EchoServiceClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + EchoServiceClientResolvedConfig +> { + /** + * The resolved configuration of EchoServiceClient class. This is resolved and normalized from the {@link EchoServiceClientConfig | constructor configuration interface}. + */ + readonly config: EchoServiceClientResolvedConfig; + + constructor(configuration: EchoServiceClientConfig) { + let _config_0 = __getRuntimeConfig(configuration); + let _config_1 = resolveCustomEndpointsConfig(_config_0); + let _config_2 = resolveRetryConfig(_config_1); + let _config_3 = resolveHostHeaderConfig(_config_2); + let _config_4 = resolveUserAgentConfig(_config_3); + super(_config_4); + this.config = _config_4; + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + this.middlewareStack.use(getLoggerPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + } + + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy(): void { + super.destroy(); + } +} diff --git a/private/aws-echo-service/src/commands/EchoCommand.ts b/private/aws-echo-service/src/commands/EchoCommand.ts new file mode 100644 index 000000000000..8752be33e3a2 --- /dev/null +++ b/private/aws-echo-service/src/commands/EchoCommand.ts @@ -0,0 +1,70 @@ +import { EchoServiceClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EchoServiceClient"; +import { EchoInput, EchoOutput } from "../models/models_0"; +import { deserializeAws_restJson1EchoCommand, serializeAws_restJson1EchoCommand } from "../protocols/Aws_restJson1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +export interface EchoCommandInput extends EchoInput {} +export interface EchoCommandOutput extends EchoOutput, __MetadataBearer {} + +export class EchoCommand extends $Command { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: EchoCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: EchoServiceClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "EchoServiceClient"; + const commandName = "EchoCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: EchoInput.filterSensitiveLog, + outputFilterSensitiveLog: EchoOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: EchoCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1EchoCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1EchoCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/private/aws-echo-service/src/commands/LengthCommand.ts b/private/aws-echo-service/src/commands/LengthCommand.ts new file mode 100644 index 000000000000..a673472770b9 --- /dev/null +++ b/private/aws-echo-service/src/commands/LengthCommand.ts @@ -0,0 +1,70 @@ +import { EchoServiceClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EchoServiceClient"; +import { LengthInput, LengthOutput } from "../models/models_0"; +import { deserializeAws_restJson1LengthCommand, serializeAws_restJson1LengthCommand } from "../protocols/Aws_restJson1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +export interface LengthCommandInput extends LengthInput {} +export interface LengthCommandOutput extends LengthOutput, __MetadataBearer {} + +export class LengthCommand extends $Command { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: LengthCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: EchoServiceClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "EchoServiceClient"; + const commandName = "LengthCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: LengthInput.filterSensitiveLog, + outputFilterSensitiveLog: LengthOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: LengthCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1LengthCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1LengthCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/private/aws-echo-service/src/commands/index.ts b/private/aws-echo-service/src/commands/index.ts new file mode 100644 index 000000000000..38c600c91649 --- /dev/null +++ b/private/aws-echo-service/src/commands/index.ts @@ -0,0 +1,2 @@ +export * from "./EchoCommand"; +export * from "./LengthCommand"; diff --git a/private/aws-echo-service/src/index.ts b/private/aws-echo-service/src/index.ts new file mode 100644 index 000000000000..2f1437b1cbb1 --- /dev/null +++ b/private/aws-echo-service/src/index.ts @@ -0,0 +1,4 @@ +export * from "./EchoServiceClient"; +export * from "./EchoService"; +export * from "./commands"; +export * from "./models"; diff --git a/private/aws-echo-service/src/models/index.ts b/private/aws-echo-service/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/private/aws-echo-service/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/private/aws-echo-service/src/models/models_0.ts b/private/aws-echo-service/src/models/models_0.ts new file mode 100644 index 000000000000..b33e05e91c25 --- /dev/null +++ b/private/aws-echo-service/src/models/models_0.ts @@ -0,0 +1,71 @@ +import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types"; + +export interface EchoInput { + string?: string; +} + +export namespace EchoInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EchoInput): any => ({ + ...obj, + }); +} + +export interface EchoOutput { + string?: string; +} + +export namespace EchoOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EchoOutput): any => ({ + ...obj, + }); +} + +/** + * For some reason, this service does not like palindromes! + */ +export interface PalindromeException extends __SmithyException, $MetadataBearer { + name: "PalindromeException"; + $fault: "client"; + message?: string; +} + +export namespace PalindromeException { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PalindromeException): any => ({ + ...obj, + }); +} + +export interface LengthInput { + string: string | undefined; +} + +export namespace LengthInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: LengthInput): any => ({ + ...obj, + }); +} + +export interface LengthOutput { + length?: number; +} + +export namespace LengthOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: LengthOutput): any => ({ + ...obj, + }); +} diff --git a/private/aws-echo-service/src/protocols/Aws_restJson1.ts b/private/aws-echo-service/src/protocols/Aws_restJson1.ts new file mode 100644 index 000000000000..9e51c017d0ce --- /dev/null +++ b/private/aws-echo-service/src/protocols/Aws_restJson1.ts @@ -0,0 +1,265 @@ +import { EchoCommandInput, EchoCommandOutput } from "../commands/EchoCommand"; +import { LengthCommandInput, LengthCommandOutput } from "../commands/LengthCommand"; +import { PalindromeException } from "../models/models_0"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; +import { + expectInt32 as __expectInt32, + expectNonNull as __expectNonNull, + expectObject as __expectObject, + expectString as __expectString, + extendedEncodeURIComponent as __extendedEncodeURIComponent, +} from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, + SmithyException as __SmithyException, +} from "@aws-sdk/types"; +import { v4 as generateIdempotencyToken } from "uuid"; + +export const serializeAws_restJson1EchoCommand = async ( + input: EchoCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/echo"; + let body: any; + body = JSON.stringify({ + ...(input.string !== undefined && input.string !== null && { string: input.string }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + +export const serializeAws_restJson1LengthCommand = async ( + input: LengthCommandInput, + 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 || ""}` + "/length/{string}"; + if (input.string !== undefined) { + const labelValue: string = input.string; + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: string."); + } + resolvedPath = resolvedPath.replace("{string}", __extendedEncodeURIComponent(labelValue)); + } else { + throw new Error("No value provided for input HTTP label: string."); + } + let body: any; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + +export const deserializeAws_restJson1EchoCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1EchoCommandError(output, context); + } + const contents: EchoCommandOutput = { + $metadata: deserializeMetadata(output), + string: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.string !== undefined && data.string !== null) { + contents.string = __expectString(data.string); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1EchoCommandError = 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: string = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "PalindromeException": + case "aws.test.generic#PalindromeException": + response = { + ...(await deserializeAws_restJson1PalindromeExceptionResponse(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_restJson1LengthCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1LengthCommandError(output, context); + } + const contents: LengthCommandOutput = { + $metadata: deserializeMetadata(output), + length: undefined, + }; + const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + if (data.length !== undefined && data.length !== null) { + contents.length = __expectInt32(data.length); + } + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1LengthCommandError = 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: string = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "PalindromeException": + case "aws.test.generic#PalindromeException": + response = { + ...(await deserializeAws_restJson1PalindromeExceptionResponse(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)); +}; + +const deserializeAws_restJson1PalindromeExceptionResponse = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: PalindromeException = { + name: "PalindromeException", + $fault: "client", + $metadata: deserializeMetadata(parsedOutput), + message: undefined, + }; + const data: any = parsedOutput.body; + if (data.message !== undefined && data.message !== null) { + contents.message = __expectString(data.message); + } + return contents; +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"], +}); + +// Collect low-level response body stream to Uint8Array. +const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => { + if (streamBody instanceof Uint8Array) { + return Promise.resolve(streamBody); + } + return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array()); +}; + +// Encode Uint8Array data into string with utf-8. +const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => + collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); + +const isSerializableHeaderValue = (value: any): boolean => + value !== undefined && + value !== null && + value !== "" && + (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && + (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); + +const parseBody = (streamBody: any, context: __SerdeContext): any => + collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { + return JSON.parse(encoded); + } + return {}; + }); + +/** + * Load an error code for the aws.rest-json-1.1 protocol. + */ +const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => { + const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + + const sanitizeErrorCode = (rawValue: string): string => { + let cleanValue = rawValue; + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== undefined) { + return sanitizeErrorCode(output.headers[headerKey]); + } + + if (data.code !== undefined) { + return sanitizeErrorCode(data.code); + } + + if (data["__type"] !== undefined) { + return sanitizeErrorCode(data["__type"]); + } + + return ""; +}; diff --git a/private/aws-echo-service/src/runtimeConfig.browser.ts b/private/aws-echo-service/src/runtimeConfig.browser.ts new file mode 100644 index 000000000000..3ae8628dd97b --- /dev/null +++ b/private/aws-echo-service/src/runtimeConfig.browser.ts @@ -0,0 +1,36 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; +import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { EchoServiceClientConfig } from "./EchoServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EchoServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "browser", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? defaultUserAgent({ clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config?.requestHandler ?? new FetchHttpHandler(), + retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config?.sha256 ?? Sha256, + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/private/aws-echo-service/src/runtimeConfig.native.ts b/private/aws-echo-service/src/runtimeConfig.native.ts new file mode 100644 index 000000000000..73ebbdf4be1a --- /dev/null +++ b/private/aws-echo-service/src/runtimeConfig.native.ts @@ -0,0 +1,16 @@ +import { Sha256 } from "@aws-crypto/sha256-js"; +import { EchoServiceClientConfig } from "./EchoServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EchoServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + ...config, + runtime: "react-native", + sha256: config?.sha256 ?? Sha256, + }; +}; diff --git a/private/aws-echo-service/src/runtimeConfig.shared.ts b/private/aws-echo-service/src/runtimeConfig.shared.ts new file mode 100644 index 000000000000..b692db5fdf72 --- /dev/null +++ b/private/aws-echo-service/src/runtimeConfig.shared.ts @@ -0,0 +1,13 @@ +import { Logger as __Logger } from "@aws-sdk/types"; +import { parseUrl } from "@aws-sdk/url-parser"; +import { EchoServiceClientConfig } from "./EchoServiceClient"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EchoServiceClientConfig) => ({ + apiVersion: "2018-05-10", + disableHostPrefix: config?.disableHostPrefix ?? false, + logger: config?.logger ?? ({} as __Logger), + urlParser: config?.urlParser ?? parseUrl, +}); diff --git a/private/aws-echo-service/src/runtimeConfig.ts b/private/aws-echo-service/src/runtimeConfig.ts new file mode 100644 index 000000000000..6de63577e8b3 --- /dev/null +++ b/private/aws-echo-service/src/runtimeConfig.ts @@ -0,0 +1,39 @@ +// @ts-ignore: package.json will be imported from dist folders +import packageInfo from "../package.json"; // eslint-disable-line + +import { Hash } from "@aws-sdk/hash-node"; +import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; +import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; +import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { EchoServiceClientConfig } from "./EchoServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; +import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client"; + +/** + * @internal + */ +export const getRuntimeConfig = (config: EchoServiceClientConfig) => { + emitWarningIfUnsupportedVersion(process.version); + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + ...config, + runtime: "node", + base64Decoder: config?.base64Decoder ?? fromBase64, + base64Encoder: config?.base64Encoder ?? toBase64, + bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config?.defaultUserAgentProvider ?? defaultUserAgent({ clientVersion: packageInfo.version }), + maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config?.requestHandler ?? new NodeHttpHandler(), + retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config?.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? streamCollector, + utf8Decoder: config?.utf8Decoder ?? fromUtf8, + utf8Encoder: config?.utf8Encoder ?? toUtf8, + }; +}; diff --git a/private/aws-echo-service/tsconfig.es.json b/private/aws-echo-service/tsconfig.es.json new file mode 100644 index 000000000000..4c72364cd1a0 --- /dev/null +++ b/private/aws-echo-service/tsconfig.es.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"], + "outDir": "dist-es" + } +} diff --git a/private/aws-echo-service/tsconfig.json b/private/aws-echo-service/tsconfig.json new file mode 100644 index 000000000000..093039289c53 --- /dev/null +++ b/private/aws-echo-service/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "rootDir": "./src", + "alwaysStrict": true, + "target": "ES2018", + "module": "commonjs", + "strict": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "outDir": "dist-cjs", + "removeComments": true + }, + "typedocOptions": { + "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"], + "excludeNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true, + "stripInternal": true, + "readme": "README.md", + "mode": "file", + "out": "docs", + "theme": "minimal", + "plugin": ["@aws-sdk/service-client-documentation-generator"] + }, + "exclude": ["test/**/*"] +} diff --git a/private/aws-echo-service/tsconfig.types.json b/private/aws-echo-service/tsconfig.types.json new file mode 100644 index 000000000000..4c3dfa7b3d25 --- /dev/null +++ b/private/aws-echo-service/tsconfig.types.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "removeComments": false, + "declaration": true, + "declarationDir": "dist-types", + "emitDeclarationOnly": true + }, + "exclude": ["test/**/*", "dist-types/**/*"] +} From f062490afe8c14d9bab1876d2ff03f56c5824723 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:37:23 +0000 Subject: [PATCH 11/11] chore(aws-echo-service): update @aws-crypto/* deps --- private/aws-echo-service/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/private/aws-echo-service/package.json b/private/aws-echo-service/package.json index eec81b40fd99..98f965e50687 100644 --- a/private/aws-echo-service/package.json +++ b/private/aws-echo-service/package.json @@ -19,8 +19,8 @@ "module": "./dist-es/index.js", "sideEffects": false, "dependencies": { - "@aws-crypto/sha256-browser": "^1.1.0", - "@aws-crypto/sha256-js": "^1.1.0", + "@aws-crypto/sha256-browser": "2.0.0", + "@aws-crypto/sha256-js": "2.0.0", "@aws-sdk/config-resolver": "3.38.0", "@aws-sdk/fetch-http-handler": "3.38.0", "@aws-sdk/hash-node": "3.38.0",