diff --git a/private/aws-restjson-server/.gitignore b/private/aws-restjson-server/.gitignore new file mode 100644 index 000000000000..54f14c9aef25 --- /dev/null +++ b/private/aws-restjson-server/.gitignore @@ -0,0 +1,9 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/dist-* +*.tsbuildinfo +*.tgz +*.log +package-lock.json diff --git a/private/aws-restjson-server/LICENSE b/private/aws-restjson-server/LICENSE new file mode 100644 index 000000000000..8efcd8d5c5b7 --- /dev/null +++ b/private/aws-restjson-server/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-2022 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-restjson-server/jest.config.js b/private/aws-restjson-server/jest.config.js new file mode 100644 index 000000000000..1c8ba8ea6c77 --- /dev/null +++ b/private/aws-restjson-server/jest.config.js @@ -0,0 +1,10 @@ +const base = require("../../jest.config.base.js"); + +module.exports = { + ...base, + globals: { + "ts-jest": { + isolatedModules: true, + }, + }, +}; diff --git a/private/aws-restjson-server/package.json b/private/aws-restjson-server/package.json new file mode 100644 index 000000000000..fa1c50ffbe97 --- /dev/null +++ b/private/aws-restjson-server/package.json @@ -0,0 +1,76 @@ +{ + "name": "@aws-sdk/aws-restjson-server", + "description": "@aws-sdk/aws-restjson-server client", + "version": "1.0.0-alpha.1", + "scripts": { + "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "tsc -p tsconfig.cjs.json", + "build:docs": "typedoc", + "build:es": "tsc -p tsconfig.es.json", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + "clean": "rimraf ./dist-*", + "prepack": "yarn clean && yarn build", + "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": "*", + "@aws-sdk/fetch-http-handler": "*", + "@aws-sdk/hash-node": "*", + "@aws-sdk/invalid-dependency": "*", + "@aws-sdk/middleware-content-length": "*", + "@aws-sdk/middleware-retry": "*", + "@aws-sdk/middleware-serde": "*", + "@aws-sdk/middleware-stack": "*", + "@aws-sdk/node-http-handler": "*", + "@aws-sdk/protocol-http": "*", + "@aws-sdk/smithy-client": "*", + "@aws-sdk/types": "*", + "@aws-sdk/url-parser": "*", + "@aws-sdk/util-base64-browser": "*", + "@aws-sdk/util-base64-node": "*", + "@aws-sdk/util-body-length-browser": "*", + "@aws-sdk/util-body-length-node": "*", + "@aws-sdk/util-defaults-mode-browser": "*", + "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-utf8-browser": "*", + "@aws-sdk/util-utf8-node": "*", + "@aws-smithy/server-common": "1.0.0-alpha.4", + "tslib": "^2.3.0" + }, + "devDependencies": { + "@aws-sdk/service-client-documentation-generator": "*", + "@tsconfig/recommended": "1.0.1", + "@types/node": "^12.7.5", + "concurrently": "7.0.0", + "downlevel-dts": "0.7.0", + "rimraf": "3.0.2", + "typedoc": "0.19.2", + "typescript": "~4.3.5" + }, + "engines": { + "node": ">=12.0.0" + }, + "typesVersions": { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + "files": [ + "dist-*" + ], + "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/private/aws-restjson-server", + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-js-v3.git", + "directory": "private/aws-restjson-server" + } +} diff --git a/private/aws-restjson-server/src/index.ts b/private/aws-restjson-server/src/index.ts new file mode 100644 index 000000000000..6b4c4caf0137 --- /dev/null +++ b/private/aws-restjson-server/src/index.ts @@ -0,0 +1,3 @@ +export * from "./models"; +export * as Aws_restJson1 from "./protocols/Aws_restJson1"; +export * from "./server/index"; diff --git a/private/aws-restjson-server/src/models/index.ts b/private/aws-restjson-server/src/models/index.ts new file mode 100644 index 000000000000..09c5d6e09b8c --- /dev/null +++ b/private/aws-restjson-server/src/models/index.ts @@ -0,0 +1 @@ +export * from "./models_0"; diff --git a/private/aws-restjson-server/src/models/models_0.ts b/private/aws-restjson-server/src/models/models_0.ts new file mode 100644 index 000000000000..1c11c85a5731 --- /dev/null +++ b/private/aws-restjson-server/src/models/models_0.ts @@ -0,0 +1,4982 @@ +import { + ExceptionOptionType as __ExceptionOptionType, + LazyJsonString as __LazyJsonString, +} from "@aws-sdk/smithy-client"; +import { DocumentType as __DocumentType, MetadataBearer as $MetadataBearer } from "@aws-sdk/types"; +import { + CompositeCollectionValidator as __CompositeCollectionValidator, + CompositeMapValidator as __CompositeMapValidator, + CompositeStructureValidator as __CompositeStructureValidator, + CompositeValidator as __CompositeValidator, + EnumValidator as __EnumValidator, + MultiConstraintValidator as __MultiConstraintValidator, + NoOpValidator as __NoOpValidator, + RequiredValidator as __RequiredValidator, + ServiceException as __BaseException, + ValidationFailure as __ValidationFailure, +} from "@aws-smithy/server-common"; +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, + }); + const memberValidators: { + queryString?: __MultiConstraintValidator; + queryStringList?: __MultiConstraintValidator>; + queryStringSet?: __MultiConstraintValidator>; + queryByte?: __MultiConstraintValidator; + queryShort?: __MultiConstraintValidator; + queryInteger?: __MultiConstraintValidator; + queryIntegerList?: __MultiConstraintValidator>; + queryIntegerSet?: __MultiConstraintValidator>; + queryLong?: __MultiConstraintValidator; + queryFloat?: __MultiConstraintValidator; + queryDouble?: __MultiConstraintValidator; + queryDoubleList?: __MultiConstraintValidator>; + queryBoolean?: __MultiConstraintValidator; + queryBooleanList?: __MultiConstraintValidator>; + queryTimestamp?: __MultiConstraintValidator; + queryTimestampList?: __MultiConstraintValidator>; + queryEnum?: __MultiConstraintValidator; + queryEnumList?: __MultiConstraintValidator>; + queryParamsMapOfStringList?: __MultiConstraintValidator<{ [key: string]: string[] }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: AllQueryStringTypesInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "queryString": { + memberValidators["queryString"] = new __NoOpValidator(); + break; + } + case "queryStringList": { + memberValidators["queryStringList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryStringSet": { + memberValidators["queryStringSet"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryByte": { + memberValidators["queryByte"] = new __NoOpValidator(); + break; + } + case "queryShort": { + memberValidators["queryShort"] = new __NoOpValidator(); + break; + } + case "queryInteger": { + memberValidators["queryInteger"] = new __NoOpValidator(); + break; + } + case "queryIntegerList": { + memberValidators["queryIntegerList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryIntegerSet": { + memberValidators["queryIntegerSet"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryLong": { + memberValidators["queryLong"] = new __NoOpValidator(); + break; + } + case "queryFloat": { + memberValidators["queryFloat"] = new __NoOpValidator(); + break; + } + case "queryDouble": { + memberValidators["queryDouble"] = new __NoOpValidator(); + break; + } + case "queryDoubleList": { + memberValidators["queryDoubleList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryBoolean": { + memberValidators["queryBoolean"] = new __NoOpValidator(); + break; + } + case "queryBooleanList": { + memberValidators["queryBooleanList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryTimestamp": { + memberValidators["queryTimestamp"] = new __NoOpValidator(); + break; + } + case "queryTimestampList": { + memberValidators["queryTimestampList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "queryEnum": { + memberValidators["queryEnum"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "queryEnumList": { + memberValidators["queryEnumList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + case "queryParamsMapOfStringList": { + memberValidators["queryParamsMapOfStringList"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeCollectionValidator(new __NoOpValidator(), new __NoOpValidator()) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("queryString").validate(obj.queryString, `${path}/queryString`), + ...getMemberValidator("queryStringList").validate(obj.queryStringList, `${path}/queryStringList`), + ...getMemberValidator("queryStringSet").validate(obj.queryStringSet, `${path}/queryStringSet`), + ...getMemberValidator("queryByte").validate(obj.queryByte, `${path}/queryByte`), + ...getMemberValidator("queryShort").validate(obj.queryShort, `${path}/queryShort`), + ...getMemberValidator("queryInteger").validate(obj.queryInteger, `${path}/queryInteger`), + ...getMemberValidator("queryIntegerList").validate(obj.queryIntegerList, `${path}/queryIntegerList`), + ...getMemberValidator("queryIntegerSet").validate(obj.queryIntegerSet, `${path}/queryIntegerSet`), + ...getMemberValidator("queryLong").validate(obj.queryLong, `${path}/queryLong`), + ...getMemberValidator("queryFloat").validate(obj.queryFloat, `${path}/queryFloat`), + ...getMemberValidator("queryDouble").validate(obj.queryDouble, `${path}/queryDouble`), + ...getMemberValidator("queryDoubleList").validate(obj.queryDoubleList, `${path}/queryDoubleList`), + ...getMemberValidator("queryBoolean").validate(obj.queryBoolean, `${path}/queryBoolean`), + ...getMemberValidator("queryBooleanList").validate(obj.queryBooleanList, `${path}/queryBooleanList`), + ...getMemberValidator("queryTimestamp").validate(obj.queryTimestamp, `${path}/queryTimestamp`), + ...getMemberValidator("queryTimestampList").validate(obj.queryTimestampList, `${path}/queryTimestampList`), + ...getMemberValidator("queryEnum").validate(obj.queryEnum, `${path}/queryEnum`), + ...getMemberValidator("queryEnumList").validate(obj.queryEnumList, `${path}/queryEnumList`), + ...getMemberValidator("queryParamsMapOfStringList").validate( + obj.queryParamsMapOfStringList, + `${path}/queryParamsMapOfStringList` + ), + ]; + }; +} + +export interface ComplexNestedErrorData { + Foo?: string; +} + +export namespace ComplexNestedErrorData { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ComplexNestedErrorData): any => ({ + ...obj, + }); + const memberValidators: { + Foo?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: ComplexNestedErrorData, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "Foo": { + memberValidators["Foo"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("Foo").validate(obj.Foo, `${path}/Foo`)]; + }; +} + +/** + * This error is thrown when a request is invalid. + */ +export class ComplexError extends __BaseException { + readonly name: "ComplexError" = "ComplexError"; + readonly $fault: "client" = "client"; + Header?: string; + TopLevel?: string; + Nested?: ComplexNestedErrorData; + constructor(opts: __ExceptionOptionType) { + super({ + name: "ComplexError", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ComplexError.prototype); + this.Header = opts.Header; + this.TopLevel = opts.TopLevel; + this.Nested = opts.Nested; + } +} + +export interface ConstantAndVariableQueryStringInput { + baz?: string; + maybeSet?: string; +} + +export namespace ConstantAndVariableQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantAndVariableQueryStringInput): any => ({ + ...obj, + }); + const memberValidators: { + baz?: __MultiConstraintValidator; + maybeSet?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: ConstantAndVariableQueryStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "baz": { + memberValidators["baz"] = new __NoOpValidator(); + break; + } + case "maybeSet": { + memberValidators["maybeSet"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("baz").validate(obj.baz, `${path}/baz`), + ...getMemberValidator("maybeSet").validate(obj.maybeSet, `${path}/maybeSet`), + ]; + }; +} + +export interface ConstantQueryStringInput { + hello: string | undefined; +} + +export namespace ConstantQueryStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: ConstantQueryStringInput): any => ({ + ...obj, + }); + const memberValidators: { + hello?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: ConstantQueryStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "hello": { + memberValidators["hello"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("hello").validate(obj.hello, `${path}/hello`)]; + }; +} + +export interface GreetingStruct { + hi?: string; +} + +export namespace GreetingStruct { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingStruct): any => ({ + ...obj, + }); + const memberValidators: { + hi?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: GreetingStruct, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "hi": { + memberValidators["hi"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("hi").validate(obj.hi, `${path}/hi`)]; + }; +} + +export interface DocumentTypeInputOutput { + stringValue?: string; + documentValue?: __DocumentType; +} + +export namespace DocumentTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: DocumentTypeInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + stringValue?: __MultiConstraintValidator; + documentValue?: __MultiConstraintValidator<__DocumentType>; + } = {}; + /** + * @internal + */ + export const validate = (obj: DocumentTypeInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "stringValue": { + memberValidators["stringValue"] = new __NoOpValidator(); + break; + } + case "documentValue": { + memberValidators["documentValue"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("stringValue").validate(obj.stringValue, `${path}/stringValue`), + ...getMemberValidator("documentValue").validate(obj.documentValue, `${path}/documentValue`), + ]; + }; +} + +export interface DocumentTypeAsPayloadInputOutput { + documentValue?: __DocumentType; +} + +export namespace DocumentTypeAsPayloadInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: DocumentTypeAsPayloadInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + documentValue?: __MultiConstraintValidator<__DocumentType>; + } = {}; + /** + * @internal + */ + export const validate = (obj: DocumentTypeAsPayloadInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "documentValue": { + memberValidators["documentValue"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("documentValue").validate(obj.documentValue, `${path}/documentValue`)]; + }; +} + +export interface EmptyInputAndEmptyOutputInput {} + +export namespace EmptyInputAndEmptyOutputInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputInput): any => ({ + ...obj, + }); + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: EmptyInputAndEmptyOutputInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + +export interface EmptyInputAndEmptyOutputOutput {} + +export namespace EmptyInputAndEmptyOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EmptyInputAndEmptyOutputOutput): any => ({ + ...obj, + }); + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: EmptyInputAndEmptyOutputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + +export interface HostLabelInput { + label: string | undefined; +} + +export namespace HostLabelInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HostLabelInput): any => ({ + ...obj, + }); + const memberValidators: { + label?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HostLabelInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "label": { + memberValidators["label"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("label").validate(obj.label, `${path}/label`)]; + }; +} + +export enum StringEnum { + V = "enumvalue", +} + +export interface EnumPayloadInput { + payload?: StringEnum | string; +} + +export namespace EnumPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: EnumPayloadInput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: EnumPayloadInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __CompositeValidator([new __EnumValidator(["enumvalue"])]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +/** + * 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 class FooError extends __BaseException { + readonly name: "FooError" = "FooError"; + readonly $fault: "server" = "server"; + constructor(opts: __ExceptionOptionType) { + super({ + name: "FooError", + $fault: "server", + ...opts, + }); + Object.setPrototypeOf(this, FooError.prototype); + } +} + +export interface GreetingWithErrorsOutput { + greeting?: string; +} + +export namespace GreetingWithErrorsOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: GreetingWithErrorsOutput): any => ({ + ...obj, + }); + const memberValidators: { + greeting?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: GreetingWithErrorsOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "greeting": { + memberValidators["greeting"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("greeting").validate(obj.greeting, `${path}/greeting`)]; + }; +} + +/** + * This error is thrown when an invalid greeting value is provided. + */ +export class InvalidGreeting extends __BaseException { + readonly name: "InvalidGreeting" = "InvalidGreeting"; + readonly $fault: "client" = "client"; + Message?: string; + constructor(opts: __ExceptionOptionType) { + super({ + name: "InvalidGreeting", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, InvalidGreeting.prototype); + this.Message = opts.Message; + } +} + +export interface HttpChecksumRequiredInputOutput { + foo?: string; +} + +export namespace HttpChecksumRequiredInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpChecksumRequiredInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpChecksumRequiredInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("foo").validate(obj.foo, `${path}/foo`)]; + }; +} + +export interface HttpPayloadTraitsInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPayloadTraitsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("blob").validate(obj.blob, `${path}/blob`), + ]; + }; +} + +export interface HttpPayloadTraitsWithMediaTypeInputOutput { + foo?: string; + blob?: Uint8Array; +} + +export namespace HttpPayloadTraitsWithMediaTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadTraitsWithMediaTypeInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPayloadTraitsWithMediaTypeInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("blob").validate(obj.blob, `${path}/blob`), + ]; + }; +} + +export interface NestedPayload { + greeting?: string; + name?: string; +} + +export namespace NestedPayload { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NestedPayload): any => ({ + ...obj, + }); + const memberValidators: { + greeting?: __MultiConstraintValidator; + name?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: NestedPayload, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "greeting": { + memberValidators["greeting"] = new __NoOpValidator(); + break; + } + case "name": { + memberValidators["name"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("greeting").validate(obj.greeting, `${path}/greeting`), + ...getMemberValidator("name").validate(obj.name, `${path}/name`), + ]; + }; +} + +export interface HttpPayloadWithStructureInputOutput { + nested?: NestedPayload; +} + +export namespace HttpPayloadWithStructureInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPayloadWithStructureInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + nested?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPayloadWithStructureInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "nested": { + memberValidators["nested"] = new __CompositeStructureValidator( + new __NoOpValidator(), + NestedPayload.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("nested").validate(obj.nested, `${path}/nested`)]; + }; +} + +export interface HttpPrefixHeadersInput { + foo?: string; + fooMap?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersInput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + fooMap?: __MultiConstraintValidator<{ [key: string]: string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPrefixHeadersInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "fooMap": { + memberValidators["fooMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("fooMap").validate(obj.fooMap, `${path}/fooMap`), + ]; + }; +} + +export interface HttpPrefixHeadersOutput { + foo?: string; + fooMap?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + fooMap?: __MultiConstraintValidator<{ [key: string]: string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPrefixHeadersOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "fooMap": { + memberValidators["fooMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("fooMap").validate(obj.fooMap, `${path}/fooMap`), + ]; + }; +} + +export interface HttpPrefixHeadersInResponseInput {} + +export namespace HttpPrefixHeadersInResponseInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersInResponseInput): any => ({ + ...obj, + }); + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: HttpPrefixHeadersInResponseInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + +export interface HttpPrefixHeadersInResponseOutput { + prefixHeaders?: { [key: string]: string }; +} + +export namespace HttpPrefixHeadersInResponseOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpPrefixHeadersInResponseOutput): any => ({ + ...obj, + }); + const memberValidators: { + prefixHeaders?: __MultiConstraintValidator<{ [key: string]: string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpPrefixHeadersInResponseOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "prefixHeaders": { + memberValidators["prefixHeaders"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("prefixHeaders").validate(obj.prefixHeaders, `${path}/prefixHeaders`)]; + }; +} + +export interface HttpRequestWithFloatLabelsInput { + float: number | undefined; + double: number | undefined; +} + +export namespace HttpRequestWithFloatLabelsInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithFloatLabelsInput): any => ({ + ...obj, + }); + const memberValidators: { + float?: __MultiConstraintValidator; + double?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpRequestWithFloatLabelsInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "float": { + memberValidators["float"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "double": { + memberValidators["double"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("float").validate(obj.float, `${path}/float`), + ...getMemberValidator("double").validate(obj.double, `${path}/double`), + ]; + }; +} + +export interface HttpRequestWithGreedyLabelInPathInput { + foo: string | undefined; + baz: string | undefined; +} + +export namespace HttpRequestWithGreedyLabelInPathInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithGreedyLabelInPathInput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + baz?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpRequestWithGreedyLabelInPathInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "baz": { + memberValidators["baz"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("baz").validate(obj.baz, `${path}/baz`), + ]; + }; +} + +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, + }); + const memberValidators: { + string?: __MultiConstraintValidator; + short?: __MultiConstraintValidator; + integer?: __MultiConstraintValidator; + long?: __MultiConstraintValidator; + float?: __MultiConstraintValidator; + double?: __MultiConstraintValidator; + boolean?: __MultiConstraintValidator; + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpRequestWithLabelsInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "string": { + memberValidators["string"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "short": { + memberValidators["short"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "integer": { + memberValidators["integer"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "long": { + memberValidators["long"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "float": { + memberValidators["float"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "double": { + memberValidators["double"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "boolean": { + memberValidators["boolean"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("string").validate(obj.string, `${path}/string`), + ...getMemberValidator("short").validate(obj.short, `${path}/short`), + ...getMemberValidator("integer").validate(obj.integer, `${path}/integer`), + ...getMemberValidator("long").validate(obj.long, `${path}/long`), + ...getMemberValidator("float").validate(obj.float, `${path}/float`), + ...getMemberValidator("double").validate(obj.double, `${path}/double`), + ...getMemberValidator("boolean").validate(obj.boolean, `${path}/boolean`), + ...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`), + ]; + }; +} + +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, + }); + const memberValidators: { + memberEpochSeconds?: __MultiConstraintValidator; + memberHttpDate?: __MultiConstraintValidator; + memberDateTime?: __MultiConstraintValidator; + defaultFormat?: __MultiConstraintValidator; + targetEpochSeconds?: __MultiConstraintValidator; + targetHttpDate?: __MultiConstraintValidator; + targetDateTime?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpRequestWithLabelsAndTimestampFormatInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "memberEpochSeconds": { + memberValidators["memberEpochSeconds"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "memberHttpDate": { + memberValidators["memberHttpDate"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "memberDateTime": { + memberValidators["memberDateTime"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "defaultFormat": { + memberValidators["defaultFormat"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "targetEpochSeconds": { + memberValidators["targetEpochSeconds"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "targetHttpDate": { + memberValidators["targetHttpDate"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "targetDateTime": { + memberValidators["targetDateTime"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("memberEpochSeconds").validate(obj.memberEpochSeconds, `${path}/memberEpochSeconds`), + ...getMemberValidator("memberHttpDate").validate(obj.memberHttpDate, `${path}/memberHttpDate`), + ...getMemberValidator("memberDateTime").validate(obj.memberDateTime, `${path}/memberDateTime`), + ...getMemberValidator("defaultFormat").validate(obj.defaultFormat, `${path}/defaultFormat`), + ...getMemberValidator("targetEpochSeconds").validate(obj.targetEpochSeconds, `${path}/targetEpochSeconds`), + ...getMemberValidator("targetHttpDate").validate(obj.targetHttpDate, `${path}/targetHttpDate`), + ...getMemberValidator("targetDateTime").validate(obj.targetDateTime, `${path}/targetDateTime`), + ]; + }; +} + +export interface HttpRequestWithRegexLiteralInput { + str: string | undefined; +} + +export namespace HttpRequestWithRegexLiteralInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpRequestWithRegexLiteralInput): any => ({ + ...obj, + }); + const memberValidators: { + str?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpRequestWithRegexLiteralInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "str": { + memberValidators["str"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("str").validate(obj.str, `${path}/str`)]; + }; +} + +export interface HttpResponseCodeOutput { + Status?: number; +} + +export namespace HttpResponseCodeOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: HttpResponseCodeOutput): any => ({ + ...obj, + }); + const memberValidators: { + Status?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: HttpResponseCodeOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "Status": { + memberValidators["Status"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("Status").validate(obj.Status, `${path}/Status`)]; + }; +} + +export interface StringPayloadInput { + payload?: string; +} + +export namespace StringPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StringPayloadInput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: StringPayloadInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +export interface IgnoreQueryParamsInResponseOutput { + baz?: string; +} + +export namespace IgnoreQueryParamsInResponseOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: IgnoreQueryParamsInResponseOutput): any => ({ + ...obj, + }); + const memberValidators: { + baz?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: IgnoreQueryParamsInResponseOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "baz": { + memberValidators["baz"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("baz").validate(obj.baz, `${path}/baz`)]; + }; +} + +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, + }); + const memberValidators: { + headerString?: __MultiConstraintValidator; + headerByte?: __MultiConstraintValidator; + headerShort?: __MultiConstraintValidator; + headerInteger?: __MultiConstraintValidator; + headerLong?: __MultiConstraintValidator; + headerFloat?: __MultiConstraintValidator; + headerDouble?: __MultiConstraintValidator; + headerTrueBool?: __MultiConstraintValidator; + headerFalseBool?: __MultiConstraintValidator; + headerStringList?: __MultiConstraintValidator>; + headerStringSet?: __MultiConstraintValidator>; + headerIntegerList?: __MultiConstraintValidator>; + headerBooleanList?: __MultiConstraintValidator>; + headerTimestampList?: __MultiConstraintValidator>; + headerEnum?: __MultiConstraintValidator; + headerEnumList?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: InputAndOutputWithHeadersIO, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "headerString": { + memberValidators["headerString"] = new __NoOpValidator(); + break; + } + case "headerByte": { + memberValidators["headerByte"] = new __NoOpValidator(); + break; + } + case "headerShort": { + memberValidators["headerShort"] = new __NoOpValidator(); + break; + } + case "headerInteger": { + memberValidators["headerInteger"] = new __NoOpValidator(); + break; + } + case "headerLong": { + memberValidators["headerLong"] = new __NoOpValidator(); + break; + } + case "headerFloat": { + memberValidators["headerFloat"] = new __NoOpValidator(); + break; + } + case "headerDouble": { + memberValidators["headerDouble"] = new __NoOpValidator(); + break; + } + case "headerTrueBool": { + memberValidators["headerTrueBool"] = new __NoOpValidator(); + break; + } + case "headerFalseBool": { + memberValidators["headerFalseBool"] = new __NoOpValidator(); + break; + } + case "headerStringList": { + memberValidators["headerStringList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "headerStringSet": { + memberValidators["headerStringSet"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "headerIntegerList": { + memberValidators["headerIntegerList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "headerBooleanList": { + memberValidators["headerBooleanList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "headerTimestampList": { + memberValidators["headerTimestampList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "headerEnum": { + memberValidators["headerEnum"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "headerEnumList": { + memberValidators["headerEnumList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("headerString").validate(obj.headerString, `${path}/headerString`), + ...getMemberValidator("headerByte").validate(obj.headerByte, `${path}/headerByte`), + ...getMemberValidator("headerShort").validate(obj.headerShort, `${path}/headerShort`), + ...getMemberValidator("headerInteger").validate(obj.headerInteger, `${path}/headerInteger`), + ...getMemberValidator("headerLong").validate(obj.headerLong, `${path}/headerLong`), + ...getMemberValidator("headerFloat").validate(obj.headerFloat, `${path}/headerFloat`), + ...getMemberValidator("headerDouble").validate(obj.headerDouble, `${path}/headerDouble`), + ...getMemberValidator("headerTrueBool").validate(obj.headerTrueBool, `${path}/headerTrueBool`), + ...getMemberValidator("headerFalseBool").validate(obj.headerFalseBool, `${path}/headerFalseBool`), + ...getMemberValidator("headerStringList").validate(obj.headerStringList, `${path}/headerStringList`), + ...getMemberValidator("headerStringSet").validate(obj.headerStringSet, `${path}/headerStringSet`), + ...getMemberValidator("headerIntegerList").validate(obj.headerIntegerList, `${path}/headerIntegerList`), + ...getMemberValidator("headerBooleanList").validate(obj.headerBooleanList, `${path}/headerBooleanList`), + ...getMemberValidator("headerTimestampList").validate(obj.headerTimestampList, `${path}/headerTimestampList`), + ...getMemberValidator("headerEnum").validate(obj.headerEnum, `${path}/headerEnum`), + ...getMemberValidator("headerEnumList").validate(obj.headerEnumList, `${path}/headerEnumList`), + ]; + }; +} + +export interface JsonBlobsInputOutput { + data?: Uint8Array; +} + +export namespace JsonBlobsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonBlobsInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + data?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: JsonBlobsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "data": { + memberValidators["data"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("data").validate(obj.data, `${path}/data`)]; + }; +} + +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, + }); + const memberValidators: { + fooEnum1?: __MultiConstraintValidator; + fooEnum2?: __MultiConstraintValidator; + fooEnum3?: __MultiConstraintValidator; + fooEnumList?: __MultiConstraintValidator>; + fooEnumSet?: __MultiConstraintValidator>; + fooEnumMap?: __MultiConstraintValidator<{ [key: string]: FooEnum | string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: JsonEnumsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "fooEnum1": { + memberValidators["fooEnum1"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "fooEnum2": { + memberValidators["fooEnum2"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "fooEnum3": { + memberValidators["fooEnum3"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "fooEnumList": { + memberValidators["fooEnumList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + case "fooEnumSet": { + memberValidators["fooEnumSet"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + case "fooEnumMap": { + memberValidators["fooEnumMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("fooEnum1").validate(obj.fooEnum1, `${path}/fooEnum1`), + ...getMemberValidator("fooEnum2").validate(obj.fooEnum2, `${path}/fooEnum2`), + ...getMemberValidator("fooEnum3").validate(obj.fooEnum3, `${path}/fooEnum3`), + ...getMemberValidator("fooEnumList").validate(obj.fooEnumList, `${path}/fooEnumList`), + ...getMemberValidator("fooEnumSet").validate(obj.fooEnumSet, `${path}/fooEnumSet`), + ...getMemberValidator("fooEnumMap").validate(obj.fooEnumMap, `${path}/fooEnumMap`), + ]; + }; +} + +export interface StructureListMember { + a?: string; + b?: string; +} + +export namespace StructureListMember { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StructureListMember): any => ({ + ...obj, + }); + const memberValidators: { + a?: __MultiConstraintValidator; + b?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: StructureListMember, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "a": { + memberValidators["a"] = new __NoOpValidator(); + break; + } + case "b": { + memberValidators["b"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("a").validate(obj.a, `${path}/a`), + ...getMemberValidator("b").validate(obj.b, `${path}/b`), + ]; + }; +} + +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, + }); + const memberValidators: { + stringList?: __MultiConstraintValidator>; + sparseStringList?: __MultiConstraintValidator>; + stringSet?: __MultiConstraintValidator>; + integerList?: __MultiConstraintValidator>; + booleanList?: __MultiConstraintValidator>; + timestampList?: __MultiConstraintValidator>; + enumList?: __MultiConstraintValidator>; + nestedStringList?: __MultiConstraintValidator>; + structureList?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: JsonListsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "stringList": { + memberValidators["stringList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "sparseStringList": { + memberValidators["sparseStringList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "stringSet": { + memberValidators["stringSet"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "integerList": { + memberValidators["integerList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "booleanList": { + memberValidators["booleanList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "timestampList": { + memberValidators["timestampList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "enumList": { + memberValidators["enumList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeValidator([new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"])]) + ); + break; + } + case "nestedStringList": { + memberValidators["nestedStringList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeCollectionValidator(new __NoOpValidator(), new __NoOpValidator()) + ); + break; + } + case "structureList": { + memberValidators["structureList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeStructureValidator( + new __NoOpValidator(), + StructureListMember.validate + ) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("stringList").validate(obj.stringList, `${path}/stringList`), + ...getMemberValidator("sparseStringList").validate(obj.sparseStringList, `${path}/sparseStringList`), + ...getMemberValidator("stringSet").validate(obj.stringSet, `${path}/stringSet`), + ...getMemberValidator("integerList").validate(obj.integerList, `${path}/integerList`), + ...getMemberValidator("booleanList").validate(obj.booleanList, `${path}/booleanList`), + ...getMemberValidator("timestampList").validate(obj.timestampList, `${path}/timestampList`), + ...getMemberValidator("enumList").validate(obj.enumList, `${path}/enumList`), + ...getMemberValidator("nestedStringList").validate(obj.nestedStringList, `${path}/nestedStringList`), + ...getMemberValidator("structureList").validate(obj.structureList, `${path}/structureList`), + ]; + }; +} + +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, + }); + const memberValidators: { + denseStructMap?: __MultiConstraintValidator<{ [key: string]: GreetingStruct }>; + sparseStructMap?: __MultiConstraintValidator<{ [key: string]: GreetingStruct }>; + denseNumberMap?: __MultiConstraintValidator<{ [key: string]: number }>; + denseBooleanMap?: __MultiConstraintValidator<{ [key: string]: boolean }>; + denseStringMap?: __MultiConstraintValidator<{ [key: string]: string }>; + sparseNumberMap?: __MultiConstraintValidator<{ [key: string]: number }>; + sparseBooleanMap?: __MultiConstraintValidator<{ [key: string]: boolean }>; + sparseStringMap?: __MultiConstraintValidator<{ [key: string]: string }>; + denseSetMap?: __MultiConstraintValidator<{ [key: string]: string[] }>; + sparseSetMap?: __MultiConstraintValidator<{ [key: string]: string[] }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: JsonMapsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "denseStructMap": { + memberValidators["denseStructMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), GreetingStruct.validate) + ); + break; + } + case "sparseStructMap": { + memberValidators["sparseStructMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), GreetingStruct.validate) + ); + break; + } + case "denseNumberMap": { + memberValidators["denseNumberMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "denseBooleanMap": { + memberValidators["denseBooleanMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "denseStringMap": { + memberValidators["denseStringMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "sparseNumberMap": { + memberValidators["sparseNumberMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "sparseBooleanMap": { + memberValidators["sparseBooleanMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "sparseStringMap": { + memberValidators["sparseStringMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "denseSetMap": { + memberValidators["denseSetMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeCollectionValidator(new __NoOpValidator(), new __NoOpValidator()) + ); + break; + } + case "sparseSetMap": { + memberValidators["sparseSetMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeCollectionValidator(new __NoOpValidator(), new __NoOpValidator()) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("denseStructMap").validate(obj.denseStructMap, `${path}/denseStructMap`), + ...getMemberValidator("sparseStructMap").validate(obj.sparseStructMap, `${path}/sparseStructMap`), + ...getMemberValidator("denseNumberMap").validate(obj.denseNumberMap, `${path}/denseNumberMap`), + ...getMemberValidator("denseBooleanMap").validate(obj.denseBooleanMap, `${path}/denseBooleanMap`), + ...getMemberValidator("denseStringMap").validate(obj.denseStringMap, `${path}/denseStringMap`), + ...getMemberValidator("sparseNumberMap").validate(obj.sparseNumberMap, `${path}/sparseNumberMap`), + ...getMemberValidator("sparseBooleanMap").validate(obj.sparseBooleanMap, `${path}/sparseBooleanMap`), + ...getMemberValidator("sparseStringMap").validate(obj.sparseStringMap, `${path}/sparseStringMap`), + ...getMemberValidator("denseSetMap").validate(obj.denseSetMap, `${path}/denseSetMap`), + ...getMemberValidator("sparseSetMap").validate(obj.sparseSetMap, `${path}/sparseSetMap`), + ]; + }; +} + +export interface JsonTimestampsInputOutput { + normal?: Date; + dateTime?: Date; + epochSeconds?: Date; + httpDate?: Date; +} + +export namespace JsonTimestampsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: JsonTimestampsInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + normal?: __MultiConstraintValidator; + dateTime?: __MultiConstraintValidator; + epochSeconds?: __MultiConstraintValidator; + httpDate?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: JsonTimestampsInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "normal": { + memberValidators["normal"] = new __NoOpValidator(); + break; + } + case "dateTime": { + memberValidators["dateTime"] = new __NoOpValidator(); + break; + } + case "epochSeconds": { + memberValidators["epochSeconds"] = new __NoOpValidator(); + break; + } + case "httpDate": { + memberValidators["httpDate"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("normal").validate(obj.normal, `${path}/normal`), + ...getMemberValidator("dateTime").validate(obj.dateTime, `${path}/dateTime`), + ...getMemberValidator("epochSeconds").validate(obj.epochSeconds, `${path}/epochSeconds`), + ...getMemberValidator("httpDate").validate(obj.httpDate, `${path}/httpDate`), + ]; + }; +} + +export interface RenamedGreeting { + salutation?: string; +} + +export namespace RenamedGreeting { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RenamedGreeting): any => ({ + ...obj, + }); + const memberValidators: { + salutation?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: RenamedGreeting, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "salutation": { + memberValidators["salutation"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("salutation").validate(obj.salutation, `${path}/salutation`)]; + }; +} + +/** + * 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" }; + }; + const memberValidators: { + stringValue?: __MultiConstraintValidator; + booleanValue?: __MultiConstraintValidator; + numberValue?: __MultiConstraintValidator; + blobValue?: __MultiConstraintValidator; + timestampValue?: __MultiConstraintValidator; + enumValue?: __MultiConstraintValidator; + listValue?: __MultiConstraintValidator>; + mapValue?: __MultiConstraintValidator<{ [key: string]: string }>; + structureValue?: __MultiConstraintValidator; + renamedStructureValue?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MyUnion, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "stringValue": { + memberValidators["stringValue"] = new __NoOpValidator(); + break; + } + case "booleanValue": { + memberValidators["booleanValue"] = new __NoOpValidator(); + break; + } + case "numberValue": { + memberValidators["numberValue"] = new __NoOpValidator(); + break; + } + case "blobValue": { + memberValidators["blobValue"] = new __NoOpValidator(); + break; + } + case "timestampValue": { + memberValidators["timestampValue"] = new __NoOpValidator(); + break; + } + case "enumValue": { + memberValidators["enumValue"] = new __CompositeValidator([ + new __EnumValidator(["Foo", "Baz", "Bar", "1", "0"]), + ]); + break; + } + case "listValue": { + memberValidators["listValue"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "mapValue": { + memberValidators["mapValue"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "structureValue": { + memberValidators["structureValue"] = new __CompositeStructureValidator( + new __NoOpValidator(), + GreetingStruct.validate + ); + break; + } + case "renamedStructureValue": { + memberValidators["renamedStructureValue"] = new __CompositeStructureValidator( + new __NoOpValidator(), + RenamedGreeting.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("stringValue").validate(obj.stringValue, `${path}/stringValue`), + ...getMemberValidator("booleanValue").validate(obj.booleanValue, `${path}/booleanValue`), + ...getMemberValidator("numberValue").validate(obj.numberValue, `${path}/numberValue`), + ...getMemberValidator("blobValue").validate(obj.blobValue, `${path}/blobValue`), + ...getMemberValidator("timestampValue").validate(obj.timestampValue, `${path}/timestampValue`), + ...getMemberValidator("enumValue").validate(obj.enumValue, `${path}/enumValue`), + ...getMemberValidator("listValue").validate(obj.listValue, `${path}/listValue`), + ...getMemberValidator("mapValue").validate(obj.mapValue, `${path}/mapValue`), + ...getMemberValidator("structureValue").validate(obj.structureValue, `${path}/structureValue`), + ...getMemberValidator("renamedStructureValue").validate( + obj.renamedStructureValue, + `${path}/renamedStructureValue` + ), + ]; + }; +} + +/** + * 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) }), + }); + const memberValidators: { + contents?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: UnionInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "contents": { + memberValidators["contents"] = new __CompositeStructureValidator( + new __NoOpValidator(), + MyUnion.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("contents").validate(obj.contents, `${path}/contents`)]; + }; +} + +export interface MalformedAcceptWithGenericStringInput { + payload?: Uint8Array; +} + +export namespace MalformedAcceptWithGenericStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedAcceptWithGenericStringInput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedAcceptWithGenericStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +export interface MalformedAcceptWithPayloadOutput { + payload?: Uint8Array; +} + +export namespace MalformedAcceptWithPayloadOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedAcceptWithPayloadOutput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedAcceptWithPayloadOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +export interface MalformedBlobInput { + blob?: Uint8Array; +} + +export namespace MalformedBlobInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedBlobInput): any => ({ + ...obj, + }); + const memberValidators: { + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedBlobInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("blob").validate(obj.blob, `${path}/blob`)]; + }; +} + +export interface MalformedBooleanInput { + booleanInBody?: boolean; + booleanInPath: boolean | undefined; + booleanInQuery?: boolean; + booleanInHeader?: boolean; +} + +export namespace MalformedBooleanInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedBooleanInput): any => ({ + ...obj, + }); + const memberValidators: { + booleanInBody?: __MultiConstraintValidator; + booleanInPath?: __MultiConstraintValidator; + booleanInQuery?: __MultiConstraintValidator; + booleanInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedBooleanInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "booleanInBody": { + memberValidators["booleanInBody"] = new __NoOpValidator(); + break; + } + case "booleanInPath": { + memberValidators["booleanInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "booleanInQuery": { + memberValidators["booleanInQuery"] = new __NoOpValidator(); + break; + } + case "booleanInHeader": { + memberValidators["booleanInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("booleanInBody").validate(obj.booleanInBody, `${path}/booleanInBody`), + ...getMemberValidator("booleanInPath").validate(obj.booleanInPath, `${path}/booleanInPath`), + ...getMemberValidator("booleanInQuery").validate(obj.booleanInQuery, `${path}/booleanInQuery`), + ...getMemberValidator("booleanInHeader").validate(obj.booleanInHeader, `${path}/booleanInHeader`), + ]; + }; +} + +export interface MalformedByteInput { + byteInBody?: number; + byteInPath: number | undefined; + byteInQuery?: number; + byteInHeader?: number; +} + +export namespace MalformedByteInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedByteInput): any => ({ + ...obj, + }); + const memberValidators: { + byteInBody?: __MultiConstraintValidator; + byteInPath?: __MultiConstraintValidator; + byteInQuery?: __MultiConstraintValidator; + byteInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedByteInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "byteInBody": { + memberValidators["byteInBody"] = new __NoOpValidator(); + break; + } + case "byteInPath": { + memberValidators["byteInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "byteInQuery": { + memberValidators["byteInQuery"] = new __NoOpValidator(); + break; + } + case "byteInHeader": { + memberValidators["byteInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("byteInBody").validate(obj.byteInBody, `${path}/byteInBody`), + ...getMemberValidator("byteInPath").validate(obj.byteInPath, `${path}/byteInPath`), + ...getMemberValidator("byteInQuery").validate(obj.byteInQuery, `${path}/byteInQuery`), + ...getMemberValidator("byteInHeader").validate(obj.byteInHeader, `${path}/byteInHeader`), + ]; + }; +} + +export interface MalformedContentTypeWithGenericStringInput { + payload?: string; +} + +export namespace MalformedContentTypeWithGenericStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedContentTypeWithGenericStringInput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedContentTypeWithGenericStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +export interface MalformedContentTypeWithPayloadInput { + payload?: Uint8Array; +} + +export namespace MalformedContentTypeWithPayloadInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedContentTypeWithPayloadInput): any => ({ + ...obj, + }); + const memberValidators: { + payload?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedContentTypeWithPayloadInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "payload": { + memberValidators["payload"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("payload").validate(obj.payload, `${path}/payload`)]; + }; +} + +export interface MalformedDoubleInput { + doubleInBody?: number; + doubleInPath: number | undefined; + doubleInQuery?: number; + doubleInHeader?: number; +} + +export namespace MalformedDoubleInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedDoubleInput): any => ({ + ...obj, + }); + const memberValidators: { + doubleInBody?: __MultiConstraintValidator; + doubleInPath?: __MultiConstraintValidator; + doubleInQuery?: __MultiConstraintValidator; + doubleInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedDoubleInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "doubleInBody": { + memberValidators["doubleInBody"] = new __NoOpValidator(); + break; + } + case "doubleInPath": { + memberValidators["doubleInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "doubleInQuery": { + memberValidators["doubleInQuery"] = new __NoOpValidator(); + break; + } + case "doubleInHeader": { + memberValidators["doubleInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("doubleInBody").validate(obj.doubleInBody, `${path}/doubleInBody`), + ...getMemberValidator("doubleInPath").validate(obj.doubleInPath, `${path}/doubleInPath`), + ...getMemberValidator("doubleInQuery").validate(obj.doubleInQuery, `${path}/doubleInQuery`), + ...getMemberValidator("doubleInHeader").validate(obj.doubleInHeader, `${path}/doubleInHeader`), + ]; + }; +} + +export interface MalformedFloatInput { + floatInBody?: number; + floatInPath: number | undefined; + floatInQuery?: number; + floatInHeader?: number; +} + +export namespace MalformedFloatInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedFloatInput): any => ({ + ...obj, + }); + const memberValidators: { + floatInBody?: __MultiConstraintValidator; + floatInPath?: __MultiConstraintValidator; + floatInQuery?: __MultiConstraintValidator; + floatInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedFloatInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "floatInBody": { + memberValidators["floatInBody"] = new __NoOpValidator(); + break; + } + case "floatInPath": { + memberValidators["floatInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "floatInQuery": { + memberValidators["floatInQuery"] = new __NoOpValidator(); + break; + } + case "floatInHeader": { + memberValidators["floatInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("floatInBody").validate(obj.floatInBody, `${path}/floatInBody`), + ...getMemberValidator("floatInPath").validate(obj.floatInPath, `${path}/floatInPath`), + ...getMemberValidator("floatInQuery").validate(obj.floatInQuery, `${path}/floatInQuery`), + ...getMemberValidator("floatInHeader").validate(obj.floatInHeader, `${path}/floatInHeader`), + ]; + }; +} + +export interface MalformedIntegerInput { + integerInBody?: number; + integerInPath: number | undefined; + integerInQuery?: number; + integerInHeader?: number; +} + +export namespace MalformedIntegerInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedIntegerInput): any => ({ + ...obj, + }); + const memberValidators: { + integerInBody?: __MultiConstraintValidator; + integerInPath?: __MultiConstraintValidator; + integerInQuery?: __MultiConstraintValidator; + integerInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedIntegerInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "integerInBody": { + memberValidators["integerInBody"] = new __NoOpValidator(); + break; + } + case "integerInPath": { + memberValidators["integerInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "integerInQuery": { + memberValidators["integerInQuery"] = new __NoOpValidator(); + break; + } + case "integerInHeader": { + memberValidators["integerInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("integerInBody").validate(obj.integerInBody, `${path}/integerInBody`), + ...getMemberValidator("integerInPath").validate(obj.integerInPath, `${path}/integerInPath`), + ...getMemberValidator("integerInQuery").validate(obj.integerInQuery, `${path}/integerInQuery`), + ...getMemberValidator("integerInHeader").validate(obj.integerInHeader, `${path}/integerInHeader`), + ]; + }; +} + +export interface MalformedListInput { + bodyList?: string[]; +} + +export namespace MalformedListInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedListInput): any => ({ + ...obj, + }); + const memberValidators: { + bodyList?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedListInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "bodyList": { + memberValidators["bodyList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("bodyList").validate(obj.bodyList, `${path}/bodyList`)]; + }; +} + +export interface MalformedLongInput { + longInBody?: number; + longInPath: number | undefined; + longInQuery?: number; + longInHeader?: number; +} + +export namespace MalformedLongInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedLongInput): any => ({ + ...obj, + }); + const memberValidators: { + longInBody?: __MultiConstraintValidator; + longInPath?: __MultiConstraintValidator; + longInQuery?: __MultiConstraintValidator; + longInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedLongInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "longInBody": { + memberValidators["longInBody"] = new __NoOpValidator(); + break; + } + case "longInPath": { + memberValidators["longInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "longInQuery": { + memberValidators["longInQuery"] = new __NoOpValidator(); + break; + } + case "longInHeader": { + memberValidators["longInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("longInBody").validate(obj.longInBody, `${path}/longInBody`), + ...getMemberValidator("longInPath").validate(obj.longInPath, `${path}/longInPath`), + ...getMemberValidator("longInQuery").validate(obj.longInQuery, `${path}/longInQuery`), + ...getMemberValidator("longInHeader").validate(obj.longInHeader, `${path}/longInHeader`), + ]; + }; +} + +export interface MalformedMapInput { + bodyMap?: { [key: string]: string }; +} + +export namespace MalformedMapInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedMapInput): any => ({ + ...obj, + }); + const memberValidators: { + bodyMap?: __MultiConstraintValidator<{ [key: string]: string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedMapInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "bodyMap": { + memberValidators["bodyMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("bodyMap").validate(obj.bodyMap, `${path}/bodyMap`)]; + }; +} + +export interface MalformedRequestBodyInput { + int?: number; + float?: number; +} + +export namespace MalformedRequestBodyInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedRequestBodyInput): any => ({ + ...obj, + }); + const memberValidators: { + int?: __MultiConstraintValidator; + float?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedRequestBodyInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "int": { + memberValidators["int"] = new __NoOpValidator(); + break; + } + case "float": { + memberValidators["float"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("int").validate(obj.int, `${path}/int`), + ...getMemberValidator("float").validate(obj.float, `${path}/float`), + ]; + }; +} + +export interface MalformedSetInput { + set?: string[]; +} + +export namespace MalformedSetInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedSetInput): any => ({ + ...obj, + }); + const memberValidators: { + set?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedSetInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "set": { + memberValidators["set"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("set").validate(obj.set, `${path}/set`)]; + }; +} + +export interface MalformedShortInput { + shortInBody?: number; + shortInPath: number | undefined; + shortInQuery?: number; + shortInHeader?: number; +} + +export namespace MalformedShortInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedShortInput): any => ({ + ...obj, + }); + const memberValidators: { + shortInBody?: __MultiConstraintValidator; + shortInPath?: __MultiConstraintValidator; + shortInQuery?: __MultiConstraintValidator; + shortInHeader?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedShortInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "shortInBody": { + memberValidators["shortInBody"] = new __NoOpValidator(); + break; + } + case "shortInPath": { + memberValidators["shortInPath"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + case "shortInQuery": { + memberValidators["shortInQuery"] = new __NoOpValidator(); + break; + } + case "shortInHeader": { + memberValidators["shortInHeader"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("shortInBody").validate(obj.shortInBody, `${path}/shortInBody`), + ...getMemberValidator("shortInPath").validate(obj.shortInPath, `${path}/shortInPath`), + ...getMemberValidator("shortInQuery").validate(obj.shortInQuery, `${path}/shortInQuery`), + ...getMemberValidator("shortInHeader").validate(obj.shortInHeader, `${path}/shortInHeader`), + ]; + }; +} + +export interface MalformedStringInput { + blob?: __LazyJsonString | string; +} + +export namespace MalformedStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedStringInput): any => ({ + ...obj, + }); + const memberValidators: { + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("blob").validate(obj.blob?.toString(), `${path}/blob`)]; + }; +} + +export interface MalformedTimestampBodyDateTimeInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyDateTimeInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyDateTimeInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampBodyDateTimeInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampBodyDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyDefaultInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampBodyDefaultInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampBodyHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampBodyHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampBodyHttpDateInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampBodyHttpDateInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampHeaderDateTimeInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderDateTimeInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderDateTimeInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampHeaderDateTimeInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampHeaderDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderDefaultInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampHeaderDefaultInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampHeaderEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampHeaderEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampHeaderEpochInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampHeaderEpochInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampPathDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathDefaultInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampPathDefaultInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampPathEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathEpochInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampPathEpochInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampPathHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampPathHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampPathHttpDateInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampPathHttpDateInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampQueryDefaultInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryDefaultInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryDefaultInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampQueryDefaultInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampQueryEpochInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryEpochInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryEpochInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampQueryEpochInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +export interface MalformedTimestampQueryHttpDateInput { + timestamp: Date | undefined; +} + +export namespace MalformedTimestampQueryHttpDateInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedTimestampQueryHttpDateInput): any => ({ + ...obj, + }); + const memberValidators: { + timestamp?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedTimestampQueryHttpDateInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timestamp": { + memberValidators["timestamp"] = new __CompositeValidator([new __RequiredValidator()]); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timestamp").validate(obj.timestamp, `${path}/timestamp`)]; + }; +} + +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" }; + }; + const memberValidators: { + int?: __MultiConstraintValidator; + string?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: SimpleUnion, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "int": { + memberValidators["int"] = new __NoOpValidator(); + break; + } + case "string": { + memberValidators["string"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("int").validate(obj.int, `${path}/int`), + ...getMemberValidator("string").validate(obj.string, `${path}/string`), + ]; + }; +} + +export interface MalformedUnionInput { + union?: SimpleUnion; +} + +export namespace MalformedUnionInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MalformedUnionInput): any => ({ + ...obj, + ...(obj.union && { union: SimpleUnion.filterSensitiveLog(obj.union) }), + }); + const memberValidators: { + union?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MalformedUnionInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "union": { + memberValidators["union"] = new __CompositeStructureValidator( + new __NoOpValidator(), + SimpleUnion.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("union").validate(obj.union, `${path}/union`)]; + }; +} + +export interface MediaTypeHeaderInput { + json?: __LazyJsonString | string; +} + +export namespace MediaTypeHeaderInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MediaTypeHeaderInput): any => ({ + ...obj, + }); + const memberValidators: { + json?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MediaTypeHeaderInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "json": { + memberValidators["json"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("json").validate(obj.json?.toString(), `${path}/json`)]; + }; +} + +export interface MediaTypeHeaderOutput { + json?: __LazyJsonString | string; +} + +export namespace MediaTypeHeaderOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: MediaTypeHeaderOutput): any => ({ + ...obj, + }); + const memberValidators: { + json?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: MediaTypeHeaderOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "json": { + memberValidators["json"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("json").validate(obj.json?.toString(), `${path}/json`)]; + }; +} + +export interface NoInputAndOutputOutput {} + +export namespace NoInputAndOutputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NoInputAndOutputOutput): any => ({ + ...obj, + }); + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: NoInputAndOutputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + +export interface NullAndEmptyHeadersIO { + a?: string; + b?: string; + c?: string[]; +} + +export namespace NullAndEmptyHeadersIO { + /** + * @internal + */ + export const filterSensitiveLog = (obj: NullAndEmptyHeadersIO): any => ({ + ...obj, + }); + const memberValidators: { + a?: __MultiConstraintValidator; + b?: __MultiConstraintValidator; + c?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: NullAndEmptyHeadersIO, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "a": { + memberValidators["a"] = new __NoOpValidator(); + break; + } + case "b": { + memberValidators["b"] = new __NoOpValidator(); + break; + } + case "c": { + memberValidators["c"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("a").validate(obj.a, `${path}/a`), + ...getMemberValidator("b").validate(obj.b, `${path}/b`), + ...getMemberValidator("c").validate(obj.c, `${path}/c`), + ]; + }; +} + +export interface OmitsNullSerializesEmptyStringInput { + nullValue?: string; + emptyString?: string; +} + +export namespace OmitsNullSerializesEmptyStringInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: OmitsNullSerializesEmptyStringInput): any => ({ + ...obj, + }); + const memberValidators: { + nullValue?: __MultiConstraintValidator; + emptyString?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: OmitsNullSerializesEmptyStringInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "nullValue": { + memberValidators["nullValue"] = new __NoOpValidator(); + break; + } + case "emptyString": { + memberValidators["emptyString"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("nullValue").validate(obj.nullValue, `${path}/nullValue`), + ...getMemberValidator("emptyString").validate(obj.emptyString, `${path}/emptyString`), + ]; + }; +} + +export interface PayloadConfig { + data?: number; +} + +export namespace PayloadConfig { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PayloadConfig): any => ({ + ...obj, + }); + const memberValidators: { + data?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: PayloadConfig, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "data": { + memberValidators["data"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("data").validate(obj.data, `${path}/data`)]; + }; +} + +export interface Unit {} + +export namespace Unit { + /** + * @internal + */ + export const filterSensitiveLog = (obj: Unit): any => ({ + ...obj, + }); + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: Unit, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + +export type PlayerAction = PlayerAction.QuitMember | PlayerAction.$UnknownMember; + +export namespace PlayerAction { + /** + * Quit the game. + */ + export interface QuitMember { + quit: Unit; + $unknown?: never; + } + + export interface $UnknownMember { + quit?: never; + $unknown: [string, any]; + } + + export interface Visitor { + quit: (value: Unit) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: PlayerAction, visitor: Visitor): T => { + if (value.quit !== undefined) return visitor.quit(value.quit); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; + + /** + * @internal + */ + export const filterSensitiveLog = (obj: PlayerAction): any => { + if (obj.quit !== undefined) return { quit: Unit.filterSensitiveLog(obj.quit) }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; + }; + const memberValidators: { + quit?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: PlayerAction, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "quit": { + memberValidators["quit"] = new __CompositeStructureValidator(new __NoOpValidator(), Unit.validate); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("quit").validate(obj.quit, `${path}/quit`)]; + }; +} + +export interface PostPlayerActionInput { + action: PlayerAction | undefined; +} + +export namespace PostPlayerActionInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PostPlayerActionInput): any => ({ + ...obj, + ...(obj.action && { action: PlayerAction.filterSensitiveLog(obj.action) }), + }); + const memberValidators: { + action?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: PostPlayerActionInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "action": { + memberValidators["action"] = new __CompositeStructureValidator( + new __CompositeValidator([new __RequiredValidator()]), + PlayerAction.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("action").validate(obj.action, `${path}/action`)]; + }; +} + +export interface PostPlayerActionOutput { + action: PlayerAction | undefined; +} + +export namespace PostPlayerActionOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PostPlayerActionOutput): any => ({ + ...obj, + ...(obj.action && { action: PlayerAction.filterSensitiveLog(obj.action) }), + }); + const memberValidators: { + action?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: PostPlayerActionOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "action": { + memberValidators["action"] = new __CompositeStructureValidator( + new __CompositeValidator([new __RequiredValidator()]), + PlayerAction.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("action").validate(obj.action, `${path}/action`)]; + }; +} + +export interface QueryIdempotencyTokenAutoFillInput { + token?: string; +} + +export namespace QueryIdempotencyTokenAutoFillInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryIdempotencyTokenAutoFillInput): any => ({ + ...obj, + }); + const memberValidators: { + token?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: QueryIdempotencyTokenAutoFillInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "token": { + memberValidators["token"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("token").validate(obj.token, `${path}/token`)]; + }; +} + +export interface QueryParamsAsStringListMapInput { + qux?: string; + foo?: { [key: string]: string[] }; +} + +export namespace QueryParamsAsStringListMapInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryParamsAsStringListMapInput): any => ({ + ...obj, + }); + const memberValidators: { + qux?: __MultiConstraintValidator; + foo?: __MultiConstraintValidator<{ [key: string]: string[] }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: QueryParamsAsStringListMapInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "qux": { + memberValidators["qux"] = new __NoOpValidator(); + break; + } + case "foo": { + memberValidators["foo"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeCollectionValidator(new __NoOpValidator(), new __NoOpValidator()) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("qux").validate(obj.qux, `${path}/qux`), + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ]; + }; +} + +export interface QueryPrecedenceInput { + foo?: string; + baz?: { [key: string]: string }; +} + +export namespace QueryPrecedenceInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: QueryPrecedenceInput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + baz?: __MultiConstraintValidator<{ [key: string]: string }>; + } = {}; + /** + * @internal + */ + export const validate = (obj: QueryPrecedenceInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "baz": { + memberValidators["baz"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("baz").validate(obj.baz, `${path}/baz`), + ]; + }; +} + +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, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + stringValue?: __MultiConstraintValidator; + trueBooleanValue?: __MultiConstraintValidator; + falseBooleanValue?: __MultiConstraintValidator; + byteValue?: __MultiConstraintValidator; + shortValue?: __MultiConstraintValidator; + integerValue?: __MultiConstraintValidator; + longValue?: __MultiConstraintValidator; + floatValue?: __MultiConstraintValidator; + doubleValue?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: SimpleScalarPropertiesInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "stringValue": { + memberValidators["stringValue"] = new __NoOpValidator(); + break; + } + case "trueBooleanValue": { + memberValidators["trueBooleanValue"] = new __NoOpValidator(); + break; + } + case "falseBooleanValue": { + memberValidators["falseBooleanValue"] = new __NoOpValidator(); + break; + } + case "byteValue": { + memberValidators["byteValue"] = new __NoOpValidator(); + break; + } + case "shortValue": { + memberValidators["shortValue"] = new __NoOpValidator(); + break; + } + case "integerValue": { + memberValidators["integerValue"] = new __NoOpValidator(); + break; + } + case "longValue": { + memberValidators["longValue"] = new __NoOpValidator(); + break; + } + case "floatValue": { + memberValidators["floatValue"] = new __NoOpValidator(); + break; + } + case "doubleValue": { + memberValidators["doubleValue"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("stringValue").validate(obj.stringValue, `${path}/stringValue`), + ...getMemberValidator("trueBooleanValue").validate(obj.trueBooleanValue, `${path}/trueBooleanValue`), + ...getMemberValidator("falseBooleanValue").validate(obj.falseBooleanValue, `${path}/falseBooleanValue`), + ...getMemberValidator("byteValue").validate(obj.byteValue, `${path}/byteValue`), + ...getMemberValidator("shortValue").validate(obj.shortValue, `${path}/shortValue`), + ...getMemberValidator("integerValue").validate(obj.integerValue, `${path}/integerValue`), + ...getMemberValidator("longValue").validate(obj.longValue, `${path}/longValue`), + ...getMemberValidator("floatValue").validate(obj.floatValue, `${path}/floatValue`), + ...getMemberValidator("doubleValue").validate(obj.doubleValue, `${path}/doubleValue`), + ]; + }; +} + +export interface StreamingTraitsInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = ( + obj: Omit & { + blob?: StreamingTraitsInputOutput["blob"] | string | Uint8Array | Buffer; + }, + path = "" + ): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("blob").validate(obj.blob, `${path}/blob`), + ]; + }; +} + +export interface StreamingTraitsRequireLengthInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsRequireLengthInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsRequireLengthInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = ( + obj: Omit & { + blob?: StreamingTraitsRequireLengthInputOutput["blob"] | string | Uint8Array | Buffer; + }, + path = "" + ): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("blob").validate(obj.blob, `${path}/blob`), + ]; + }; +} + +export interface StreamingTraitsWithMediaTypeInputOutput { + foo?: string; + blob?: Readable | ReadableStream | Blob; +} + +export namespace StreamingTraitsWithMediaTypeInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: StreamingTraitsWithMediaTypeInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + blob?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = ( + obj: Omit & { + blob?: StreamingTraitsWithMediaTypeInputOutput["blob"] | string | Uint8Array | Buffer; + }, + path = "" + ): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "blob": { + memberValidators["blob"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("blob").validate(obj.blob, `${path}/blob`), + ]; + }; +} + +export interface TestConfig { + timeout?: number; +} + +export namespace TestConfig { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TestConfig): any => ({ + ...obj, + }); + const memberValidators: { + timeout?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TestConfig, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "timeout": { + memberValidators["timeout"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("timeout").validate(obj.timeout, `${path}/timeout`)]; + }; +} + +export interface TestBodyStructureInputOutput { + testId?: string; + testConfig?: TestConfig; +} + +export namespace TestBodyStructureInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TestBodyStructureInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + testId?: __MultiConstraintValidator; + testConfig?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TestBodyStructureInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "testId": { + memberValidators["testId"] = new __NoOpValidator(); + break; + } + case "testConfig": { + memberValidators["testConfig"] = new __CompositeStructureValidator( + new __NoOpValidator(), + TestConfig.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("testId").validate(obj.testId, `${path}/testId`), + ...getMemberValidator("testConfig").validate(obj.testConfig, `${path}/testConfig`), + ]; + }; +} + +export interface TestNoPayloadInputOutput { + testId?: string; +} + +export namespace TestNoPayloadInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TestNoPayloadInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + testId?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TestNoPayloadInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "testId": { + memberValidators["testId"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("testId").validate(obj.testId, `${path}/testId`)]; + }; +} + +export interface TestPayloadBlobInputOutput { + contentType?: string; + data?: Uint8Array; +} + +export namespace TestPayloadBlobInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TestPayloadBlobInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + contentType?: __MultiConstraintValidator; + data?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TestPayloadBlobInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "contentType": { + memberValidators["contentType"] = new __NoOpValidator(); + break; + } + case "data": { + memberValidators["data"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("contentType").validate(obj.contentType, `${path}/contentType`), + ...getMemberValidator("data").validate(obj.data, `${path}/data`), + ]; + }; +} + +export interface TestPayloadStructureInputOutput { + testId?: string; + payloadConfig?: PayloadConfig; +} + +export namespace TestPayloadStructureInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: TestPayloadStructureInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + testId?: __MultiConstraintValidator; + payloadConfig?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TestPayloadStructureInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "testId": { + memberValidators["testId"] = new __NoOpValidator(); + break; + } + case "payloadConfig": { + memberValidators["payloadConfig"] = new __CompositeStructureValidator( + new __NoOpValidator(), + PayloadConfig.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("testId").validate(obj.testId, `${path}/testId`), + ...getMemberValidator("payloadConfig").validate(obj.payloadConfig, `${path}/payloadConfig`), + ]; + }; +} + +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, + }); + const memberValidators: { + memberEpochSeconds?: __MultiConstraintValidator; + memberHttpDate?: __MultiConstraintValidator; + memberDateTime?: __MultiConstraintValidator; + defaultFormat?: __MultiConstraintValidator; + targetEpochSeconds?: __MultiConstraintValidator; + targetHttpDate?: __MultiConstraintValidator; + targetDateTime?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: TimestampFormatHeadersIO, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "memberEpochSeconds": { + memberValidators["memberEpochSeconds"] = new __NoOpValidator(); + break; + } + case "memberHttpDate": { + memberValidators["memberHttpDate"] = new __NoOpValidator(); + break; + } + case "memberDateTime": { + memberValidators["memberDateTime"] = new __NoOpValidator(); + break; + } + case "defaultFormat": { + memberValidators["defaultFormat"] = new __NoOpValidator(); + break; + } + case "targetEpochSeconds": { + memberValidators["targetEpochSeconds"] = new __NoOpValidator(); + break; + } + case "targetHttpDate": { + memberValidators["targetHttpDate"] = new __NoOpValidator(); + break; + } + case "targetDateTime": { + memberValidators["targetDateTime"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("memberEpochSeconds").validate(obj.memberEpochSeconds, `${path}/memberEpochSeconds`), + ...getMemberValidator("memberHttpDate").validate(obj.memberHttpDate, `${path}/memberHttpDate`), + ...getMemberValidator("memberDateTime").validate(obj.memberDateTime, `${path}/memberDateTime`), + ...getMemberValidator("defaultFormat").validate(obj.defaultFormat, `${path}/defaultFormat`), + ...getMemberValidator("targetEpochSeconds").validate(obj.targetEpochSeconds, `${path}/targetEpochSeconds`), + ...getMemberValidator("targetHttpDate").validate(obj.targetHttpDate, `${path}/targetHttpDate`), + ...getMemberValidator("targetDateTime").validate(obj.targetDateTime, `${path}/targetDateTime`), + ]; + }; +} + +export interface RecursiveShapesInputOutputNested1 { + foo?: string; + nested?: RecursiveShapesInputOutputNested2; +} + +export namespace RecursiveShapesInputOutputNested1 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested1): any => ({ + ...obj, + }); + const memberValidators: { + foo?: __MultiConstraintValidator; + nested?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: RecursiveShapesInputOutputNested1, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "foo": { + memberValidators["foo"] = new __NoOpValidator(); + break; + } + case "nested": { + memberValidators["nested"] = new __CompositeStructureValidator( + new __NoOpValidator(), + RecursiveShapesInputOutputNested2.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("foo").validate(obj.foo, `${path}/foo`), + ...getMemberValidator("nested").validate(obj.nested, `${path}/nested`), + ]; + }; +} + +export interface RecursiveShapesInputOutputNested2 { + bar?: string; + recursiveMember?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutputNested2 { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutputNested2): any => ({ + ...obj, + }); + const memberValidators: { + bar?: __MultiConstraintValidator; + recursiveMember?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: RecursiveShapesInputOutputNested2, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "bar": { + memberValidators["bar"] = new __NoOpValidator(); + break; + } + case "recursiveMember": { + memberValidators["recursiveMember"] = new __CompositeStructureValidator( + new __NoOpValidator(), + RecursiveShapesInputOutputNested1.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("bar").validate(obj.bar, `${path}/bar`), + ...getMemberValidator("recursiveMember").validate(obj.recursiveMember, `${path}/recursiveMember`), + ]; + }; +} + +export interface RecursiveShapesInputOutput { + nested?: RecursiveShapesInputOutputNested1; +} + +export namespace RecursiveShapesInputOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: RecursiveShapesInputOutput): any => ({ + ...obj, + }); + const memberValidators: { + nested?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: RecursiveShapesInputOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable { + if (memberValidators[member] === undefined) { + switch (member) { + case "nested": { + memberValidators["nested"] = new __CompositeStructureValidator( + new __NoOpValidator(), + RecursiveShapesInputOutputNested1.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("nested").validate(obj.nested, `${path}/nested`)]; + }; +} diff --git a/private/aws-restjson-server/src/protocols/Aws_restJson1.ts b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts new file mode 100644 index 000000000000..19fdf987b7a0 --- /dev/null +++ b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts @@ -0,0 +1,7966 @@ +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } 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, + 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, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { + acceptMatches as __acceptMatches, + NotAcceptableException as __NotAcceptableException, + SerializationException as __SerializationException, + ServerSerdeContext, + ServiceException as __BaseException, + SmithyFrameworkException as __SmithyFrameworkException, + UnsupportedMediaTypeException as __UnsupportedMediaTypeException, +} from "@aws-smithy/server-common"; + +import { + ComplexError, + ComplexNestedErrorData, + FooEnum, + FooError, + GreetingStruct, + InvalidGreeting, + MyUnion, + NestedPayload, + PayloadConfig, + PlayerAction, + RecursiveShapesInputOutputNested1, + RecursiveShapesInputOutputNested2, + RenamedGreeting, + SimpleUnion, + StructureListMember, + TestConfig, + Unit, +} from "../models/models_0"; +import { + AllQueryStringTypesServerInput, + AllQueryStringTypesServerOutput, +} from "../server/operations/AllQueryStringTypes"; +import { + ConstantAndVariableQueryStringServerInput, + ConstantAndVariableQueryStringServerOutput, +} from "../server/operations/ConstantAndVariableQueryString"; +import { + ConstantQueryStringServerInput, + ConstantQueryStringServerOutput, +} from "../server/operations/ConstantQueryString"; +import { DocumentTypeServerInput, DocumentTypeServerOutput } from "../server/operations/DocumentType"; +import { + DocumentTypeAsPayloadServerInput, + DocumentTypeAsPayloadServerOutput, +} from "../server/operations/DocumentTypeAsPayload"; +import { + EmptyInputAndEmptyOutputServerInput, + EmptyInputAndEmptyOutputServerOutput, +} from "../server/operations/EmptyInputAndEmptyOutput"; +import { EndpointOperationServerInput, EndpointOperationServerOutput } from "../server/operations/EndpointOperation"; +import { + EndpointWithHostLabelOperationServerInput, + EndpointWithHostLabelOperationServerOutput, +} from "../server/operations/EndpointWithHostLabelOperation"; +import { GreetingWithErrorsServerInput, GreetingWithErrorsServerOutput } from "../server/operations/GreetingWithErrors"; +import { + HostWithPathOperationServerInput, + HostWithPathOperationServerOutput, +} from "../server/operations/HostWithPathOperation"; +import { + HttpChecksumRequiredServerInput, + HttpChecksumRequiredServerOutput, +} from "../server/operations/HttpChecksumRequired"; +import { HttpEnumPayloadServerInput, HttpEnumPayloadServerOutput } from "../server/operations/HttpEnumPayload"; +import { HttpPayloadTraitsServerInput, HttpPayloadTraitsServerOutput } from "../server/operations/HttpPayloadTraits"; +import { + HttpPayloadTraitsWithMediaTypeServerInput, + HttpPayloadTraitsWithMediaTypeServerOutput, +} from "../server/operations/HttpPayloadTraitsWithMediaType"; +import { + HttpPayloadWithStructureServerInput, + HttpPayloadWithStructureServerOutput, +} from "../server/operations/HttpPayloadWithStructure"; +import { HttpPrefixHeadersServerInput, HttpPrefixHeadersServerOutput } from "../server/operations/HttpPrefixHeaders"; +import { + HttpPrefixHeadersInResponseServerInput, + HttpPrefixHeadersInResponseServerOutput, +} from "../server/operations/HttpPrefixHeadersInResponse"; +import { + HttpRequestWithFloatLabelsServerInput, + HttpRequestWithFloatLabelsServerOutput, +} from "../server/operations/HttpRequestWithFloatLabels"; +import { + HttpRequestWithGreedyLabelInPathServerInput, + HttpRequestWithGreedyLabelInPathServerOutput, +} from "../server/operations/HttpRequestWithGreedyLabelInPath"; +import { + HttpRequestWithLabelsServerInput, + HttpRequestWithLabelsServerOutput, +} from "../server/operations/HttpRequestWithLabels"; +import { + HttpRequestWithLabelsAndTimestampFormatServerInput, + HttpRequestWithLabelsAndTimestampFormatServerOutput, +} from "../server/operations/HttpRequestWithLabelsAndTimestampFormat"; +import { + HttpRequestWithRegexLiteralServerInput, + HttpRequestWithRegexLiteralServerOutput, +} from "../server/operations/HttpRequestWithRegexLiteral"; +import { HttpResponseCodeServerInput, HttpResponseCodeServerOutput } from "../server/operations/HttpResponseCode"; +import { HttpStringPayloadServerInput, HttpStringPayloadServerOutput } from "../server/operations/HttpStringPayload"; +import { + IgnoreQueryParamsInResponseServerInput, + IgnoreQueryParamsInResponseServerOutput, +} from "../server/operations/IgnoreQueryParamsInResponse"; +import { + InputAndOutputWithHeadersServerInput, + InputAndOutputWithHeadersServerOutput, +} from "../server/operations/InputAndOutputWithHeaders"; +import { JsonBlobsServerInput, JsonBlobsServerOutput } from "../server/operations/JsonBlobs"; +import { JsonEnumsServerInput, JsonEnumsServerOutput } from "../server/operations/JsonEnums"; +import { JsonListsServerInput, JsonListsServerOutput } from "../server/operations/JsonLists"; +import { JsonMapsServerInput, JsonMapsServerOutput } from "../server/operations/JsonMaps"; +import { JsonTimestampsServerInput, JsonTimestampsServerOutput } from "../server/operations/JsonTimestamps"; +import { JsonUnionsServerInput, JsonUnionsServerOutput } from "../server/operations/JsonUnions"; +import { + MalformedAcceptWithBodyServerInput, + MalformedAcceptWithBodyServerOutput, +} from "../server/operations/MalformedAcceptWithBody"; +import { + MalformedAcceptWithGenericStringServerInput, + MalformedAcceptWithGenericStringServerOutput, +} from "../server/operations/MalformedAcceptWithGenericString"; +import { + MalformedAcceptWithPayloadServerInput, + MalformedAcceptWithPayloadServerOutput, +} from "../server/operations/MalformedAcceptWithPayload"; +import { MalformedBlobServerInput, MalformedBlobServerOutput } from "../server/operations/MalformedBlob"; +import { MalformedBooleanServerInput, MalformedBooleanServerOutput } from "../server/operations/MalformedBoolean"; +import { MalformedByteServerInput, MalformedByteServerOutput } from "../server/operations/MalformedByte"; +import { + MalformedContentTypeWithBodyServerInput, + MalformedContentTypeWithBodyServerOutput, +} from "../server/operations/MalformedContentTypeWithBody"; +import { + MalformedContentTypeWithGenericStringServerInput, + MalformedContentTypeWithGenericStringServerOutput, +} from "../server/operations/MalformedContentTypeWithGenericString"; +import { + MalformedContentTypeWithoutBodyServerInput, + MalformedContentTypeWithoutBodyServerOutput, +} from "../server/operations/MalformedContentTypeWithoutBody"; +import { + MalformedContentTypeWithPayloadServerInput, + MalformedContentTypeWithPayloadServerOutput, +} from "../server/operations/MalformedContentTypeWithPayload"; +import { MalformedDoubleServerInput, MalformedDoubleServerOutput } from "../server/operations/MalformedDouble"; +import { MalformedFloatServerInput, MalformedFloatServerOutput } from "../server/operations/MalformedFloat"; +import { MalformedIntegerServerInput, MalformedIntegerServerOutput } from "../server/operations/MalformedInteger"; +import { MalformedListServerInput, MalformedListServerOutput } from "../server/operations/MalformedList"; +import { MalformedLongServerInput, MalformedLongServerOutput } from "../server/operations/MalformedLong"; +import { MalformedMapServerInput, MalformedMapServerOutput } from "../server/operations/MalformedMap"; +import { + MalformedRequestBodyServerInput, + MalformedRequestBodyServerOutput, +} from "../server/operations/MalformedRequestBody"; +import { MalformedSetServerInput, MalformedSetServerOutput } from "../server/operations/MalformedSet"; +import { MalformedShortServerInput, MalformedShortServerOutput } from "../server/operations/MalformedShort"; +import { MalformedStringServerInput, MalformedStringServerOutput } from "../server/operations/MalformedString"; +import { + MalformedTimestampBodyDateTimeServerInput, + MalformedTimestampBodyDateTimeServerOutput, +} from "../server/operations/MalformedTimestampBodyDateTime"; +import { + MalformedTimestampBodyDefaultServerInput, + MalformedTimestampBodyDefaultServerOutput, +} from "../server/operations/MalformedTimestampBodyDefault"; +import { + MalformedTimestampBodyHttpDateServerInput, + MalformedTimestampBodyHttpDateServerOutput, +} from "../server/operations/MalformedTimestampBodyHttpDate"; +import { + MalformedTimestampHeaderDateTimeServerInput, + MalformedTimestampHeaderDateTimeServerOutput, +} from "../server/operations/MalformedTimestampHeaderDateTime"; +import { + MalformedTimestampHeaderDefaultServerInput, + MalformedTimestampHeaderDefaultServerOutput, +} from "../server/operations/MalformedTimestampHeaderDefault"; +import { + MalformedTimestampHeaderEpochServerInput, + MalformedTimestampHeaderEpochServerOutput, +} from "../server/operations/MalformedTimestampHeaderEpoch"; +import { + MalformedTimestampPathDefaultServerInput, + MalformedTimestampPathDefaultServerOutput, +} from "../server/operations/MalformedTimestampPathDefault"; +import { + MalformedTimestampPathEpochServerInput, + MalformedTimestampPathEpochServerOutput, +} from "../server/operations/MalformedTimestampPathEpoch"; +import { + MalformedTimestampPathHttpDateServerInput, + MalformedTimestampPathHttpDateServerOutput, +} from "../server/operations/MalformedTimestampPathHttpDate"; +import { + MalformedTimestampQueryDefaultServerInput, + MalformedTimestampQueryDefaultServerOutput, +} from "../server/operations/MalformedTimestampQueryDefault"; +import { + MalformedTimestampQueryEpochServerInput, + MalformedTimestampQueryEpochServerOutput, +} from "../server/operations/MalformedTimestampQueryEpoch"; +import { + MalformedTimestampQueryHttpDateServerInput, + MalformedTimestampQueryHttpDateServerOutput, +} from "../server/operations/MalformedTimestampQueryHttpDate"; +import { MalformedUnionServerInput, MalformedUnionServerOutput } from "../server/operations/MalformedUnion"; +import { MediaTypeHeaderServerInput, MediaTypeHeaderServerOutput } from "../server/operations/MediaTypeHeader"; +import { NoInputAndNoOutputServerInput, NoInputAndNoOutputServerOutput } from "../server/operations/NoInputAndNoOutput"; +import { NoInputAndOutputServerInput, NoInputAndOutputServerOutput } from "../server/operations/NoInputAndOutput"; +import { + NullAndEmptyHeadersClientServerInput, + NullAndEmptyHeadersClientServerOutput, +} from "../server/operations/NullAndEmptyHeadersClient"; +import { + NullAndEmptyHeadersServerServerInput, + NullAndEmptyHeadersServerServerOutput, +} from "../server/operations/NullAndEmptyHeadersServer"; +import { + OmitsNullSerializesEmptyStringServerInput, + OmitsNullSerializesEmptyStringServerOutput, +} from "../server/operations/OmitsNullSerializesEmptyString"; +import { PostPlayerActionServerInput, PostPlayerActionServerOutput } from "../server/operations/PostPlayerAction"; +import { + QueryIdempotencyTokenAutoFillServerInput, + QueryIdempotencyTokenAutoFillServerOutput, +} from "../server/operations/QueryIdempotencyTokenAutoFill"; +import { + QueryParamsAsStringListMapServerInput, + QueryParamsAsStringListMapServerOutput, +} from "../server/operations/QueryParamsAsStringListMap"; +import { QueryPrecedenceServerInput, QueryPrecedenceServerOutput } from "../server/operations/QueryPrecedence"; +import { RecursiveShapesServerInput, RecursiveShapesServerOutput } from "../server/operations/RecursiveShapes"; +import { + SimpleScalarPropertiesServerInput, + SimpleScalarPropertiesServerOutput, +} from "../server/operations/SimpleScalarProperties"; +import { StreamingTraitsServerInput, StreamingTraitsServerOutput } from "../server/operations/StreamingTraits"; +import { + StreamingTraitsRequireLengthServerInput, + StreamingTraitsRequireLengthServerOutput, +} from "../server/operations/StreamingTraitsRequireLength"; +import { + StreamingTraitsWithMediaTypeServerInput, + StreamingTraitsWithMediaTypeServerOutput, +} from "../server/operations/StreamingTraitsWithMediaType"; +import { TestBodyStructureServerInput, TestBodyStructureServerOutput } from "../server/operations/TestBodyStructure"; +import { TestNoPayloadServerInput, TestNoPayloadServerOutput } from "../server/operations/TestNoPayload"; +import { TestPayloadBlobServerInput, TestPayloadBlobServerOutput } from "../server/operations/TestPayloadBlob"; +import { + TestPayloadStructureServerInput, + TestPayloadStructureServerOutput, +} from "../server/operations/TestPayloadStructure"; +import { + TimestampFormatHeadersServerInput, + TimestampFormatHeadersServerOutput, +} from "../server/operations/TimestampFormatHeaders"; +import { UnitInputAndOutputServerInput, UnitInputAndOutputServerOutput } from "../server/operations/UnitInputAndOutput"; + +export const deserializeAllQueryStringTypesRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: AllQueryStringTypesServerInput = { + queryBoolean: undefined, + queryBooleanList: undefined, + queryByte: undefined, + queryDouble: undefined, + queryDoubleList: undefined, + queryEnum: undefined, + queryEnumList: undefined, + queryFloat: undefined, + queryInteger: undefined, + queryIntegerList: undefined, + queryIntegerSet: undefined, + queryLong: undefined, + queryParamsMapOfStringList: undefined, + queryShort: undefined, + queryString: undefined, + queryStringList: undefined, + queryStringSet: undefined, + queryTimestamp: undefined, + queryTimestampList: undefined, + }; + const query = output.query; + if (query !== undefined && query !== null) { + if (query["String"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["String"])) { + if (query["String"].length === 1) { + queryValue = query["String"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["String"] as string; + } + contents.queryString = queryValue; + } + if (query["StringList"] !== undefined) { + const queryValue = Array.isArray(query["StringList"]) + ? (query["StringList"] as string[]) + : [query["StringList"] as string]; + contents.queryStringList = queryValue.map((_entry) => _entry.trim() as any); + } + if (query["StringSet"] !== undefined) { + const queryValue = Array.isArray(query["StringSet"]) + ? (query["StringSet"] as string[]) + : [query["StringSet"] as string]; + contents.queryStringSet = queryValue.map((_entry) => _entry.trim() as any); + } + if (query["Byte"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Byte"])) { + if (query["Byte"].length === 1) { + queryValue = query["Byte"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Byte"] as string; + } + contents.queryByte = __strictParseByte(queryValue); + } + if (query["Short"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Short"])) { + if (query["Short"].length === 1) { + queryValue = query["Short"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Short"] as string; + } + contents.queryShort = __strictParseShort(queryValue); + } + if (query["Integer"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Integer"])) { + if (query["Integer"].length === 1) { + queryValue = query["Integer"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Integer"] as string; + } + contents.queryInteger = __strictParseInt32(queryValue); + } + if (query["IntegerList"] !== undefined) { + const queryValue = Array.isArray(query["IntegerList"]) + ? (query["IntegerList"] as string[]) + : [query["IntegerList"] as string]; + contents.queryIntegerList = queryValue.map((_entry) => __strictParseInt32(_entry.trim()) as any); + } + if (query["IntegerSet"] !== undefined) { + const queryValue = Array.isArray(query["IntegerSet"]) + ? (query["IntegerSet"] as string[]) + : [query["IntegerSet"] as string]; + contents.queryIntegerSet = queryValue.map((_entry) => __strictParseInt32(_entry.trim()) as any); + } + if (query["Long"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Long"])) { + if (query["Long"].length === 1) { + queryValue = query["Long"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Long"] as string; + } + contents.queryLong = __strictParseLong(queryValue); + } + if (query["Float"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Float"])) { + if (query["Float"].length === 1) { + queryValue = query["Float"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Float"] as string; + } + contents.queryFloat = __strictParseFloat(queryValue); + } + if (query["Double"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Double"])) { + if (query["Double"].length === 1) { + queryValue = query["Double"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Double"] as string; + } + contents.queryDouble = __strictParseDouble(queryValue); + } + if (query["DoubleList"] !== undefined) { + const queryValue = Array.isArray(query["DoubleList"]) + ? (query["DoubleList"] as string[]) + : [query["DoubleList"] as string]; + contents.queryDoubleList = queryValue.map((_entry) => __strictParseDouble(_entry.trim()) as any); + } + if (query["Boolean"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Boolean"])) { + if (query["Boolean"].length === 1) { + queryValue = query["Boolean"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Boolean"] as string; + } + contents.queryBoolean = __parseBoolean(queryValue); + } + if (query["BooleanList"] !== undefined) { + const queryValue = Array.isArray(query["BooleanList"]) + ? (query["BooleanList"] as string[]) + : [query["BooleanList"] as string]; + contents.queryBooleanList = queryValue.map((_entry) => __parseBoolean(_entry.trim()) as any); + } + if (query["Timestamp"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Timestamp"])) { + if (query["Timestamp"].length === 1) { + queryValue = query["Timestamp"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Timestamp"] as string; + } + contents.queryTimestamp = __expectNonNull(__parseRfc3339DateTime(queryValue)); + } + if (query["TimestampList"] !== undefined) { + const queryValue = Array.isArray(query["TimestampList"]) + ? (query["TimestampList"] as string[]) + : [query["TimestampList"] as string]; + contents.queryTimestampList = queryValue.map( + (_entry) => __expectNonNull(__parseRfc3339DateTime(_entry.trim())) as any + ); + } + if (query["Enum"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["Enum"])) { + if (query["Enum"].length === 1) { + queryValue = query["Enum"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["Enum"] as string; + } + contents.queryEnum = queryValue; + } + if (query["EnumList"] !== undefined) { + const queryValue = Array.isArray(query["EnumList"]) + ? (query["EnumList"] as string[]) + : [query["EnumList"] as string]; + contents.queryEnumList = queryValue.map((_entry) => _entry.trim() as any); + } + const parsedQuery: { [key: string]: string[] } = {}; + for (const [key, value] of Object.entries(query)) { + let queryValue: string; + const valueArray = Array.isArray(value) ? (value as string[]) : [value as string]; + parsedQuery[key] = valueArray.map((_entry) => _entry.trim() as any); + } + contents.queryParamsMapOfStringList = parsedQuery; + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +export const deserializeConstantAndVariableQueryStringRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: ConstantAndVariableQueryStringServerInput = { + baz: undefined, + maybeSet: undefined, + }; + const query = output.query; + if (query !== undefined && query !== null) { + if (query["baz"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["baz"])) { + if (query["baz"].length === 1) { + queryValue = query["baz"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["baz"] as string; + } + contents.baz = queryValue; + } + if (query["maybeSet"] !== undefined) { + let queryValue: string; + if (Array.isArray(query["maybeSet"])) { + if (query["maybeSet"].length === 1) { + queryValue = query["maybeSet"][0]; + } else { + throw new __SerializationException(); + } + } else { + queryValue = query["maybeSet"] as string; + } + contents.maybeSet = queryValue; + } + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +export const deserializeConstantQueryStringRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: ConstantQueryStringServerInput = { + hello: undefined, + }; + const pathRegex = new RegExp("/ConstantQueryString/(?[^/]+)"); + const parsedPath = output.path.match(pathRegex); + if (parsedPath?.groups !== undefined) { + contents.hello = decodeURIComponent(parsedPath.groups.hello); + } + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +export const deserializeDocumentTypeRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: DocumentTypeServerInput = { + 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); +}; + +export const deserializeDocumentTypeAsPayloadRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: DocumentTypeAsPayloadServerInput = { + documentValue: undefined, + }; + const data: any = await collectBodyString(output.body, context); + contents.documentValue = data; + contents.documentValue = JSON.parse(data); + return Promise.resolve(contents); +}; + +export const deserializeEmptyInputAndEmptyOutputRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: EmptyInputAndEmptyOutputServerInput = {}; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +export const deserializeEndpointOperationRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined) { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: EndpointOperationServerInput = {}; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +export const deserializeEndpointWithHostLabelOperationRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey !== undefined && contentTypeHeaderKey !== null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey !== undefined && acceptHeaderKey !== null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: EndpointWithHostLabelOperationServerInput = { + label: undefined, + }; + const hostRegex = new RegExp("^foo\\.(?