import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseEpochTimestamp as __parseEpochTimestamp , serializeFloat as __serializeFloat , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { CreateApiKeyCommandInput , CreateApiKeyCommandOutput } from "../commands/CreateApiKeyCommand" ; import { CreateAuthorizerCommandInput , CreateAuthorizerCommandOutput } from "../commands/CreateAuthorizerCommand" ; import { CreateBasePathMappingCommandInput , CreateBasePathMappingCommandOutput , } from "../commands/CreateBasePathMappingCommand" ; import { CreateDeploymentCommandInput , CreateDeploymentCommandOutput } from "../commands/CreateDeploymentCommand" ; import { CreateDocumentationPartCommandInput , CreateDocumentationPartCommandOutput , } from "../commands/CreateDocumentationPartCommand" ; import { CreateDocumentationVersionCommandInput , CreateDocumentationVersionCommandOutput , } from "../commands/CreateDocumentationVersionCommand" ; import { CreateDomainNameCommandInput , CreateDomainNameCommandOutput } from "../commands/CreateDomainNameCommand" ; import { CreateModelCommandInput , CreateModelCommandOutput } from "../commands/CreateModelCommand" ; import { CreateRequestValidatorCommandInput , CreateRequestValidatorCommandOutput , } from "../commands/CreateRequestValidatorCommand" ; import { CreateResourceCommandInput , CreateResourceCommandOutput } from "../commands/CreateResourceCommand" ; import { CreateRestApiCommandInput , CreateRestApiCommandOutput } from "../commands/CreateRestApiCommand" ; import { CreateStageCommandInput , CreateStageCommandOutput } from "../commands/CreateStageCommand" ; import { CreateUsagePlanCommandInput , CreateUsagePlanCommandOutput } from "../commands/CreateUsagePlanCommand" ; import { CreateUsagePlanKeyCommandInput , CreateUsagePlanKeyCommandOutput } from "../commands/CreateUsagePlanKeyCommand" ; import { CreateVpcLinkCommandInput , CreateVpcLinkCommandOutput } from "../commands/CreateVpcLinkCommand" ; import { DeleteApiKeyCommandInput , DeleteApiKeyCommandOutput } from "../commands/DeleteApiKeyCommand" ; import { DeleteAuthorizerCommandInput , DeleteAuthorizerCommandOutput } from "../commands/DeleteAuthorizerCommand" ; import { DeleteBasePathMappingCommandInput , DeleteBasePathMappingCommandOutput , } from "../commands/DeleteBasePathMappingCommand" ; import { DeleteClientCertificateCommandInput , DeleteClientCertificateCommandOutput , } from "../commands/DeleteClientCertificateCommand" ; import { DeleteDeploymentCommandInput , DeleteDeploymentCommandOutput } from "../commands/DeleteDeploymentCommand" ; import { DeleteDocumentationPartCommandInput , DeleteDocumentationPartCommandOutput , } from "../commands/DeleteDocumentationPartCommand" ; import { DeleteDocumentationVersionCommandInput , DeleteDocumentationVersionCommandOutput , } from "../commands/DeleteDocumentationVersionCommand" ; import { DeleteDomainNameCommandInput , DeleteDomainNameCommandOutput } from "../commands/DeleteDomainNameCommand" ; import { DeleteGatewayResponseCommandInput , DeleteGatewayResponseCommandOutput , } from "../commands/DeleteGatewayResponseCommand" ; import { DeleteIntegrationCommandInput , DeleteIntegrationCommandOutput } from "../commands/DeleteIntegrationCommand" ; import { DeleteIntegrationResponseCommandInput , DeleteIntegrationResponseCommandOutput , } from "../commands/DeleteIntegrationResponseCommand" ; import { DeleteMethodCommandInput , DeleteMethodCommandOutput } from "../commands/DeleteMethodCommand" ; import { DeleteMethodResponseCommandInput , DeleteMethodResponseCommandOutput , } from "../commands/DeleteMethodResponseCommand" ; import { DeleteModelCommandInput , DeleteModelCommandOutput } from "../commands/DeleteModelCommand" ; import { DeleteRequestValidatorCommandInput , DeleteRequestValidatorCommandOutput , } from "../commands/DeleteRequestValidatorCommand" ; import { DeleteResourceCommandInput , DeleteResourceCommandOutput } from "../commands/DeleteResourceCommand" ; import { DeleteRestApiCommandInput , DeleteRestApiCommandOutput } from "../commands/DeleteRestApiCommand" ; import { DeleteStageCommandInput , DeleteStageCommandOutput } from "../commands/DeleteStageCommand" ; import { DeleteUsagePlanCommandInput , DeleteUsagePlanCommandOutput } from "../commands/DeleteUsagePlanCommand" ; import { DeleteUsagePlanKeyCommandInput , DeleteUsagePlanKeyCommandOutput } from "../commands/DeleteUsagePlanKeyCommand" ; import { DeleteVpcLinkCommandInput , DeleteVpcLinkCommandOutput } from "../commands/DeleteVpcLinkCommand" ; import { FlushStageAuthorizersCacheCommandInput , FlushStageAuthorizersCacheCommandOutput , } from "../commands/FlushStageAuthorizersCacheCommand" ; import { FlushStageCacheCommandInput , FlushStageCacheCommandOutput } from "../commands/FlushStageCacheCommand" ; import { GenerateClientCertificateCommandInput , GenerateClientCertificateCommandOutput , } from "../commands/GenerateClientCertificateCommand" ; import { GetAccountCommandInput , GetAccountCommandOutput } from "../commands/GetAccountCommand" ; import { GetApiKeyCommandInput , GetApiKeyCommandOutput } from "../commands/GetApiKeyCommand" ; import { GetApiKeysCommandInput , GetApiKeysCommandOutput } from "../commands/GetApiKeysCommand" ; import { GetAuthorizerCommandInput , GetAuthorizerCommandOutput } from "../commands/GetAuthorizerCommand" ; import { GetAuthorizersCommandInput , GetAuthorizersCommandOutput } from "../commands/GetAuthorizersCommand" ; import { GetBasePathMappingCommandInput , GetBasePathMappingCommandOutput } from "../commands/GetBasePathMappingCommand" ; import { GetBasePathMappingsCommandInput , GetBasePathMappingsCommandOutput , } from "../commands/GetBasePathMappingsCommand" ; import { GetClientCertificateCommandInput , GetClientCertificateCommandOutput , } from "../commands/GetClientCertificateCommand" ; import { GetClientCertificatesCommandInput , GetClientCertificatesCommandOutput , } from "../commands/GetClientCertificatesCommand" ; import { GetDeploymentCommandInput , GetDeploymentCommandOutput } from "../commands/GetDeploymentCommand" ; import { GetDeploymentsCommandInput , GetDeploymentsCommandOutput } from "../commands/GetDeploymentsCommand" ; import { GetDocumentationPartCommandInput , GetDocumentationPartCommandOutput , } from "../commands/GetDocumentationPartCommand" ; import { GetDocumentationPartsCommandInput , GetDocumentationPartsCommandOutput , } from "../commands/GetDocumentationPartsCommand" ; import { GetDocumentationVersionCommandInput , GetDocumentationVersionCommandOutput , } from "../commands/GetDocumentationVersionCommand" ; import { GetDocumentationVersionsCommandInput , GetDocumentationVersionsCommandOutput , } from "../commands/GetDocumentationVersionsCommand" ; import { GetDomainNameCommandInput , GetDomainNameCommandOutput } from "../commands/GetDomainNameCommand" ; import { GetDomainNamesCommandInput , GetDomainNamesCommandOutput } from "../commands/GetDomainNamesCommand" ; import { GetExportCommandInput , GetExportCommandOutput } from "../commands/GetExportCommand" ; import { GetGatewayResponseCommandInput , GetGatewayResponseCommandOutput } from "../commands/GetGatewayResponseCommand" ; import { GetGatewayResponsesCommandInput , GetGatewayResponsesCommandOutput , } from "../commands/GetGatewayResponsesCommand" ; import { GetIntegrationCommandInput , GetIntegrationCommandOutput } from "../commands/GetIntegrationCommand" ; import { GetIntegrationResponseCommandInput , GetIntegrationResponseCommandOutput , } from "../commands/GetIntegrationResponseCommand" ; import { GetMethodCommandInput , GetMethodCommandOutput } from "../commands/GetMethodCommand" ; import { GetMethodResponseCommandInput , GetMethodResponseCommandOutput } from "../commands/GetMethodResponseCommand" ; import { GetModelCommandInput , GetModelCommandOutput } from "../commands/GetModelCommand" ; import { GetModelsCommandInput , GetModelsCommandOutput } from "../commands/GetModelsCommand" ; import { GetModelTemplateCommandInput , GetModelTemplateCommandOutput } from "../commands/GetModelTemplateCommand" ; import { GetRequestValidatorCommandInput , GetRequestValidatorCommandOutput , } from "../commands/GetRequestValidatorCommand" ; import { GetRequestValidatorsCommandInput , GetRequestValidatorsCommandOutput , } from "../commands/GetRequestValidatorsCommand" ; import { GetResourceCommandInput , GetResourceCommandOutput } from "../commands/GetResourceCommand" ; import { GetResourcesCommandInput , GetResourcesCommandOutput } from "../commands/GetResourcesCommand" ; import { GetRestApiCommandInput , GetRestApiCommandOutput } from "../commands/GetRestApiCommand" ; import { GetRestApisCommandInput , GetRestApisCommandOutput } from "../commands/GetRestApisCommand" ; import { GetSdkCommandInput , GetSdkCommandOutput } from "../commands/GetSdkCommand" ; import { GetSdkTypeCommandInput , GetSdkTypeCommandOutput } from "../commands/GetSdkTypeCommand" ; import { GetSdkTypesCommandInput , GetSdkTypesCommandOutput } from "../commands/GetSdkTypesCommand" ; import { GetStageCommandInput , GetStageCommandOutput } from "../commands/GetStageCommand" ; import { GetStagesCommandInput , GetStagesCommandOutput } from "../commands/GetStagesCommand" ; import { GetTagsCommandInput , GetTagsCommandOutput } from "../commands/GetTagsCommand" ; import { GetUsageCommandInput , GetUsageCommandOutput } from "../commands/GetUsageCommand" ; import { GetUsagePlanCommandInput , GetUsagePlanCommandOutput } from "../commands/GetUsagePlanCommand" ; import { GetUsagePlanKeyCommandInput , GetUsagePlanKeyCommandOutput } from "../commands/GetUsagePlanKeyCommand" ; import { GetUsagePlanKeysCommandInput , GetUsagePlanKeysCommandOutput } from "../commands/GetUsagePlanKeysCommand" ; import { GetUsagePlansCommandInput , GetUsagePlansCommandOutput } from "../commands/GetUsagePlansCommand" ; import { GetVpcLinkCommandInput , GetVpcLinkCommandOutput } from "../commands/GetVpcLinkCommand" ; import { GetVpcLinksCommandInput , GetVpcLinksCommandOutput } from "../commands/GetVpcLinksCommand" ; import { ImportApiKeysCommandInput , ImportApiKeysCommandOutput } from "../commands/ImportApiKeysCommand" ; import { ImportDocumentationPartsCommandInput , ImportDocumentationPartsCommandOutput , } from "../commands/ImportDocumentationPartsCommand" ; import { ImportRestApiCommandInput , ImportRestApiCommandOutput } from "../commands/ImportRestApiCommand" ; import { PutGatewayResponseCommandInput , PutGatewayResponseCommandOutput } from "../commands/PutGatewayResponseCommand" ; import { PutIntegrationCommandInput , PutIntegrationCommandOutput } from "../commands/PutIntegrationCommand" ; import { PutIntegrationResponseCommandInput , PutIntegrationResponseCommandOutput , } from "../commands/PutIntegrationResponseCommand" ; import { PutMethodCommandInput , PutMethodCommandOutput } from "../commands/PutMethodCommand" ; import { PutMethodResponseCommandInput , PutMethodResponseCommandOutput } from "../commands/PutMethodResponseCommand" ; import { PutRestApiCommandInput , PutRestApiCommandOutput } from "../commands/PutRestApiCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { TestInvokeAuthorizerCommandInput , TestInvokeAuthorizerCommandOutput , } from "../commands/TestInvokeAuthorizerCommand" ; import { TestInvokeMethodCommandInput , TestInvokeMethodCommandOutput } from "../commands/TestInvokeMethodCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateAccountCommandInput , UpdateAccountCommandOutput } from "../commands/UpdateAccountCommand" ; import { UpdateApiKeyCommandInput , UpdateApiKeyCommandOutput } from "../commands/UpdateApiKeyCommand" ; import { UpdateAuthorizerCommandInput , UpdateAuthorizerCommandOutput } from "../commands/UpdateAuthorizerCommand" ; import { UpdateBasePathMappingCommandInput , UpdateBasePathMappingCommandOutput , } from "../commands/UpdateBasePathMappingCommand" ; import { UpdateClientCertificateCommandInput , UpdateClientCertificateCommandOutput , } from "../commands/UpdateClientCertificateCommand" ; import { UpdateDeploymentCommandInput , UpdateDeploymentCommandOutput } from "../commands/UpdateDeploymentCommand" ; import { UpdateDocumentationPartCommandInput , UpdateDocumentationPartCommandOutput , } from "../commands/UpdateDocumentationPartCommand" ; import { UpdateDocumentationVersionCommandInput , UpdateDocumentationVersionCommandOutput , } from "../commands/UpdateDocumentationVersionCommand" ; import { UpdateDomainNameCommandInput , UpdateDomainNameCommandOutput } from "../commands/UpdateDomainNameCommand" ; import { UpdateGatewayResponseCommandInput , UpdateGatewayResponseCommandOutput , } from "../commands/UpdateGatewayResponseCommand" ; import { UpdateIntegrationCommandInput , UpdateIntegrationCommandOutput } from "../commands/UpdateIntegrationCommand" ; import { UpdateIntegrationResponseCommandInput , UpdateIntegrationResponseCommandOutput , } from "../commands/UpdateIntegrationResponseCommand" ; import { UpdateMethodCommandInput , UpdateMethodCommandOutput } from "../commands/UpdateMethodCommand" ; import { UpdateMethodResponseCommandInput , UpdateMethodResponseCommandOutput , } from "../commands/UpdateMethodResponseCommand" ; import { UpdateModelCommandInput , UpdateModelCommandOutput } from "../commands/UpdateModelCommand" ; import { UpdateRequestValidatorCommandInput , UpdateRequestValidatorCommandOutput , } from "../commands/UpdateRequestValidatorCommand" ; import { UpdateResourceCommandInput , UpdateResourceCommandOutput } from "../commands/UpdateResourceCommand" ; import { UpdateRestApiCommandInput , UpdateRestApiCommandOutput } from "../commands/UpdateRestApiCommand" ; import { UpdateStageCommandInput , UpdateStageCommandOutput } from "../commands/UpdateStageCommand" ; import { UpdateUsageCommandInput , UpdateUsageCommandOutput } from "../commands/UpdateUsageCommand" ; import { UpdateUsagePlanCommandInput , UpdateUsagePlanCommandOutput } from "../commands/UpdateUsagePlanCommand" ; import { UpdateVpcLinkCommandInput , UpdateVpcLinkCommandOutput } from "../commands/UpdateVpcLinkCommand" ; import { AccessLogSettings , ApiKey , ApiStage , Authorizer , BadRequestException , BasePathMapping , CanarySettings , ClientCertificate , ConflictException , Deployment , DeploymentCanarySettings , DocumentationPart , DocumentationPartLocation , DocumentationVersion , DomainName , EndpointConfiguration , EndpointType , GatewayResponse , Integration , IntegrationResponse , LimitExceededException , Method , MethodResponse , MethodSetting , MethodSnapshot , Model , MutualTlsAuthentication , MutualTlsAuthenticationInput , NotFoundException , PatchOperation , QuotaSettings , RequestValidator , Resource , RestApi , SdkConfigurationProperty , SdkType , ServiceUnavailableException , Stage , StageKey , ThrottleSettings , TlsConfig , TooManyRequestsException , UnauthorizedException , UsagePlan , UsagePlanKey , VpcLink , } from "../models/models_0" ; export const serializeAws_restJson1CreateApiKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys" ; let body ; body = JSON . stringify ( { ... ( input . customerId !== undefined && input . customerId !== null && { customerId : input . customerId } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . enabled !== undefined && input . enabled !== null && { enabled : input . enabled } ) , ... ( input . generateDistinctId !== undefined && input . generateDistinctId !== null && { generateDistinctId : input . generateDistinctId } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . stageKeys !== undefined && input . stageKeys !== null && { stageKeys : serializeAws_restJson1ListOfStageKeys ( input . stageKeys , context ) } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , ... ( input . value !== undefined && input . value !== null && { value : input . value } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateAuthorizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . authType !== undefined && input . authType !== null && { authType : input . authType } ) , ... ( input . authorizerCredentials !== undefined && input . authorizerCredentials !== null && { authorizerCredentials : input . authorizerCredentials } ) , ... ( input . authorizerResultTtlInSeconds !== undefined && input . authorizerResultTtlInSeconds !== null && { authorizerResultTtlInSeconds : input . authorizerResultTtlInSeconds , } ) , ... ( input . authorizerUri !== undefined && input . authorizerUri !== null && { authorizerUri : input . authorizerUri } ) , ... ( input . identitySource !== undefined && input . identitySource !== null && { identitySource : input . identitySource } ) , ... ( input . identityValidationExpression !== undefined && input . identityValidationExpression !== null && { identityValidationExpression : input . identityValidationExpression , } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . providerARNs !== undefined && input . providerARNs !== null && { providerARNs : serializeAws_restJson1ListOfARNs ( input . providerARNs , context ) } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateBasePathMappingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}/basepathmappings" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } let body ; body = JSON . stringify ( { ... ( input . basePath !== undefined && input . basePath !== null && { basePath : input . basePath } ) , ... ( input . restApiId !== undefined && input . restApiId !== null && { restApiId : input . restApiId } ) , ... ( input . stage !== undefined && input . stage !== null && { stage : input . stage } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDeploymentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/deployments" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . cacheClusterEnabled !== undefined && input . cacheClusterEnabled !== null && { cacheClusterEnabled : input . cacheClusterEnabled } ) , ... ( input . cacheClusterSize !== undefined && input . cacheClusterSize !== null && { cacheClusterSize : input . cacheClusterSize } ) , ... ( input . canarySettings !== undefined && input . canarySettings !== null && { canarySettings : serializeAws_restJson1DeploymentCanarySettings ( input . canarySettings , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . stageDescription !== undefined && input . stageDescription !== null && { stageDescription : input . stageDescription } ) , ... ( input . stageName !== undefined && input . stageName !== null && { stageName : input . stageName } ) , ... ( input . tracingEnabled !== undefined && input . tracingEnabled !== null && { tracingEnabled : input . tracingEnabled } ) , ... ( input . variables !== undefined && input . variables !== null && { variables : serializeAws_restJson1MapOfStringToString ( input . variables , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDocumentationPartCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . location !== undefined && input . location !== null && { location : serializeAws_restJson1DocumentationPartLocation ( input . location , context ) , } ) , ... ( input . properties !== undefined && input . properties !== null && { properties : input . properties } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDocumentationVersionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/versions" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . documentationVersion !== undefined && input . documentationVersion !== null && { documentationVersion : input . documentationVersion } ) , ... ( input . stageName !== undefined && input . stageName !== null && { stageName : input . stageName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDomainNameCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames" ; let body ; body = JSON . stringify ( { ... ( input . certificateArn !== undefined && input . certificateArn !== null && { certificateArn : input . certificateArn } ) , ... ( input . certificateBody !== undefined && input . certificateBody !== null && { certificateBody : input . certificateBody } ) , ... ( input . certificateChain !== undefined && input . certificateChain !== null && { certificateChain : input . certificateChain } ) , ... ( input . certificateName !== undefined && input . certificateName !== null && { certificateName : input . certificateName } ) , ... ( input . certificatePrivateKey !== undefined && input . certificatePrivateKey !== null && { certificatePrivateKey : input . certificatePrivateKey } ) , ... ( input . domainName !== undefined && input . domainName !== null && { domainName : input . domainName } ) , ... ( input . endpointConfiguration !== undefined && input . endpointConfiguration !== null && { endpointConfiguration : serializeAws_restJson1EndpointConfiguration ( input . endpointConfiguration , context ) , } ) , ... ( input . mutualTlsAuthentication !== undefined && input . mutualTlsAuthentication !== null && { mutualTlsAuthentication : serializeAws_restJson1MutualTlsAuthenticationInput ( input . mutualTlsAuthentication , context ) , } ) , ... ( input . ownershipVerificationCertificateArn !== undefined && input . ownershipVerificationCertificateArn !== null && { ownershipVerificationCertificateArn : input . ownershipVerificationCertificateArn , } ) , ... ( input . regionalCertificateArn !== undefined && input . regionalCertificateArn !== null && { regionalCertificateArn : input . regionalCertificateArn } ) , ... ( input . regionalCertificateName !== undefined && input . regionalCertificateName !== null && { regionalCertificateName : input . regionalCertificateName } ) , ... ( input . securityPolicy !== undefined && input . securityPolicy !== null && { securityPolicy : input . securityPolicy } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . contentType !== undefined && input . contentType !== null && { contentType : input . contentType } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . schema !== undefined && input . schema !== null && { schema : input . schema } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRequestValidatorCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/requestvalidators" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . validateRequestBody !== undefined && input . validateRequestBody !== null && { validateRequestBody : input . validateRequestBody } ) , ... ( input . validateRequestParameters !== undefined && input . validateRequestParameters !== null && { validateRequestParameters : input . validateRequestParameters } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{parentId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . parentId !== undefined ) { const labelValue = input . parentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: parentId." ) ; } resolvedPath = resolvedPath . replace ( "{parentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: parentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . pathPart !== undefined && input . pathPart !== null && { pathPart : input . pathPart } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis" ; let body ; body = JSON . stringify ( { ... ( input . apiKeySource !== undefined && input . apiKeySource !== null && { apiKeySource : input . apiKeySource } ) , ... ( input . binaryMediaTypes !== undefined && input . binaryMediaTypes !== null && { binaryMediaTypes : serializeAws_restJson1ListOfString ( input . binaryMediaTypes , context ) , } ) , ... ( input . cloneFrom !== undefined && input . cloneFrom !== null && { cloneFrom : input . cloneFrom } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . disableExecuteApiEndpoint !== undefined && input . disableExecuteApiEndpoint !== null && { disableExecuteApiEndpoint : input . disableExecuteApiEndpoint } ) , ... ( input . endpointConfiguration !== undefined && input . endpointConfiguration !== null && { endpointConfiguration : serializeAws_restJson1EndpointConfiguration ( input . endpointConfiguration , context ) , } ) , ... ( input . minimumCompressionSize !== undefined && input . minimumCompressionSize !== null && { minimumCompressionSize : input . minimumCompressionSize } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . policy !== undefined && input . policy !== null && { policy : input . policy } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , ... ( input . version !== undefined && input . version !== null && { version : input . version } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateStageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . cacheClusterEnabled !== undefined && input . cacheClusterEnabled !== null && { cacheClusterEnabled : input . cacheClusterEnabled } ) , ... ( input . cacheClusterSize !== undefined && input . cacheClusterSize !== null && { cacheClusterSize : input . cacheClusterSize } ) , ... ( input . canarySettings !== undefined && input . canarySettings !== null && { canarySettings : serializeAws_restJson1CanarySettings ( input . canarySettings , context ) , } ) , ... ( input . deploymentId !== undefined && input . deploymentId !== null && { deploymentId : input . deploymentId } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . documentationVersion !== undefined && input . documentationVersion !== null && { documentationVersion : input . documentationVersion } ) , ... ( input . stageName !== undefined && input . stageName !== null && { stageName : input . stageName } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , ... ( input . tracingEnabled !== undefined && input . tracingEnabled !== null && { tracingEnabled : input . tracingEnabled } ) , ... ( input . variables !== undefined && input . variables !== null && { variables : serializeAws_restJson1MapOfStringToString ( input . variables , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateUsagePlanCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans" ; let body ; body = JSON . stringify ( { ... ( input . apiStages !== undefined && input . apiStages !== null && { apiStages : serializeAws_restJson1ListOfApiStage ( input . apiStages , context ) } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . quota !== undefined && input . quota !== null && { quota : serializeAws_restJson1QuotaSettings ( input . quota , context ) } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , ... ( input . throttle !== undefined && input . throttle !== null && { throttle : serializeAws_restJson1ThrottleSettings ( input . throttle , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateUsagePlanKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/keys" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } let body ; body = JSON . stringify ( { ... ( input . keyId !== undefined && input . keyId !== null && { keyId : input . keyId } ) , ... ( input . keyType !== undefined && input . keyType !== null && { keyType : input . keyType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateVpcLinkCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/vpclinks" ; let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , ... ( input . targetArns !== undefined && input . targetArns !== null && { targetArns : serializeAws_restJson1ListOfString ( input . targetArns , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApiKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys/{apiKey}" ; if ( input . apiKey !== undefined ) { const labelValue = input . apiKey ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiKey." ) ; } resolvedPath = resolvedPath . replace ( "{apiKey}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiKey." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAuthorizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers/{authorizerId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . authorizerId !== undefined ) { const labelValue = input . authorizerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: authorizerId." ) ; } resolvedPath = resolvedPath . replace ( "{authorizerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: authorizerId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBasePathMappingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}/basepathmappings/{basePath}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } if ( input . basePath !== undefined ) { const labelValue = input . basePath ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: basePath." ) ; } resolvedPath = resolvedPath . replace ( "{basePath}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: basePath." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteClientCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clientcertificates/{clientCertificateId}" ; if ( input . clientCertificateId !== undefined ) { const labelValue = input . clientCertificateId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: clientCertificateId." ) ; } resolvedPath = resolvedPath . replace ( "{clientCertificateId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: clientCertificateId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDeploymentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/deployments/{deploymentId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . deploymentId !== undefined ) { const labelValue = input . deploymentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deploymentId." ) ; } resolvedPath = resolvedPath . replace ( "{deploymentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deploymentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDocumentationPartCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts/{documentationPartId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationPartId !== undefined ) { const labelValue = input . documentationPartId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationPartId." ) ; } resolvedPath = resolvedPath . replace ( "{documentationPartId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationPartId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDocumentationVersionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/versions/{documentationVersion}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationVersion !== undefined ) { const labelValue = input . documentationVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationVersion." ) ; } resolvedPath = resolvedPath . replace ( "{documentationVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDomainNameCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteGatewayResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/gatewayresponses/{responseType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . responseType !== undefined ) { const labelValue = input . responseType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: responseType." ) ; } resolvedPath = resolvedPath . replace ( "{responseType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: responseType." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteIntegrationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteIntegrationResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMethodCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMethodResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models/{modelName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . modelName !== undefined ) { const labelValue = input . modelName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: modelName." ) ; } resolvedPath = resolvedPath . replace ( "{modelName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: modelName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRequestValidatorCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . requestValidatorId !== undefined ) { const labelValue = input . requestValidatorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: requestValidatorId." ) ; } resolvedPath = resolvedPath . replace ( "{requestValidatorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: requestValidatorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteStageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteUsagePlanCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteUsagePlanKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/keys/{keyId}" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } if ( input . keyId !== undefined ) { const labelValue = input . keyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: keyId." ) ; } resolvedPath = resolvedPath . replace ( "{keyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: keyId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteVpcLinkCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/vpclinks/{vpcLinkId}" ; if ( input . vpcLinkId !== undefined ) { const labelValue = input . vpcLinkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: vpcLinkId." ) ; } resolvedPath = resolvedPath . replace ( "{vpcLinkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: vpcLinkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1FlushStageAuthorizersCacheCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}/cache/authorizers" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1FlushStageCacheCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}/cache/data" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GenerateClientCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clientcertificates" ; let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApiKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys/{apiKey}" ; if ( input . apiKey !== undefined ) { const labelValue = input . apiKey ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiKey." ) ; } resolvedPath = resolvedPath . replace ( "{apiKey}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiKey." ) ; } const query = { ... ( input . includeValue !== undefined && { includeValue : input . includeValue . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetApiKeysCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , ... ( input . nameQuery !== undefined && { name : input . nameQuery } ) , ... ( input . customerId !== undefined && { customerId : input . customerId } ) , ... ( input . includeValues !== undefined && { includeValues : input . includeValues . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetAuthorizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers/{authorizerId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . authorizerId !== undefined ) { const labelValue = input . authorizerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: authorizerId." ) ; } resolvedPath = resolvedPath . replace ( "{authorizerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: authorizerId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAuthorizersCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetBasePathMappingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}/basepathmappings/{basePath}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } if ( input . basePath !== undefined ) { const labelValue = input . basePath ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: basePath." ) ; } resolvedPath = resolvedPath . replace ( "{basePath}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: basePath." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBasePathMappingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}/basepathmappings" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetClientCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clientcertificates/{clientCertificateId}" ; if ( input . clientCertificateId !== undefined ) { const labelValue = input . clientCertificateId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: clientCertificateId." ) ; } resolvedPath = resolvedPath . replace ( "{clientCertificateId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: clientCertificateId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetClientCertificatesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clientcertificates" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDeploymentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/deployments/{deploymentId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . deploymentId !== undefined ) { const labelValue = input . deploymentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deploymentId." ) ; } resolvedPath = resolvedPath . replace ( "{deploymentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deploymentId." ) ; } const query = { ... ( input . embed !== undefined && { embed : ( input . embed || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDeploymentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/deployments" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDocumentationPartCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts/{documentationPartId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationPartId !== undefined ) { const labelValue = input . documentationPartId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationPartId." ) ; } resolvedPath = resolvedPath . replace ( "{documentationPartId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationPartId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDocumentationPartsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . type !== undefined && { type : input . type } ) , ... ( input . nameQuery !== undefined && { name : input . nameQuery } ) , ... ( input . path !== undefined && { path : input . path } ) , ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , ... ( input . locationStatus !== undefined && { locationStatus : input . locationStatus } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDocumentationVersionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/versions/{documentationVersion}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationVersion !== undefined ) { const labelValue = input . documentationVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationVersion." ) ; } resolvedPath = resolvedPath . replace ( "{documentationVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDocumentationVersionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/versions" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDomainNameCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDomainNamesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetExportCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { ... ( isSerializableHeaderValue ( input . accepts ) && { accept : input . accepts ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}/exports/{exportType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } if ( input . exportType !== undefined ) { const labelValue = input . exportType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: exportType." ) ; } resolvedPath = resolvedPath . replace ( "{exportType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: exportType." ) ; } const query = { ... ( input . parameters !== undefined && input . parameters ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetGatewayResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/gatewayresponses/{responseType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . responseType !== undefined ) { const labelValue = input . responseType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: responseType." ) ; } resolvedPath = resolvedPath . replace ( "{responseType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: responseType." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetGatewayResponsesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/gatewayresponses" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetIntegrationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetIntegrationResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMethodCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMethodResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models/{modelName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . modelName !== undefined ) { const labelValue = input . modelName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: modelName." ) ; } resolvedPath = resolvedPath . replace ( "{modelName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: modelName." ) ; } const query = { ... ( input . flatten !== undefined && { flatten : input . flatten . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetModelsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetModelTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models/{modelName}/default_template" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . modelName !== undefined ) { const labelValue = input . modelName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: modelName." ) ; } resolvedPath = resolvedPath . replace ( "{modelName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: modelName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRequestValidatorCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . requestValidatorId !== undefined ) { const labelValue = input . requestValidatorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: requestValidatorId." ) ; } resolvedPath = resolvedPath . replace ( "{requestValidatorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: requestValidatorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRequestValidatorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/requestvalidators" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } const query = { ... ( input . embed !== undefined && { embed : ( input . embed || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetResourcesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , ... ( input . embed !== undefined && { embed : ( input . embed || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRestApisCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSdkCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}/sdks/{sdkType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } if ( input . sdkType !== undefined ) { const labelValue = input . sdkType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: sdkType." ) ; } resolvedPath = resolvedPath . replace ( "{sdkType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: sdkType." ) ; } const query = { ... ( input . parameters !== undefined && input . parameters ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSdkTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/sdktypes/{id}" ; if ( input . id !== undefined ) { const labelValue = input . id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: id." ) ; } resolvedPath = resolvedPath . replace ( "{id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSdkTypesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/sdktypes" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetStageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetStagesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . deploymentId !== undefined && { deploymentId : input . deploymentId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetUsageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/usage" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } const query = { ... ( input . keyId !== undefined && { keyId : input . keyId } ) , ... ( input . startDate !== undefined && { startDate : input . startDate } ) , ... ( input . endDate !== undefined && { endDate : input . endDate } ) , ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetUsagePlanCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetUsagePlanKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/keys/{keyId}" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } if ( input . keyId !== undefined ) { const labelValue = input . keyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: keyId." ) ; } resolvedPath = resolvedPath . replace ( "{keyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: keyId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetUsagePlanKeysCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/keys" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , ... ( input . nameQuery !== undefined && { name : input . nameQuery } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetUsagePlansCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . keyId !== undefined && { keyId : input . keyId } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetVpcLinkCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/vpclinks/{vpcLinkId}" ; if ( input . vpcLinkId !== undefined ) { const labelValue = input . vpcLinkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: vpcLinkId." ) ; } resolvedPath = resolvedPath . replace ( "{vpcLinkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: vpcLinkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetVpcLinksCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/vpclinks" ; const query = { ... ( input . position !== undefined && { position : input . position } ) , ... ( input . limit !== undefined && { limit : input . limit . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ImportApiKeysCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/octet-stream" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys" ; const query = { mode : "import" , ... ( input . format !== undefined && { format : input . format } ) , ... ( input . failOnWarnings !== undefined && { failonwarnings : input . failOnWarnings . toString ( ) } ) , } ; let body ; if ( input . body !== undefined ) { body = input . body ; } return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ImportDocumentationPartsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/octet-stream" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . mode !== undefined && { mode : input . mode } ) , ... ( input . failOnWarnings !== undefined && { failonwarnings : input . failOnWarnings . toString ( ) } ) , } ; let body ; if ( input . body !== undefined ) { body = input . body ; } return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ImportRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/octet-stream" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis" ; const query = { mode : "import" , ... ( input . parameters !== undefined && input . parameters ) , ... ( input . failOnWarnings !== undefined && { failonwarnings : input . failOnWarnings . toString ( ) } ) , } ; let body ; if ( input . body !== undefined ) { body = input . body ; } return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1PutGatewayResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/gatewayresponses/{responseType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . responseType !== undefined ) { const labelValue = input . responseType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: responseType." ) ; } resolvedPath = resolvedPath . replace ( "{responseType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: responseType." ) ; } let body ; body = JSON . stringify ( { ... ( input . responseParameters !== undefined && input . responseParameters !== null && { responseParameters : serializeAws_restJson1MapOfStringToString ( input . responseParameters , context ) , } ) , ... ( input . responseTemplates !== undefined && input . responseTemplates !== null && { responseTemplates : serializeAws_restJson1MapOfStringToString ( input . responseTemplates , context ) , } ) , ... ( input . statusCode !== undefined && input . statusCode !== null && { statusCode : input . statusCode } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutIntegrationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; body = JSON . stringify ( { ... ( input . cacheKeyParameters !== undefined && input . cacheKeyParameters !== null && { cacheKeyParameters : serializeAws_restJson1ListOfString ( input . cacheKeyParameters , context ) , } ) , ... ( input . cacheNamespace !== undefined && input . cacheNamespace !== null && { cacheNamespace : input . cacheNamespace } ) , ... ( input . connectionId !== undefined && input . connectionId !== null && { connectionId : input . connectionId } ) , ... ( input . connectionType !== undefined && input . connectionType !== null && { connectionType : input . connectionType } ) , ... ( input . contentHandling !== undefined && input . contentHandling !== null && { contentHandling : input . contentHandling } ) , ... ( input . credentials !== undefined && input . credentials !== null && { credentials : input . credentials } ) , ... ( input . integrationHttpMethod !== undefined && input . integrationHttpMethod !== null && { httpMethod : input . integrationHttpMethod } ) , ... ( input . passthroughBehavior !== undefined && input . passthroughBehavior !== null && { passthroughBehavior : input . passthroughBehavior } ) , ... ( input . requestParameters !== undefined && input . requestParameters !== null && { requestParameters : serializeAws_restJson1MapOfStringToString ( input . requestParameters , context ) , } ) , ... ( input . requestTemplates !== undefined && input . requestTemplates !== null && { requestTemplates : serializeAws_restJson1MapOfStringToString ( input . requestTemplates , context ) , } ) , ... ( input . timeoutInMillis !== undefined && input . timeoutInMillis !== null && { timeoutInMillis : input . timeoutInMillis } ) , ... ( input . tlsConfig !== undefined && input . tlsConfig !== null && { tlsConfig : serializeAws_restJson1TlsConfig ( input . tlsConfig , context ) } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , ... ( input . uri !== undefined && input . uri !== null && { uri : input . uri } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutIntegrationResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; body = JSON . stringify ( { ... ( input . contentHandling !== undefined && input . contentHandling !== null && { contentHandling : input . contentHandling } ) , ... ( input . responseParameters !== undefined && input . responseParameters !== null && { responseParameters : serializeAws_restJson1MapOfStringToString ( input . responseParameters , context ) , } ) , ... ( input . responseTemplates !== undefined && input . responseTemplates !== null && { responseTemplates : serializeAws_restJson1MapOfStringToString ( input . responseTemplates , context ) , } ) , ... ( input . selectionPattern !== undefined && input . selectionPattern !== null && { selectionPattern : input . selectionPattern } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutMethodCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; body = JSON . stringify ( { ... ( input . apiKeyRequired !== undefined && input . apiKeyRequired !== null && { apiKeyRequired : input . apiKeyRequired } ) , ... ( input . authorizationScopes !== undefined && input . authorizationScopes !== null && { authorizationScopes : serializeAws_restJson1ListOfString ( input . authorizationScopes , context ) , } ) , ... ( input . authorizationType !== undefined && input . authorizationType !== null && { authorizationType : input . authorizationType } ) , ... ( input . authorizerId !== undefined && input . authorizerId !== null && { authorizerId : input . authorizerId } ) , ... ( input . operationName !== undefined && input . operationName !== null && { operationName : input . operationName } ) , ... ( input . requestModels !== undefined && input . requestModels !== null && { requestModels : serializeAws_restJson1MapOfStringToString ( input . requestModels , context ) , } ) , ... ( input . requestParameters !== undefined && input . requestParameters !== null && { requestParameters : serializeAws_restJson1MapOfStringToBoolean ( input . requestParameters , context ) , } ) , ... ( input . requestValidatorId !== undefined && input . requestValidatorId !== null && { requestValidatorId : input . requestValidatorId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutMethodResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; body = JSON . stringify ( { ... ( input . responseModels !== undefined && input . responseModels !== null && { responseModels : serializeAws_restJson1MapOfStringToString ( input . responseModels , context ) , } ) , ... ( input . responseParameters !== undefined && input . responseParameters !== null && { responseParameters : serializeAws_restJson1MapOfStringToBoolean ( input . responseParameters , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/octet-stream" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } const query = { ... ( input . parameters !== undefined && input . parameters ) , ... ( input . mode !== undefined && { mode : input . mode } ) , ... ( input . failOnWarnings !== undefined && { failonwarnings : input . failOnWarnings . toString ( ) } ) , } ; let body ; if ( input . body !== undefined ) { body = input . body ; } return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOfStringToString ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TestInvokeAuthorizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers/{authorizerId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . authorizerId !== undefined ) { const labelValue = input . authorizerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: authorizerId." ) ; } resolvedPath = resolvedPath . replace ( "{authorizerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: authorizerId." ) ; } let body ; body = JSON . stringify ( { ... ( input . additionalContext !== undefined && input . additionalContext !== null && { additionalContext : serializeAws_restJson1MapOfStringToString ( input . additionalContext , context ) , } ) , ... ( input . body !== undefined && input . body !== null && { body : input . body } ) , ... ( input . headers !== undefined && input . headers !== null && { headers : serializeAws_restJson1MapOfStringToString ( input . headers , context ) } ) , ... ( input . multiValueHeaders !== undefined && input . multiValueHeaders !== null && { multiValueHeaders : serializeAws_restJson1MapOfStringToList ( input . multiValueHeaders , context ) , } ) , ... ( input . pathWithQueryString !== undefined && input . pathWithQueryString !== null && { pathWithQueryString : input . pathWithQueryString } ) , ... ( input . stageVariables !== undefined && input . stageVariables !== null && { stageVariables : serializeAws_restJson1MapOfStringToString ( input . stageVariables , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TestInvokeMethodCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; body = JSON . stringify ( { ... ( input . body !== undefined && input . body !== null && { body : input . body } ) , ... ( input . clientCertificateId !== undefined && input . clientCertificateId !== null && { clientCertificateId : input . clientCertificateId } ) , ... ( input . headers !== undefined && input . headers !== null && { headers : serializeAws_restJson1MapOfStringToString ( input . headers , context ) } ) , ... ( input . multiValueHeaders !== undefined && input . multiValueHeaders !== null && { multiValueHeaders : serializeAws_restJson1MapOfStringToList ( input . multiValueHeaders , context ) , } ) , ... ( input . pathWithQueryString !== undefined && input . pathWithQueryString !== null && { pathWithQueryString : input . pathWithQueryString } ) , ... ( input . stageVariables !== undefined && input . stageVariables !== null && { stageVariables : serializeAws_restJson1MapOfStringToString ( input . stageVariables , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } const query = { ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account" ; let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApiKeyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/apikeys/{apiKey}" ; if ( input . apiKey !== undefined ) { const labelValue = input . apiKey ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiKey." ) ; } resolvedPath = resolvedPath . replace ( "{apiKey}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiKey." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAuthorizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/authorizers/{authorizerId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . authorizerId !== undefined ) { const labelValue = input . authorizerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: authorizerId." ) ; } resolvedPath = resolvedPath . replace ( "{authorizerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: authorizerId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateBasePathMappingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}/basepathmappings/{basePath}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } if ( input . basePath !== undefined ) { const labelValue = input . basePath ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: basePath." ) ; } resolvedPath = resolvedPath . replace ( "{basePath}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: basePath." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateClientCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clientcertificates/{clientCertificateId}" ; if ( input . clientCertificateId !== undefined ) { const labelValue = input . clientCertificateId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: clientCertificateId." ) ; } resolvedPath = resolvedPath . replace ( "{clientCertificateId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: clientCertificateId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDeploymentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/deployments/{deploymentId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . deploymentId !== undefined ) { const labelValue = input . deploymentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deploymentId." ) ; } resolvedPath = resolvedPath . replace ( "{deploymentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deploymentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDocumentationPartCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/parts/{documentationPartId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationPartId !== undefined ) { const labelValue = input . documentationPartId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationPartId." ) ; } resolvedPath = resolvedPath . replace ( "{documentationPartId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationPartId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDocumentationVersionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/documentation/versions/{documentationVersion}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . documentationVersion !== undefined ) { const labelValue = input . documentationVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: documentationVersion." ) ; } resolvedPath = resolvedPath . replace ( "{documentationVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: documentationVersion." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDomainNameCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/domainnames/{domainName}" ; if ( input . domainName !== undefined ) { const labelValue = input . domainName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: domainName." ) ; } resolvedPath = resolvedPath . replace ( "{domainName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: domainName." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateGatewayResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/gatewayresponses/{responseType}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . responseType !== undefined ) { const labelValue = input . responseType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: responseType." ) ; } resolvedPath = resolvedPath . replace ( "{responseType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: responseType." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateIntegrationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateIntegrationResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateMethodCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateMethodResponseCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } if ( input . httpMethod !== undefined ) { const labelValue = input . httpMethod ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: httpMethod." ) ; } resolvedPath = resolvedPath . replace ( "{httpMethod}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: httpMethod." ) ; } if ( input . statusCode !== undefined ) { const labelValue = input . statusCode ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: statusCode." ) ; } resolvedPath = resolvedPath . replace ( "{statusCode}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: statusCode." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/models/{modelName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . modelName !== undefined ) { const labelValue = input . modelName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: modelName." ) ; } resolvedPath = resolvedPath . replace ( "{modelName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: modelName." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRequestValidatorCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . requestValidatorId !== undefined ) { const labelValue = input . requestValidatorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: requestValidatorId." ) ; } resolvedPath = resolvedPath . replace ( "{requestValidatorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: requestValidatorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/resources/{resourceId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . resourceId !== undefined ) { const labelValue = input . resourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceId." ) ; } resolvedPath = resolvedPath . replace ( "{resourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRestApiCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateStageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/restapis/{restApiId}/stages/{stageName}" ; if ( input . restApiId !== undefined ) { const labelValue = input . restApiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: restApiId." ) ; } resolvedPath = resolvedPath . replace ( "{restApiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: restApiId." ) ; } if ( input . stageName !== undefined ) { const labelValue = input . stageName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: stageName." ) ; } resolvedPath = resolvedPath . replace ( "{stageName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: stageName." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateUsageCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}/keys/{keyId}/usage" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } if ( input . keyId !== undefined ) { const labelValue = input . keyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: keyId." ) ; } resolvedPath = resolvedPath . replace ( "{keyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: keyId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateUsagePlanCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/usageplans/{usagePlanId}" ; if ( input . usagePlanId !== undefined ) { const labelValue = input . usagePlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: usagePlanId." ) ; } resolvedPath = resolvedPath . replace ( "{usagePlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: usagePlanId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateVpcLinkCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/vpclinks/{vpcLinkId}" ; if ( input . vpcLinkId !== undefined ) { const labelValue = input . vpcLinkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: vpcLinkId." ) ; } resolvedPath = resolvedPath . replace ( "{vpcLinkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: vpcLinkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . patchOperations !== undefined && input . patchOperations !== null && { patchOperations : serializeAws_restJson1ListOfPatchOperation ( input . patchOperations , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateApiKeyCommand = async ( output , context ) : Promise < CreateApiKeyCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateApiKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , customerId : undefined , description : undefined , enabled : undefined , id : undefined , lastUpdatedDate : undefined , name : undefined , stageKeys : undefined , tags : undefined , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . customerId !== undefined && data . customerId !== null ) { contents . customerId = __expectString ( data . customerId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . enabled !== undefined && data . enabled !== null ) { contents . enabled = __expectBoolean ( data . enabled ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . stageKeys !== undefined && data . stageKeys !== null ) { contents . stageKeys = deserializeAws_restJson1ListOfString ( data . stageKeys , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateApiKeyCommandError = async ( output , context ) : Promise < CreateApiKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateAuthorizerCommand = async ( output , context ) : Promise < CreateAuthorizerCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAuthorizerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , authType : undefined , authorizerCredentials : undefined , authorizerResultTtlInSeconds : undefined , authorizerUri : undefined , id : undefined , identitySource : undefined , identityValidationExpression : undefined , name : undefined , providerARNs : undefined , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . authType !== undefined && data . authType !== null ) { contents . authType = __expectString ( data . authType ) ; } if ( data . authorizerCredentials !== undefined && data . authorizerCredentials !== null ) { contents . authorizerCredentials = __expectString ( data . authorizerCredentials ) ; } if ( data . authorizerResultTtlInSeconds !== undefined && data . authorizerResultTtlInSeconds !== null ) { contents . authorizerResultTtlInSeconds = __expectInt32 ( data . authorizerResultTtlInSeconds ) ; } if ( data . authorizerUri !== undefined && data . authorizerUri !== null ) { contents . authorizerUri = __expectString ( data . authorizerUri ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . identitySource !== undefined && data . identitySource !== null ) { contents . identitySource = __expectString ( data . identitySource ) ; } if ( data . identityValidationExpression !== undefined && data . identityValidationExpression !== null ) { contents . identityValidationExpression = __expectString ( data . identityValidationExpression ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . providerARNs !== undefined && data . providerARNs !== null ) { contents . providerARNs = deserializeAws_restJson1ListOfARNs ( data . providerARNs , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAuthorizerCommandError = async ( output , context ) : Promise < CreateAuthorizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateBasePathMappingCommand = async ( output , context ) : Promise < CreateBasePathMappingCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateBasePathMappingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , basePath : undefined , restApiId : undefined , stage : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . basePath !== undefined && data . basePath !== null ) { contents . basePath = __expectString ( data . basePath ) ; } if ( data . restApiId !== undefined && data . restApiId !== null ) { contents . restApiId = __expectString ( data . restApiId ) ; } if ( data . stage !== undefined && data . stage !== null ) { contents . stage = __expectString ( data . stage ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateBasePathMappingCommandError = async ( output , context ) : Promise < CreateBasePathMappingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateDeploymentCommand = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiSummary : undefined , createdDate : undefined , description : undefined , id : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiSummary !== undefined && data . apiSummary !== null ) { contents . apiSummary = deserializeAws_restJson1PathToMapOfMethodSnapshot ( data . apiSummary , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDeploymentCommandError = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.apigateway#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateDocumentationPartCommand = async ( output , context ) : Promise < CreateDocumentationPartCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDocumentationPartCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , location : undefined , properties : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . location !== undefined && data . location !== null ) { contents . location = deserializeAws_restJson1DocumentationPartLocation ( data . location , context ) ; } if ( data . properties !== undefined && data . properties !== null ) { contents . properties = __expectString ( data . properties ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDocumentationPartCommandError = async ( output , context ) : Promise < CreateDocumentationPartCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateDocumentationVersionCommand = async ( output , context ) : Promise < CreateDocumentationVersionCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDocumentationVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , description : undefined , version : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDocumentationVersionCommandError = async ( output , context ) : Promise < CreateDocumentationVersionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateDomainNameCommand = async ( output , context ) : Promise < CreateDomainNameCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDomainNameCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , certificateArn : undefined , certificateName : undefined , certificateUploadDate : undefined , distributionDomainName : undefined , distributionHostedZoneId : undefined , domainName : undefined , domainNameStatus : undefined , domainNameStatusMessage : undefined , endpointConfiguration : undefined , mutualTlsAuthentication : undefined , ownershipVerificationCertificateArn : undefined , regionalCertificateArn : undefined , regionalCertificateName : undefined , regionalDomainName : undefined , regionalHostedZoneId : undefined , securityPolicy : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . certificateArn !== undefined && data . certificateArn !== null ) { contents . certificateArn = __expectString ( data . certificateArn ) ; } if ( data . certificateName !== undefined && data . certificateName !== null ) { contents . certificateName = __expectString ( data . certificateName ) ; } if ( data . certificateUploadDate !== undefined && data . certificateUploadDate !== null ) { contents . certificateUploadDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . certificateUploadDate ) ) ) ; } if ( data . distributionDomainName !== undefined && data . distributionDomainName !== null ) { contents . distributionDomainName = __expectString ( data . distributionDomainName ) ; } if ( data . distributionHostedZoneId !== undefined && data . distributionHostedZoneId !== null ) { contents . distributionHostedZoneId = __expectString ( data . distributionHostedZoneId ) ; } if ( data . domainName !== undefined && data . domainName !== null ) { contents . domainName = __expectString ( data . domainName ) ; } if ( data . domainNameStatus !== undefined && data . domainNameStatus !== null ) { contents . domainNameStatus = __expectString ( data . domainNameStatus ) ; } if ( data . domainNameStatusMessage !== undefined && data . domainNameStatusMessage !== null ) { contents . domainNameStatusMessage = __expectString ( data . domainNameStatusMessage ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . mutualTlsAuthentication !== undefined && data . mutualTlsAuthentication !== null ) { contents . mutualTlsAuthentication = deserializeAws_restJson1MutualTlsAuthentication ( data . mutualTlsAuthentication , context ) ; } if ( data . ownershipVerificationCertificateArn !== undefined && data . ownershipVerificationCertificateArn !== null ) { contents . ownershipVerificationCertificateArn = __expectString ( data . ownershipVerificationCertificateArn ) ; } if ( data . regionalCertificateArn !== undefined && data . regionalCertificateArn !== null ) { contents . regionalCertificateArn = __expectString ( data . regionalCertificateArn ) ; } if ( data . regionalCertificateName !== undefined && data . regionalCertificateName !== null ) { contents . regionalCertificateName = __expectString ( data . regionalCertificateName ) ; } if ( data . regionalDomainName !== undefined && data . regionalDomainName !== null ) { contents . regionalDomainName = __expectString ( data . regionalDomainName ) ; } if ( data . regionalHostedZoneId !== undefined && data . regionalHostedZoneId !== null ) { contents . regionalHostedZoneId = __expectString ( data . regionalHostedZoneId ) ; } if ( data . securityPolicy !== undefined && data . securityPolicy !== null ) { contents . securityPolicy = __expectString ( data . securityPolicy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDomainNameCommandError = async ( output , context ) : Promise < CreateDomainNameCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateModelCommand = async ( output , context ) : Promise < CreateModelCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentType : undefined , description : undefined , id : undefined , name : undefined , schema : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentType !== undefined && data . contentType !== null ) { contents . contentType = __expectString ( data . contentType ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . schema !== undefined && data . schema !== null ) { contents . schema = __expectString ( data . schema ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateModelCommandError = async ( output , context ) : Promise < CreateModelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateRequestValidatorCommand = async ( output , context ) : Promise < CreateRequestValidatorCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRequestValidatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , name : undefined , validateRequestBody : undefined , validateRequestParameters : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . validateRequestBody !== undefined && data . validateRequestBody !== null ) { contents . validateRequestBody = __expectBoolean ( data . validateRequestBody ) ; } if ( data . validateRequestParameters !== undefined && data . validateRequestParameters !== null ) { contents . validateRequestParameters = __expectBoolean ( data . validateRequestParameters ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRequestValidatorCommandError = async ( output , context ) : Promise < CreateRequestValidatorCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateResourceCommand = async ( output , context ) : Promise < CreateResourceCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , parentId : undefined , path : undefined , pathPart : undefined , resourceMethods : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . parentId !== undefined && data . parentId !== null ) { contents . parentId = __expectString ( data . parentId ) ; } if ( data . path !== undefined && data . path !== null ) { contents . path = __expectString ( data . path ) ; } if ( data . pathPart !== undefined && data . pathPart !== null ) { contents . pathPart = __expectString ( data . pathPart ) ; } if ( data . resourceMethods !== undefined && data . resourceMethods !== null ) { contents . resourceMethods = deserializeAws_restJson1MapOfMethod ( data . resourceMethods , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateResourceCommandError = async ( output , context ) : Promise < CreateResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateRestApiCommand = async ( output , context ) : Promise < CreateRestApiCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeySource : undefined , binaryMediaTypes : undefined , createdDate : undefined , description : undefined , disableExecuteApiEndpoint : undefined , endpointConfiguration : undefined , id : undefined , minimumCompressionSize : undefined , name : undefined , policy : undefined , tags : undefined , version : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeySource !== undefined && data . apiKeySource !== null ) { contents . apiKeySource = __expectString ( data . apiKeySource ) ; } if ( data . binaryMediaTypes !== undefined && data . binaryMediaTypes !== null ) { contents . binaryMediaTypes = deserializeAws_restJson1ListOfString ( data . binaryMediaTypes , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . disableExecuteApiEndpoint !== undefined && data . disableExecuteApiEndpoint !== null ) { contents . disableExecuteApiEndpoint = __expectBoolean ( data . disableExecuteApiEndpoint ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . minimumCompressionSize !== undefined && data . minimumCompressionSize !== null ) { contents . minimumCompressionSize = __expectInt32 ( data . minimumCompressionSize ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRestApiCommandError = async ( output , context ) : Promise < CreateRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateStageCommand = async ( output , context ) : Promise < CreateStageCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateStageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , accessLogSettings : undefined , cacheClusterEnabled : undefined , cacheClusterSize : undefined , cacheClusterStatus : undefined , canarySettings : undefined , clientCertificateId : undefined , createdDate : undefined , deploymentId : undefined , description : undefined , documentationVersion : undefined , lastUpdatedDate : undefined , methodSettings : undefined , stageName : undefined , tags : undefined , tracingEnabled : undefined , variables : undefined , webAclArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . accessLogSettings !== undefined && data . accessLogSettings !== null ) { contents . accessLogSettings = deserializeAws_restJson1AccessLogSettings ( data . accessLogSettings , context ) ; } if ( data . cacheClusterEnabled !== undefined && data . cacheClusterEnabled !== null ) { contents . cacheClusterEnabled = __expectBoolean ( data . cacheClusterEnabled ) ; } if ( data . cacheClusterSize !== undefined && data . cacheClusterSize !== null ) { contents . cacheClusterSize = __expectString ( data . cacheClusterSize ) ; } if ( data . cacheClusterStatus !== undefined && data . cacheClusterStatus !== null ) { contents . cacheClusterStatus = __expectString ( data . cacheClusterStatus ) ; } if ( data . canarySettings !== undefined && data . canarySettings !== null ) { contents . canarySettings = deserializeAws_restJson1CanarySettings ( data . canarySettings , context ) ; } if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . deploymentId !== undefined && data . deploymentId !== null ) { contents . deploymentId = __expectString ( data . deploymentId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . documentationVersion !== undefined && data . documentationVersion !== null ) { contents . documentationVersion = __expectString ( data . documentationVersion ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . methodSettings !== undefined && data . methodSettings !== null ) { contents . methodSettings = deserializeAws_restJson1MapOfMethodSettings ( data . methodSettings , context ) ; } if ( data . stageName !== undefined && data . stageName !== null ) { contents . stageName = __expectString ( data . stageName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . tracingEnabled !== undefined && data . tracingEnabled !== null ) { contents . tracingEnabled = __expectBoolean ( data . tracingEnabled ) ; } if ( data . variables !== undefined && data . variables !== null ) { contents . variables = deserializeAws_restJson1MapOfStringToString ( data . variables , context ) ; } if ( data . webAclArn !== undefined && data . webAclArn !== null ) { contents . webAclArn = __expectString ( data . webAclArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateStageCommandError = async ( output , context ) : Promise < CreateStageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateUsagePlanCommand = async ( output , context ) : Promise < CreateUsagePlanCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateUsagePlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiStages : undefined , description : undefined , id : undefined , name : undefined , productCode : undefined , quota : undefined , tags : undefined , throttle : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiStages !== undefined && data . apiStages !== null ) { contents . apiStages = deserializeAws_restJson1ListOfApiStage ( data . apiStages , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . productCode !== undefined && data . productCode !== null ) { contents . productCode = __expectString ( data . productCode ) ; } if ( data . quota !== undefined && data . quota !== null ) { contents . quota = deserializeAws_restJson1QuotaSettings ( data . quota , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . throttle !== undefined && data . throttle !== null ) { contents . throttle = deserializeAws_restJson1ThrottleSettings ( data . throttle , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateUsagePlanCommandError = async ( output , context ) : Promise < CreateUsagePlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateUsagePlanKeyCommand = async ( output , context ) : Promise < CreateUsagePlanKeyCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateUsagePlanKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , name : undefined , type : undefined , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateUsagePlanKeyCommandError = async ( output , context ) : Promise < CreateUsagePlanKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateVpcLinkCommand = async ( output , context ) : Promise < CreateVpcLinkCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateVpcLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , description : undefined , id : undefined , name : undefined , status : undefined , statusMessage : undefined , tags : undefined , targetArns : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } if ( data . statusMessage !== undefined && data . statusMessage !== null ) { contents . statusMessage = __expectString ( data . statusMessage ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . targetArns !== undefined && data . targetArns !== null ) { contents . targetArns = deserializeAws_restJson1ListOfString ( data . targetArns , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateVpcLinkCommandError = async ( output , context ) : Promise < CreateVpcLinkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteApiKeyCommand = async ( output , context ) : Promise < DeleteApiKeyCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApiKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApiKeyCommandError = async ( output , context ) : Promise < DeleteApiKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteAuthorizerCommand = async ( output , context ) : Promise < DeleteAuthorizerCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAuthorizerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAuthorizerCommandError = async ( output , context ) : Promise < DeleteAuthorizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBasePathMappingCommand = async ( output , context ) : Promise < DeleteBasePathMappingCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBasePathMappingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBasePathMappingCommandError = async ( output , context ) : Promise < DeleteBasePathMappingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteClientCertificateCommand = async ( output , context ) : Promise < DeleteClientCertificateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteClientCertificateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteClientCertificateCommandError = async ( output , context ) : Promise < DeleteClientCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteDeploymentCommand = async ( output , context ) : Promise < DeleteDeploymentCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDeploymentCommandError = async ( output , context ) : Promise < DeleteDeploymentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteDocumentationPartCommand = async ( output , context ) : Promise < DeleteDocumentationPartCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDocumentationPartCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDocumentationPartCommandError = async ( output , context ) : Promise < DeleteDocumentationPartCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteDocumentationVersionCommand = async ( output , context ) : Promise < DeleteDocumentationVersionCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDocumentationVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDocumentationVersionCommandError = async ( output , context ) : Promise < DeleteDocumentationVersionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteDomainNameCommand = async ( output , context ) : Promise < DeleteDomainNameCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDomainNameCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDomainNameCommandError = async ( output , context ) : Promise < DeleteDomainNameCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteGatewayResponseCommand = async ( output , context ) : Promise < DeleteGatewayResponseCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteGatewayResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteGatewayResponseCommandError = async ( output , context ) : Promise < DeleteGatewayResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteIntegrationCommand = async ( output , context ) : Promise < DeleteIntegrationCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteIntegrationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteIntegrationCommandError = async ( output , context ) : Promise < DeleteIntegrationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteIntegrationResponseCommand = async ( output , context ) : Promise < DeleteIntegrationResponseCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteIntegrationResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteIntegrationResponseCommandError = async ( output , context ) : Promise < DeleteIntegrationResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteMethodCommand = async ( output , context ) : Promise < DeleteMethodCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMethodCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMethodCommandError = async ( output , context ) : Promise < DeleteMethodCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteMethodResponseCommand = async ( output , context ) : Promise < DeleteMethodResponseCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMethodResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMethodResponseCommandError = async ( output , context ) : Promise < DeleteMethodResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteModelCommand = async ( output , context ) : Promise < DeleteModelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteModelCommandError = async ( output , context ) : Promise < DeleteModelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteRequestValidatorCommand = async ( output , context ) : Promise < DeleteRequestValidatorCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRequestValidatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRequestValidatorCommandError = async ( output , context ) : Promise < DeleteRequestValidatorCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteResourceCommand = async ( output , context ) : Promise < DeleteResourceCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteResourceCommandError = async ( output , context ) : Promise < DeleteResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteRestApiCommand = async ( output , context ) : Promise < DeleteRestApiCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRestApiCommandError = async ( output , context ) : Promise < DeleteRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteStageCommand = async ( output , context ) : Promise < DeleteStageCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteStageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteStageCommandError = async ( output , context ) : Promise < DeleteStageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteUsagePlanCommand = async ( output , context ) : Promise < DeleteUsagePlanCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteUsagePlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteUsagePlanCommandError = async ( output , context ) : Promise < DeleteUsagePlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteUsagePlanKeyCommand = async ( output , context ) : Promise < DeleteUsagePlanKeyCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteUsagePlanKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteUsagePlanKeyCommandError = async ( output , context ) : Promise < DeleteUsagePlanKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteVpcLinkCommand = async ( output , context ) : Promise < DeleteVpcLinkCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteVpcLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteVpcLinkCommandError = async ( output , context ) : Promise < DeleteVpcLinkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1FlushStageAuthorizersCacheCommand = async ( output , context ) : Promise < FlushStageAuthorizersCacheCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1FlushStageAuthorizersCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1FlushStageAuthorizersCacheCommandError = async ( output , context ) : Promise < FlushStageAuthorizersCacheCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1FlushStageCacheCommand = async ( output , context ) : Promise < FlushStageCacheCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1FlushStageCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1FlushStageCacheCommandError = async ( output , context ) : Promise < FlushStageCacheCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GenerateClientCertificateCommand = async ( output , context ) : Promise < GenerateClientCertificateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1GenerateClientCertificateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , clientCertificateId : undefined , createdDate : undefined , description : undefined , expirationDate : undefined , pemEncodedCertificate : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . expirationDate !== undefined && data . expirationDate !== null ) { contents . expirationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . expirationDate ) ) ) ; } if ( data . pemEncodedCertificate !== undefined && data . pemEncodedCertificate !== null ) { contents . pemEncodedCertificate = __expectString ( data . pemEncodedCertificate ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GenerateClientCertificateCommandError = async ( output , context ) : Promise < GenerateClientCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetAccountCommand = async ( output , context ) : Promise < GetAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeyVersion : undefined , cloudwatchRoleArn : undefined , features : undefined , throttleSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeyVersion !== undefined && data . apiKeyVersion !== null ) { contents . apiKeyVersion = __expectString ( data . apiKeyVersion ) ; } if ( data . cloudwatchRoleArn !== undefined && data . cloudwatchRoleArn !== null ) { contents . cloudwatchRoleArn = __expectString ( data . cloudwatchRoleArn ) ; } if ( data . features !== undefined && data . features !== null ) { contents . features = deserializeAws_restJson1ListOfString ( data . features , context ) ; } if ( data . throttleSettings !== undefined && data . throttleSettings !== null ) { contents . throttleSettings = deserializeAws_restJson1ThrottleSettings ( data . throttleSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAccountCommandError = async ( output , context ) : Promise < GetAccountCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetApiKeyCommand = async ( output , context ) : Promise < GetApiKeyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApiKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , customerId : undefined , description : undefined , enabled : undefined , id : undefined , lastUpdatedDate : undefined , name : undefined , stageKeys : undefined , tags : undefined , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . customerId !== undefined && data . customerId !== null ) { contents . customerId = __expectString ( data . customerId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . enabled !== undefined && data . enabled !== null ) { contents . enabled = __expectBoolean ( data . enabled ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . stageKeys !== undefined && data . stageKeys !== null ) { contents . stageKeys = deserializeAws_restJson1ListOfString ( data . stageKeys , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApiKeyCommandError = async ( output , context ) : Promise < GetApiKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetApiKeysCommand = async ( output , context ) : Promise < GetApiKeysCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApiKeysCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfApiKey ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApiKeysCommandError = async ( output , context ) : Promise < GetApiKeysCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetAuthorizerCommand = async ( output , context ) : Promise < GetAuthorizerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAuthorizerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , authType : undefined , authorizerCredentials : undefined , authorizerResultTtlInSeconds : undefined , authorizerUri : undefined , id : undefined , identitySource : undefined , identityValidationExpression : undefined , name : undefined , providerARNs : undefined , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . authType !== undefined && data . authType !== null ) { contents . authType = __expectString ( data . authType ) ; } if ( data . authorizerCredentials !== undefined && data . authorizerCredentials !== null ) { contents . authorizerCredentials = __expectString ( data . authorizerCredentials ) ; } if ( data . authorizerResultTtlInSeconds !== undefined && data . authorizerResultTtlInSeconds !== null ) { contents . authorizerResultTtlInSeconds = __expectInt32 ( data . authorizerResultTtlInSeconds ) ; } if ( data . authorizerUri !== undefined && data . authorizerUri !== null ) { contents . authorizerUri = __expectString ( data . authorizerUri ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . identitySource !== undefined && data . identitySource !== null ) { contents . identitySource = __expectString ( data . identitySource ) ; } if ( data . identityValidationExpression !== undefined && data . identityValidationExpression !== null ) { contents . identityValidationExpression = __expectString ( data . identityValidationExpression ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . providerARNs !== undefined && data . providerARNs !== null ) { contents . providerARNs = deserializeAws_restJson1ListOfARNs ( data . providerARNs , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAuthorizerCommandError = async ( output , context ) : Promise < GetAuthorizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetAuthorizersCommand = async ( output , context ) : Promise < GetAuthorizersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAuthorizersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfAuthorizer ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAuthorizersCommandError = async ( output , context ) : Promise < GetAuthorizersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBasePathMappingCommand = async ( output , context ) : Promise < GetBasePathMappingCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBasePathMappingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , basePath : undefined , restApiId : undefined , stage : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . basePath !== undefined && data . basePath !== null ) { contents . basePath = __expectString ( data . basePath ) ; } if ( data . restApiId !== undefined && data . restApiId !== null ) { contents . restApiId = __expectString ( data . restApiId ) ; } if ( data . stage !== undefined && data . stage !== null ) { contents . stage = __expectString ( data . stage ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBasePathMappingCommandError = async ( output , context ) : Promise < GetBasePathMappingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBasePathMappingsCommand = async ( output , context ) : Promise < GetBasePathMappingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBasePathMappingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfBasePathMapping ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBasePathMappingsCommandError = async ( output , context ) : Promise < GetBasePathMappingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetClientCertificateCommand = async ( output , context ) : Promise < GetClientCertificateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetClientCertificateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , clientCertificateId : undefined , createdDate : undefined , description : undefined , expirationDate : undefined , pemEncodedCertificate : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . expirationDate !== undefined && data . expirationDate !== null ) { contents . expirationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . expirationDate ) ) ) ; } if ( data . pemEncodedCertificate !== undefined && data . pemEncodedCertificate !== null ) { contents . pemEncodedCertificate = __expectString ( data . pemEncodedCertificate ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetClientCertificateCommandError = async ( output , context ) : Promise < GetClientCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetClientCertificatesCommand = async ( output , context ) : Promise < GetClientCertificatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetClientCertificatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfClientCertificate ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetClientCertificatesCommandError = async ( output , context ) : Promise < GetClientCertificatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDeploymentCommand = async ( output , context ) : Promise < GetDeploymentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiSummary : undefined , createdDate : undefined , description : undefined , id : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiSummary !== undefined && data . apiSummary !== null ) { contents . apiSummary = deserializeAws_restJson1PathToMapOfMethodSnapshot ( data . apiSummary , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDeploymentCommandError = async ( output , context ) : Promise < GetDeploymentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.apigateway#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDeploymentsCommand = async ( output , context ) : Promise < GetDeploymentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDeploymentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfDeployment ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDeploymentsCommandError = async ( output , context ) : Promise < GetDeploymentsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.apigateway#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDocumentationPartCommand = async ( output , context ) : Promise < GetDocumentationPartCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDocumentationPartCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , location : undefined , properties : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . location !== undefined && data . location !== null ) { contents . location = deserializeAws_restJson1DocumentationPartLocation ( data . location , context ) ; } if ( data . properties !== undefined && data . properties !== null ) { contents . properties = __expectString ( data . properties ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDocumentationPartCommandError = async ( output , context ) : Promise < GetDocumentationPartCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDocumentationPartsCommand = async ( output , context ) : Promise < GetDocumentationPartsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDocumentationPartsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfDocumentationPart ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDocumentationPartsCommandError = async ( output , context ) : Promise < GetDocumentationPartsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDocumentationVersionCommand = async ( output , context ) : Promise < GetDocumentationVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDocumentationVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , description : undefined , version : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDocumentationVersionCommandError = async ( output , context ) : Promise < GetDocumentationVersionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDocumentationVersionsCommand = async ( output , context ) : Promise < GetDocumentationVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDocumentationVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfDocumentationVersion ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDocumentationVersionsCommandError = async ( output , context ) : Promise < GetDocumentationVersionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDomainNameCommand = async ( output , context ) : Promise < GetDomainNameCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDomainNameCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , certificateArn : undefined , certificateName : undefined , certificateUploadDate : undefined , distributionDomainName : undefined , distributionHostedZoneId : undefined , domainName : undefined , domainNameStatus : undefined , domainNameStatusMessage : undefined , endpointConfiguration : undefined , mutualTlsAuthentication : undefined , ownershipVerificationCertificateArn : undefined , regionalCertificateArn : undefined , regionalCertificateName : undefined , regionalDomainName : undefined , regionalHostedZoneId : undefined , securityPolicy : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . certificateArn !== undefined && data . certificateArn !== null ) { contents . certificateArn = __expectString ( data . certificateArn ) ; } if ( data . certificateName !== undefined && data . certificateName !== null ) { contents . certificateName = __expectString ( data . certificateName ) ; } if ( data . certificateUploadDate !== undefined && data . certificateUploadDate !== null ) { contents . certificateUploadDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . certificateUploadDate ) ) ) ; } if ( data . distributionDomainName !== undefined && data . distributionDomainName !== null ) { contents . distributionDomainName = __expectString ( data . distributionDomainName ) ; } if ( data . distributionHostedZoneId !== undefined && data . distributionHostedZoneId !== null ) { contents . distributionHostedZoneId = __expectString ( data . distributionHostedZoneId ) ; } if ( data . domainName !== undefined && data . domainName !== null ) { contents . domainName = __expectString ( data . domainName ) ; } if ( data . domainNameStatus !== undefined && data . domainNameStatus !== null ) { contents . domainNameStatus = __expectString ( data . domainNameStatus ) ; } if ( data . domainNameStatusMessage !== undefined && data . domainNameStatusMessage !== null ) { contents . domainNameStatusMessage = __expectString ( data . domainNameStatusMessage ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . mutualTlsAuthentication !== undefined && data . mutualTlsAuthentication !== null ) { contents . mutualTlsAuthentication = deserializeAws_restJson1MutualTlsAuthentication ( data . mutualTlsAuthentication , context ) ; } if ( data . ownershipVerificationCertificateArn !== undefined && data . ownershipVerificationCertificateArn !== null ) { contents . ownershipVerificationCertificateArn = __expectString ( data . ownershipVerificationCertificateArn ) ; } if ( data . regionalCertificateArn !== undefined && data . regionalCertificateArn !== null ) { contents . regionalCertificateArn = __expectString ( data . regionalCertificateArn ) ; } if ( data . regionalCertificateName !== undefined && data . regionalCertificateName !== null ) { contents . regionalCertificateName = __expectString ( data . regionalCertificateName ) ; } if ( data . regionalDomainName !== undefined && data . regionalDomainName !== null ) { contents . regionalDomainName = __expectString ( data . regionalDomainName ) ; } if ( data . regionalHostedZoneId !== undefined && data . regionalHostedZoneId !== null ) { contents . regionalHostedZoneId = __expectString ( data . regionalHostedZoneId ) ; } if ( data . securityPolicy !== undefined && data . securityPolicy !== null ) { contents . securityPolicy = __expectString ( data . securityPolicy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDomainNameCommandError = async ( output , context ) : Promise < GetDomainNameCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetDomainNamesCommand = async ( output , context ) : Promise < GetDomainNamesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDomainNamesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfDomainName ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDomainNamesCommandError = async ( output , context ) : Promise < GetDomainNamesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetExportCommand = async ( output , context ) : Promise < GetExportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetExportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , body : undefined , contentDisposition : undefined , contentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . contentType = output . headers [ "content-type" ] ; } if ( output . headers [ "content-disposition" ] !== undefined ) { contents . contentDisposition = output . headers [ "content-disposition" ] ; } const data = await collectBody ( output . body , context ) ; contents . body = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetExportCommandError = async ( output , context ) : Promise < GetExportCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetGatewayResponseCommand = async ( output , context ) : Promise < GetGatewayResponseCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetGatewayResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , defaultResponse : undefined , responseParameters : undefined , responseTemplates : undefined , responseType : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . defaultResponse !== undefined && data . defaultResponse !== null ) { contents . defaultResponse = __expectBoolean ( data . defaultResponse ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . responseType !== undefined && data . responseType !== null ) { contents . responseType = __expectString ( data . responseType ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetGatewayResponseCommandError = async ( output , context ) : Promise < GetGatewayResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetGatewayResponsesCommand = async ( output , context ) : Promise < GetGatewayResponsesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetGatewayResponsesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfGatewayResponse ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetGatewayResponsesCommandError = async ( output , context ) : Promise < GetGatewayResponsesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetIntegrationCommand = async ( output , context ) : Promise < GetIntegrationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetIntegrationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , cacheKeyParameters : undefined , cacheNamespace : undefined , connectionId : undefined , connectionType : undefined , contentHandling : undefined , credentials : undefined , httpMethod : undefined , integrationResponses : undefined , passthroughBehavior : undefined , requestParameters : undefined , requestTemplates : undefined , timeoutInMillis : undefined , tlsConfig : undefined , type : undefined , uri : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cacheKeyParameters !== undefined && data . cacheKeyParameters !== null ) { contents . cacheKeyParameters = deserializeAws_restJson1ListOfString ( data . cacheKeyParameters , context ) ; } if ( data . cacheNamespace !== undefined && data . cacheNamespace !== null ) { contents . cacheNamespace = __expectString ( data . cacheNamespace ) ; } if ( data . connectionId !== undefined && data . connectionId !== null ) { contents . connectionId = __expectString ( data . connectionId ) ; } if ( data . connectionType !== undefined && data . connectionType !== null ) { contents . connectionType = __expectString ( data . connectionType ) ; } if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . credentials !== undefined && data . credentials !== null ) { contents . credentials = __expectString ( data . credentials ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . integrationResponses !== undefined && data . integrationResponses !== null ) { contents . integrationResponses = deserializeAws_restJson1MapOfIntegrationResponse ( data . integrationResponses , context ) ; } if ( data . passthroughBehavior !== undefined && data . passthroughBehavior !== null ) { contents . passthroughBehavior = __expectString ( data . passthroughBehavior ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToString ( data . requestParameters , context ) ; } if ( data . requestTemplates !== undefined && data . requestTemplates !== null ) { contents . requestTemplates = deserializeAws_restJson1MapOfStringToString ( data . requestTemplates , context ) ; } if ( data . timeoutInMillis !== undefined && data . timeoutInMillis !== null ) { contents . timeoutInMillis = __expectInt32 ( data . timeoutInMillis ) ; } if ( data . tlsConfig !== undefined && data . tlsConfig !== null ) { contents . tlsConfig = deserializeAws_restJson1TlsConfig ( data . tlsConfig , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } if ( data . uri !== undefined && data . uri !== null ) { contents . uri = __expectString ( data . uri ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetIntegrationCommandError = async ( output , context ) : Promise < GetIntegrationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetIntegrationResponseCommand = async ( output , context ) : Promise < GetIntegrationResponseCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetIntegrationResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentHandling : undefined , responseParameters : undefined , responseTemplates : undefined , selectionPattern : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . selectionPattern !== undefined && data . selectionPattern !== null ) { contents . selectionPattern = __expectString ( data . selectionPattern ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetIntegrationResponseCommandError = async ( output , context ) : Promise < GetIntegrationResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetMethodCommand = async ( output , context ) : Promise < GetMethodCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMethodCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeyRequired : undefined , authorizationScopes : undefined , authorizationType : undefined , authorizerId : undefined , httpMethod : undefined , methodIntegration : undefined , methodResponses : undefined , operationName : undefined , requestModels : undefined , requestParameters : undefined , requestValidatorId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeyRequired !== undefined && data . apiKeyRequired !== null ) { contents . apiKeyRequired = __expectBoolean ( data . apiKeyRequired ) ; } if ( data . authorizationScopes !== undefined && data . authorizationScopes !== null ) { contents . authorizationScopes = deserializeAws_restJson1ListOfString ( data . authorizationScopes , context ) ; } if ( data . authorizationType !== undefined && data . authorizationType !== null ) { contents . authorizationType = __expectString ( data . authorizationType ) ; } if ( data . authorizerId !== undefined && data . authorizerId !== null ) { contents . authorizerId = __expectString ( data . authorizerId ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . methodIntegration !== undefined && data . methodIntegration !== null ) { contents . methodIntegration = deserializeAws_restJson1Integration ( data . methodIntegration , context ) ; } if ( data . methodResponses !== undefined && data . methodResponses !== null ) { contents . methodResponses = deserializeAws_restJson1MapOfMethodResponse ( data . methodResponses , context ) ; } if ( data . operationName !== undefined && data . operationName !== null ) { contents . operationName = __expectString ( data . operationName ) ; } if ( data . requestModels !== undefined && data . requestModels !== null ) { contents . requestModels = deserializeAws_restJson1MapOfStringToString ( data . requestModels , context ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . requestParameters , context ) ; } if ( data . requestValidatorId !== undefined && data . requestValidatorId !== null ) { contents . requestValidatorId = __expectString ( data . requestValidatorId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMethodCommandError = async ( output , context ) : Promise < GetMethodCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetMethodResponseCommand = async ( output , context ) : Promise < GetMethodResponseCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMethodResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , responseModels : undefined , responseParameters : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . responseModels !== undefined && data . responseModels !== null ) { contents . responseModels = deserializeAws_restJson1MapOfStringToString ( data . responseModels , context ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . responseParameters , context ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMethodResponseCommandError = async ( output , context ) : Promise < GetMethodResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetModelCommand = async ( output , context ) : Promise < GetModelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentType : undefined , description : undefined , id : undefined , name : undefined , schema : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentType !== undefined && data . contentType !== null ) { contents . contentType = __expectString ( data . contentType ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . schema !== undefined && data . schema !== null ) { contents . schema = __expectString ( data . schema ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetModelCommandError = async ( output , context ) : Promise < GetModelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetModelsCommand = async ( output , context ) : Promise < GetModelsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetModelsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfModel ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetModelsCommandError = async ( output , context ) : Promise < GetModelsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetModelTemplateCommand = async ( output , context ) : Promise < GetModelTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetModelTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetModelTemplateCommandError = async ( output , context ) : Promise < GetModelTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRequestValidatorCommand = async ( output , context ) : Promise < GetRequestValidatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRequestValidatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , name : undefined , validateRequestBody : undefined , validateRequestParameters : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . validateRequestBody !== undefined && data . validateRequestBody !== null ) { contents . validateRequestBody = __expectBoolean ( data . validateRequestBody ) ; } if ( data . validateRequestParameters !== undefined && data . validateRequestParameters !== null ) { contents . validateRequestParameters = __expectBoolean ( data . validateRequestParameters ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRequestValidatorCommandError = async ( output , context ) : Promise < GetRequestValidatorCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRequestValidatorsCommand = async ( output , context ) : Promise < GetRequestValidatorsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRequestValidatorsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfRequestValidator ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRequestValidatorsCommandError = async ( output , context ) : Promise < GetRequestValidatorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetResourceCommand = async ( output , context ) : Promise < GetResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , parentId : undefined , path : undefined , pathPart : undefined , resourceMethods : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . parentId !== undefined && data . parentId !== null ) { contents . parentId = __expectString ( data . parentId ) ; } if ( data . path !== undefined && data . path !== null ) { contents . path = __expectString ( data . path ) ; } if ( data . pathPart !== undefined && data . pathPart !== null ) { contents . pathPart = __expectString ( data . pathPart ) ; } if ( data . resourceMethods !== undefined && data . resourceMethods !== null ) { contents . resourceMethods = deserializeAws_restJson1MapOfMethod ( data . resourceMethods , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResourceCommandError = async ( output , context ) : Promise < GetResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetResourcesCommand = async ( output , context ) : Promise < GetResourcesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResourcesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfResource ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResourcesCommandError = async ( output , context ) : Promise < GetResourcesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRestApiCommand = async ( output , context ) : Promise < GetRestApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeySource : undefined , binaryMediaTypes : undefined , createdDate : undefined , description : undefined , disableExecuteApiEndpoint : undefined , endpointConfiguration : undefined , id : undefined , minimumCompressionSize : undefined , name : undefined , policy : undefined , tags : undefined , version : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeySource !== undefined && data . apiKeySource !== null ) { contents . apiKeySource = __expectString ( data . apiKeySource ) ; } if ( data . binaryMediaTypes !== undefined && data . binaryMediaTypes !== null ) { contents . binaryMediaTypes = deserializeAws_restJson1ListOfString ( data . binaryMediaTypes , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . disableExecuteApiEndpoint !== undefined && data . disableExecuteApiEndpoint !== null ) { contents . disableExecuteApiEndpoint = __expectBoolean ( data . disableExecuteApiEndpoint ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . minimumCompressionSize !== undefined && data . minimumCompressionSize !== null ) { contents . minimumCompressionSize = __expectInt32 ( data . minimumCompressionSize ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRestApiCommandError = async ( output , context ) : Promise < GetRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRestApisCommand = async ( output , context ) : Promise < GetRestApisCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRestApisCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfRestApi ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRestApisCommandError = async ( output , context ) : Promise < GetRestApisCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetSdkCommand = async ( output , context ) : Promise < GetSdkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSdkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , body : undefined , contentDisposition : undefined , contentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . contentType = output . headers [ "content-type" ] ; } if ( output . headers [ "content-disposition" ] !== undefined ) { contents . contentDisposition = output . headers [ "content-disposition" ] ; } const data = await collectBody ( output . body , context ) ; contents . body = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSdkCommandError = async ( output , context ) : Promise < GetSdkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetSdkTypeCommand = async ( output , context ) : Promise < GetSdkTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSdkTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , configurationProperties : undefined , description : undefined , friendlyName : undefined , id : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . configurationProperties !== undefined && data . configurationProperties !== null ) { contents . configurationProperties = deserializeAws_restJson1ListOfSdkConfigurationProperty ( data . configurationProperties , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . friendlyName !== undefined && data . friendlyName !== null ) { contents . friendlyName = __expectString ( data . friendlyName ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSdkTypeCommandError = async ( output , context ) : Promise < GetSdkTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetSdkTypesCommand = async ( output , context ) : Promise < GetSdkTypesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSdkTypesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfSdkType ( data . item , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSdkTypesCommandError = async ( output , context ) : Promise < GetSdkTypesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetStageCommand = async ( output , context ) : Promise < GetStageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetStageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , accessLogSettings : undefined , cacheClusterEnabled : undefined , cacheClusterSize : undefined , cacheClusterStatus : undefined , canarySettings : undefined , clientCertificateId : undefined , createdDate : undefined , deploymentId : undefined , description : undefined , documentationVersion : undefined , lastUpdatedDate : undefined , methodSettings : undefined , stageName : undefined , tags : undefined , tracingEnabled : undefined , variables : undefined , webAclArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . accessLogSettings !== undefined && data . accessLogSettings !== null ) { contents . accessLogSettings = deserializeAws_restJson1AccessLogSettings ( data . accessLogSettings , context ) ; } if ( data . cacheClusterEnabled !== undefined && data . cacheClusterEnabled !== null ) { contents . cacheClusterEnabled = __expectBoolean ( data . cacheClusterEnabled ) ; } if ( data . cacheClusterSize !== undefined && data . cacheClusterSize !== null ) { contents . cacheClusterSize = __expectString ( data . cacheClusterSize ) ; } if ( data . cacheClusterStatus !== undefined && data . cacheClusterStatus !== null ) { contents . cacheClusterStatus = __expectString ( data . cacheClusterStatus ) ; } if ( data . canarySettings !== undefined && data . canarySettings !== null ) { contents . canarySettings = deserializeAws_restJson1CanarySettings ( data . canarySettings , context ) ; } if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . deploymentId !== undefined && data . deploymentId !== null ) { contents . deploymentId = __expectString ( data . deploymentId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . documentationVersion !== undefined && data . documentationVersion !== null ) { contents . documentationVersion = __expectString ( data . documentationVersion ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . methodSettings !== undefined && data . methodSettings !== null ) { contents . methodSettings = deserializeAws_restJson1MapOfMethodSettings ( data . methodSettings , context ) ; } if ( data . stageName !== undefined && data . stageName !== null ) { contents . stageName = __expectString ( data . stageName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . tracingEnabled !== undefined && data . tracingEnabled !== null ) { contents . tracingEnabled = __expectBoolean ( data . tracingEnabled ) ; } if ( data . variables !== undefined && data . variables !== null ) { contents . variables = deserializeAws_restJson1MapOfStringToString ( data . variables , context ) ; } if ( data . webAclArn !== undefined && data . webAclArn !== null ) { contents . webAclArn = __expectString ( data . webAclArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetStageCommandError = async ( output , context ) : Promise < GetStageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetStagesCommand = async ( output , context ) : Promise < GetStagesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetStagesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , item : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . item = deserializeAws_restJson1ListOfStage ( data . item , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetStagesCommandError = async ( output , context ) : Promise < GetStagesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetTagsCommand = async ( output , context ) : Promise < GetTagsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTagsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTagsCommandError = async ( output , context ) : Promise < GetTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetUsageCommand = async ( output , context ) : Promise < GetUsageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , endDate : undefined , items : undefined , position : undefined , startDate : undefined , usagePlanId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . endDate !== undefined && data . endDate !== null ) { contents . endDate = __expectString ( data . endDate ) ; } if ( data . values !== undefined && data . values !== null ) { contents . items = deserializeAws_restJson1MapOfKeyUsages ( data . values , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } if ( data . startDate !== undefined && data . startDate !== null ) { contents . startDate = __expectString ( data . startDate ) ; } if ( data . usagePlanId !== undefined && data . usagePlanId !== null ) { contents . usagePlanId = __expectString ( data . usagePlanId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsageCommandError = async ( output , context ) : Promise < GetUsageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetUsagePlanCommand = async ( output , context ) : Promise < GetUsagePlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsagePlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiStages : undefined , description : undefined , id : undefined , name : undefined , productCode : undefined , quota : undefined , tags : undefined , throttle : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiStages !== undefined && data . apiStages !== null ) { contents . apiStages = deserializeAws_restJson1ListOfApiStage ( data . apiStages , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . productCode !== undefined && data . productCode !== null ) { contents . productCode = __expectString ( data . productCode ) ; } if ( data . quota !== undefined && data . quota !== null ) { contents . quota = deserializeAws_restJson1QuotaSettings ( data . quota , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . throttle !== undefined && data . throttle !== null ) { contents . throttle = deserializeAws_restJson1ThrottleSettings ( data . throttle , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsagePlanCommandError = async ( output , context ) : Promise < GetUsagePlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetUsagePlanKeyCommand = async ( output , context ) : Promise < GetUsagePlanKeyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsagePlanKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , name : undefined , type : undefined , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsagePlanKeyCommandError = async ( output , context ) : Promise < GetUsagePlanKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetUsagePlanKeysCommand = async ( output , context ) : Promise < GetUsagePlanKeysCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsagePlanKeysCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfUsagePlanKey ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsagePlanKeysCommandError = async ( output , context ) : Promise < GetUsagePlanKeysCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetUsagePlansCommand = async ( output , context ) : Promise < GetUsagePlansCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsagePlansCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfUsagePlan ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsagePlansCommandError = async ( output , context ) : Promise < GetUsagePlansCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetVpcLinkCommand = async ( output , context ) : Promise < GetVpcLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetVpcLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , description : undefined , id : undefined , name : undefined , status : undefined , statusMessage : undefined , tags : undefined , targetArns : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } if ( data . statusMessage !== undefined && data . statusMessage !== null ) { contents . statusMessage = __expectString ( data . statusMessage ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . targetArns !== undefined && data . targetArns !== null ) { contents . targetArns = deserializeAws_restJson1ListOfString ( data . targetArns , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetVpcLinkCommandError = async ( output , context ) : Promise < GetVpcLinkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetVpcLinksCommand = async ( output , context ) : Promise < GetVpcLinksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetVpcLinksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , position : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . item !== undefined && data . item !== null ) { contents . items = deserializeAws_restJson1ListOfVpcLink ( data . item , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetVpcLinksCommandError = async ( output , context ) : Promise < GetVpcLinksCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ImportApiKeysCommand = async ( output , context ) : Promise < ImportApiKeysCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1ImportApiKeysCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ids : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ids !== undefined && data . ids !== null ) { contents . ids = deserializeAws_restJson1ListOfString ( data . ids , context ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ImportApiKeysCommandError = async ( output , context ) : Promise < ImportApiKeysCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ImportDocumentationPartsCommand = async ( output , context ) : Promise < ImportDocumentationPartsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ImportDocumentationPartsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ids : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ids !== undefined && data . ids !== null ) { contents . ids = deserializeAws_restJson1ListOfString ( data . ids , context ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ImportDocumentationPartsCommandError = async ( output , context ) : Promise < ImportDocumentationPartsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ImportRestApiCommand = async ( output , context ) : Promise < ImportRestApiCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1ImportRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeySource : undefined , binaryMediaTypes : undefined , createdDate : undefined , description : undefined , disableExecuteApiEndpoint : undefined , endpointConfiguration : undefined , id : undefined , minimumCompressionSize : undefined , name : undefined , policy : undefined , tags : undefined , version : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeySource !== undefined && data . apiKeySource !== null ) { contents . apiKeySource = __expectString ( data . apiKeySource ) ; } if ( data . binaryMediaTypes !== undefined && data . binaryMediaTypes !== null ) { contents . binaryMediaTypes = deserializeAws_restJson1ListOfString ( data . binaryMediaTypes , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . disableExecuteApiEndpoint !== undefined && data . disableExecuteApiEndpoint !== null ) { contents . disableExecuteApiEndpoint = __expectBoolean ( data . disableExecuteApiEndpoint ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . minimumCompressionSize !== undefined && data . minimumCompressionSize !== null ) { contents . minimumCompressionSize = __expectInt32 ( data . minimumCompressionSize ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ImportRestApiCommandError = async ( output , context ) : Promise < ImportRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutGatewayResponseCommand = async ( output , context ) : Promise < PutGatewayResponseCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutGatewayResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , defaultResponse : undefined , responseParameters : undefined , responseTemplates : undefined , responseType : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . defaultResponse !== undefined && data . defaultResponse !== null ) { contents . defaultResponse = __expectBoolean ( data . defaultResponse ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . responseType !== undefined && data . responseType !== null ) { contents . responseType = __expectString ( data . responseType ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutGatewayResponseCommandError = async ( output , context ) : Promise < PutGatewayResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutIntegrationCommand = async ( output , context ) : Promise < PutIntegrationCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutIntegrationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , cacheKeyParameters : undefined , cacheNamespace : undefined , connectionId : undefined , connectionType : undefined , contentHandling : undefined , credentials : undefined , httpMethod : undefined , integrationResponses : undefined , passthroughBehavior : undefined , requestParameters : undefined , requestTemplates : undefined , timeoutInMillis : undefined , tlsConfig : undefined , type : undefined , uri : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cacheKeyParameters !== undefined && data . cacheKeyParameters !== null ) { contents . cacheKeyParameters = deserializeAws_restJson1ListOfString ( data . cacheKeyParameters , context ) ; } if ( data . cacheNamespace !== undefined && data . cacheNamespace !== null ) { contents . cacheNamespace = __expectString ( data . cacheNamespace ) ; } if ( data . connectionId !== undefined && data . connectionId !== null ) { contents . connectionId = __expectString ( data . connectionId ) ; } if ( data . connectionType !== undefined && data . connectionType !== null ) { contents . connectionType = __expectString ( data . connectionType ) ; } if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . credentials !== undefined && data . credentials !== null ) { contents . credentials = __expectString ( data . credentials ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . integrationResponses !== undefined && data . integrationResponses !== null ) { contents . integrationResponses = deserializeAws_restJson1MapOfIntegrationResponse ( data . integrationResponses , context ) ; } if ( data . passthroughBehavior !== undefined && data . passthroughBehavior !== null ) { contents . passthroughBehavior = __expectString ( data . passthroughBehavior ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToString ( data . requestParameters , context ) ; } if ( data . requestTemplates !== undefined && data . requestTemplates !== null ) { contents . requestTemplates = deserializeAws_restJson1MapOfStringToString ( data . requestTemplates , context ) ; } if ( data . timeoutInMillis !== undefined && data . timeoutInMillis !== null ) { contents . timeoutInMillis = __expectInt32 ( data . timeoutInMillis ) ; } if ( data . tlsConfig !== undefined && data . tlsConfig !== null ) { contents . tlsConfig = deserializeAws_restJson1TlsConfig ( data . tlsConfig , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } if ( data . uri !== undefined && data . uri !== null ) { contents . uri = __expectString ( data . uri ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutIntegrationCommandError = async ( output , context ) : Promise < PutIntegrationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutIntegrationResponseCommand = async ( output , context ) : Promise < PutIntegrationResponseCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutIntegrationResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentHandling : undefined , responseParameters : undefined , responseTemplates : undefined , selectionPattern : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . selectionPattern !== undefined && data . selectionPattern !== null ) { contents . selectionPattern = __expectString ( data . selectionPattern ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutIntegrationResponseCommandError = async ( output , context ) : Promise < PutIntegrationResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutMethodCommand = async ( output , context ) : Promise < PutMethodCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutMethodCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeyRequired : undefined , authorizationScopes : undefined , authorizationType : undefined , authorizerId : undefined , httpMethod : undefined , methodIntegration : undefined , methodResponses : undefined , operationName : undefined , requestModels : undefined , requestParameters : undefined , requestValidatorId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeyRequired !== undefined && data . apiKeyRequired !== null ) { contents . apiKeyRequired = __expectBoolean ( data . apiKeyRequired ) ; } if ( data . authorizationScopes !== undefined && data . authorizationScopes !== null ) { contents . authorizationScopes = deserializeAws_restJson1ListOfString ( data . authorizationScopes , context ) ; } if ( data . authorizationType !== undefined && data . authorizationType !== null ) { contents . authorizationType = __expectString ( data . authorizationType ) ; } if ( data . authorizerId !== undefined && data . authorizerId !== null ) { contents . authorizerId = __expectString ( data . authorizerId ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . methodIntegration !== undefined && data . methodIntegration !== null ) { contents . methodIntegration = deserializeAws_restJson1Integration ( data . methodIntegration , context ) ; } if ( data . methodResponses !== undefined && data . methodResponses !== null ) { contents . methodResponses = deserializeAws_restJson1MapOfMethodResponse ( data . methodResponses , context ) ; } if ( data . operationName !== undefined && data . operationName !== null ) { contents . operationName = __expectString ( data . operationName ) ; } if ( data . requestModels !== undefined && data . requestModels !== null ) { contents . requestModels = deserializeAws_restJson1MapOfStringToString ( data . requestModels , context ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . requestParameters , context ) ; } if ( data . requestValidatorId !== undefined && data . requestValidatorId !== null ) { contents . requestValidatorId = __expectString ( data . requestValidatorId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutMethodCommandError = async ( output , context ) : Promise < PutMethodCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutMethodResponseCommand = async ( output , context ) : Promise < PutMethodResponseCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutMethodResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , responseModels : undefined , responseParameters : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . responseModels !== undefined && data . responseModels !== null ) { contents . responseModels = deserializeAws_restJson1MapOfStringToString ( data . responseModels , context ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . responseParameters , context ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutMethodResponseCommandError = async ( output , context ) : Promise < PutMethodResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutRestApiCommand = async ( output , context ) : Promise < PutRestApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeySource : undefined , binaryMediaTypes : undefined , createdDate : undefined , description : undefined , disableExecuteApiEndpoint : undefined , endpointConfiguration : undefined , id : undefined , minimumCompressionSize : undefined , name : undefined , policy : undefined , tags : undefined , version : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeySource !== undefined && data . apiKeySource !== null ) { contents . apiKeySource = __expectString ( data . apiKeySource ) ; } if ( data . binaryMediaTypes !== undefined && data . binaryMediaTypes !== null ) { contents . binaryMediaTypes = deserializeAws_restJson1ListOfString ( data . binaryMediaTypes , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . disableExecuteApiEndpoint !== undefined && data . disableExecuteApiEndpoint !== null ) { contents . disableExecuteApiEndpoint = __expectBoolean ( data . disableExecuteApiEndpoint ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . minimumCompressionSize !== undefined && data . minimumCompressionSize !== null ) { contents . minimumCompressionSize = __expectInt32 ( data . minimumCompressionSize ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutRestApiCommandError = async ( output , context ) : Promise < PutRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TestInvokeAuthorizerCommand = async ( output , context ) : Promise < TestInvokeAuthorizerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TestInvokeAuthorizerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , authorization : undefined , claims : undefined , clientStatus : undefined , latency : undefined , log : undefined , policy : undefined , principalId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . authorization !== undefined && data . authorization !== null ) { contents . authorization = deserializeAws_restJson1MapOfStringToList ( data . authorization , context ) ; } if ( data . claims !== undefined && data . claims !== null ) { contents . claims = deserializeAws_restJson1MapOfStringToString ( data . claims , context ) ; } if ( data . clientStatus !== undefined && data . clientStatus !== null ) { contents . clientStatus = __expectInt32 ( data . clientStatus ) ; } if ( data . latency !== undefined && data . latency !== null ) { contents . latency = __expectLong ( data . latency ) ; } if ( data . log !== undefined && data . log !== null ) { contents . log = __expectString ( data . log ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . principalId !== undefined && data . principalId !== null ) { contents . principalId = __expectString ( data . principalId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TestInvokeAuthorizerCommandError = async ( output , context ) : Promise < TestInvokeAuthorizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TestInvokeMethodCommand = async ( output , context ) : Promise < TestInvokeMethodCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TestInvokeMethodCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , body : undefined , headers : undefined , latency : undefined , log : undefined , multiValueHeaders : undefined , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . body !== undefined && data . body !== null ) { contents . body = __expectString ( data . body ) ; } if ( data . headers !== undefined && data . headers !== null ) { contents . headers = deserializeAws_restJson1MapOfStringToString ( data . headers , context ) ; } if ( data . latency !== undefined && data . latency !== null ) { contents . latency = __expectLong ( data . latency ) ; } if ( data . log !== undefined && data . log !== null ) { contents . log = __expectString ( data . log ) ; } if ( data . multiValueHeaders !== undefined && data . multiValueHeaders !== null ) { contents . multiValueHeaders = deserializeAws_restJson1MapOfStringToList ( data . multiValueHeaders , context ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectInt32 ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TestInvokeMethodCommandError = async ( output , context ) : Promise < TestInvokeMethodCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateAccountCommand = async ( output , context ) : Promise < UpdateAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeyVersion : undefined , cloudwatchRoleArn : undefined , features : undefined , throttleSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeyVersion !== undefined && data . apiKeyVersion !== null ) { contents . apiKeyVersion = __expectString ( data . apiKeyVersion ) ; } if ( data . cloudwatchRoleArn !== undefined && data . cloudwatchRoleArn !== null ) { contents . cloudwatchRoleArn = __expectString ( data . cloudwatchRoleArn ) ; } if ( data . features !== undefined && data . features !== null ) { contents . features = deserializeAws_restJson1ListOfString ( data . features , context ) ; } if ( data . throttleSettings !== undefined && data . throttleSettings !== null ) { contents . throttleSettings = deserializeAws_restJson1ThrottleSettings ( data . throttleSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAccountCommandError = async ( output , context ) : Promise < UpdateAccountCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateApiKeyCommand = async ( output , context ) : Promise < UpdateApiKeyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApiKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , customerId : undefined , description : undefined , enabled : undefined , id : undefined , lastUpdatedDate : undefined , name : undefined , stageKeys : undefined , tags : undefined , value : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . customerId !== undefined && data . customerId !== null ) { contents . customerId = __expectString ( data . customerId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . enabled !== undefined && data . enabled !== null ) { contents . enabled = __expectBoolean ( data . enabled ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . stageKeys !== undefined && data . stageKeys !== null ) { contents . stageKeys = deserializeAws_restJson1ListOfString ( data . stageKeys , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . value !== undefined && data . value !== null ) { contents . value = __expectString ( data . value ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApiKeyCommandError = async ( output , context ) : Promise < UpdateApiKeyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateAuthorizerCommand = async ( output , context ) : Promise < UpdateAuthorizerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAuthorizerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , authType : undefined , authorizerCredentials : undefined , authorizerResultTtlInSeconds : undefined , authorizerUri : undefined , id : undefined , identitySource : undefined , identityValidationExpression : undefined , name : undefined , providerARNs : undefined , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . authType !== undefined && data . authType !== null ) { contents . authType = __expectString ( data . authType ) ; } if ( data . authorizerCredentials !== undefined && data . authorizerCredentials !== null ) { contents . authorizerCredentials = __expectString ( data . authorizerCredentials ) ; } if ( data . authorizerResultTtlInSeconds !== undefined && data . authorizerResultTtlInSeconds !== null ) { contents . authorizerResultTtlInSeconds = __expectInt32 ( data . authorizerResultTtlInSeconds ) ; } if ( data . authorizerUri !== undefined && data . authorizerUri !== null ) { contents . authorizerUri = __expectString ( data . authorizerUri ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . identitySource !== undefined && data . identitySource !== null ) { contents . identitySource = __expectString ( data . identitySource ) ; } if ( data . identityValidationExpression !== undefined && data . identityValidationExpression !== null ) { contents . identityValidationExpression = __expectString ( data . identityValidationExpression ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . providerARNs !== undefined && data . providerARNs !== null ) { contents . providerARNs = deserializeAws_restJson1ListOfARNs ( data . providerARNs , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAuthorizerCommandError = async ( output , context ) : Promise < UpdateAuthorizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateBasePathMappingCommand = async ( output , context ) : Promise < UpdateBasePathMappingCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateBasePathMappingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , basePath : undefined , restApiId : undefined , stage : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . basePath !== undefined && data . basePath !== null ) { contents . basePath = __expectString ( data . basePath ) ; } if ( data . restApiId !== undefined && data . restApiId !== null ) { contents . restApiId = __expectString ( data . restApiId ) ; } if ( data . stage !== undefined && data . stage !== null ) { contents . stage = __expectString ( data . stage ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateBasePathMappingCommandError = async ( output , context ) : Promise < UpdateBasePathMappingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateClientCertificateCommand = async ( output , context ) : Promise < UpdateClientCertificateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateClientCertificateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , clientCertificateId : undefined , createdDate : undefined , description : undefined , expirationDate : undefined , pemEncodedCertificate : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . expirationDate !== undefined && data . expirationDate !== null ) { contents . expirationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . expirationDate ) ) ) ; } if ( data . pemEncodedCertificate !== undefined && data . pemEncodedCertificate !== null ) { contents . pemEncodedCertificate = __expectString ( data . pemEncodedCertificate ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateClientCertificateCommandError = async ( output , context ) : Promise < UpdateClientCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateDeploymentCommand = async ( output , context ) : Promise < UpdateDeploymentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiSummary : undefined , createdDate : undefined , description : undefined , id : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiSummary !== undefined && data . apiSummary !== null ) { contents . apiSummary = deserializeAws_restJson1PathToMapOfMethodSnapshot ( data . apiSummary , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDeploymentCommandError = async ( output , context ) : Promise < UpdateDeploymentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.apigateway#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateDocumentationPartCommand = async ( output , context ) : Promise < UpdateDocumentationPartCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDocumentationPartCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , location : undefined , properties : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . location !== undefined && data . location !== null ) { contents . location = deserializeAws_restJson1DocumentationPartLocation ( data . location , context ) ; } if ( data . properties !== undefined && data . properties !== null ) { contents . properties = __expectString ( data . properties ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDocumentationPartCommandError = async ( output , context ) : Promise < UpdateDocumentationPartCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateDocumentationVersionCommand = async ( output , context ) : Promise < UpdateDocumentationVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDocumentationVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , createdDate : undefined , description : undefined , version : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDocumentationVersionCommandError = async ( output , context ) : Promise < UpdateDocumentationVersionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateDomainNameCommand = async ( output , context ) : Promise < UpdateDomainNameCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDomainNameCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , certificateArn : undefined , certificateName : undefined , certificateUploadDate : undefined , distributionDomainName : undefined , distributionHostedZoneId : undefined , domainName : undefined , domainNameStatus : undefined , domainNameStatusMessage : undefined , endpointConfiguration : undefined , mutualTlsAuthentication : undefined , ownershipVerificationCertificateArn : undefined , regionalCertificateArn : undefined , regionalCertificateName : undefined , regionalDomainName : undefined , regionalHostedZoneId : undefined , securityPolicy : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . certificateArn !== undefined && data . certificateArn !== null ) { contents . certificateArn = __expectString ( data . certificateArn ) ; } if ( data . certificateName !== undefined && data . certificateName !== null ) { contents . certificateName = __expectString ( data . certificateName ) ; } if ( data . certificateUploadDate !== undefined && data . certificateUploadDate !== null ) { contents . certificateUploadDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . certificateUploadDate ) ) ) ; } if ( data . distributionDomainName !== undefined && data . distributionDomainName !== null ) { contents . distributionDomainName = __expectString ( data . distributionDomainName ) ; } if ( data . distributionHostedZoneId !== undefined && data . distributionHostedZoneId !== null ) { contents . distributionHostedZoneId = __expectString ( data . distributionHostedZoneId ) ; } if ( data . domainName !== undefined && data . domainName !== null ) { contents . domainName = __expectString ( data . domainName ) ; } if ( data . domainNameStatus !== undefined && data . domainNameStatus !== null ) { contents . domainNameStatus = __expectString ( data . domainNameStatus ) ; } if ( data . domainNameStatusMessage !== undefined && data . domainNameStatusMessage !== null ) { contents . domainNameStatusMessage = __expectString ( data . domainNameStatusMessage ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . mutualTlsAuthentication !== undefined && data . mutualTlsAuthentication !== null ) { contents . mutualTlsAuthentication = deserializeAws_restJson1MutualTlsAuthentication ( data . mutualTlsAuthentication , context ) ; } if ( data . ownershipVerificationCertificateArn !== undefined && data . ownershipVerificationCertificateArn !== null ) { contents . ownershipVerificationCertificateArn = __expectString ( data . ownershipVerificationCertificateArn ) ; } if ( data . regionalCertificateArn !== undefined && data . regionalCertificateArn !== null ) { contents . regionalCertificateArn = __expectString ( data . regionalCertificateArn ) ; } if ( data . regionalCertificateName !== undefined && data . regionalCertificateName !== null ) { contents . regionalCertificateName = __expectString ( data . regionalCertificateName ) ; } if ( data . regionalDomainName !== undefined && data . regionalDomainName !== null ) { contents . regionalDomainName = __expectString ( data . regionalDomainName ) ; } if ( data . regionalHostedZoneId !== undefined && data . regionalHostedZoneId !== null ) { contents . regionalHostedZoneId = __expectString ( data . regionalHostedZoneId ) ; } if ( data . securityPolicy !== undefined && data . securityPolicy !== null ) { contents . securityPolicy = __expectString ( data . securityPolicy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDomainNameCommandError = async ( output , context ) : Promise < UpdateDomainNameCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateGatewayResponseCommand = async ( output , context ) : Promise < UpdateGatewayResponseCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGatewayResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , defaultResponse : undefined , responseParameters : undefined , responseTemplates : undefined , responseType : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . defaultResponse !== undefined && data . defaultResponse !== null ) { contents . defaultResponse = __expectBoolean ( data . defaultResponse ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . responseType !== undefined && data . responseType !== null ) { contents . responseType = __expectString ( data . responseType ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGatewayResponseCommandError = async ( output , context ) : Promise < UpdateGatewayResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateIntegrationCommand = async ( output , context ) : Promise < UpdateIntegrationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateIntegrationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , cacheKeyParameters : undefined , cacheNamespace : undefined , connectionId : undefined , connectionType : undefined , contentHandling : undefined , credentials : undefined , httpMethod : undefined , integrationResponses : undefined , passthroughBehavior : undefined , requestParameters : undefined , requestTemplates : undefined , timeoutInMillis : undefined , tlsConfig : undefined , type : undefined , uri : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cacheKeyParameters !== undefined && data . cacheKeyParameters !== null ) { contents . cacheKeyParameters = deserializeAws_restJson1ListOfString ( data . cacheKeyParameters , context ) ; } if ( data . cacheNamespace !== undefined && data . cacheNamespace !== null ) { contents . cacheNamespace = __expectString ( data . cacheNamespace ) ; } if ( data . connectionId !== undefined && data . connectionId !== null ) { contents . connectionId = __expectString ( data . connectionId ) ; } if ( data . connectionType !== undefined && data . connectionType !== null ) { contents . connectionType = __expectString ( data . connectionType ) ; } if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . credentials !== undefined && data . credentials !== null ) { contents . credentials = __expectString ( data . credentials ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . integrationResponses !== undefined && data . integrationResponses !== null ) { contents . integrationResponses = deserializeAws_restJson1MapOfIntegrationResponse ( data . integrationResponses , context ) ; } if ( data . passthroughBehavior !== undefined && data . passthroughBehavior !== null ) { contents . passthroughBehavior = __expectString ( data . passthroughBehavior ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToString ( data . requestParameters , context ) ; } if ( data . requestTemplates !== undefined && data . requestTemplates !== null ) { contents . requestTemplates = deserializeAws_restJson1MapOfStringToString ( data . requestTemplates , context ) ; } if ( data . timeoutInMillis !== undefined && data . timeoutInMillis !== null ) { contents . timeoutInMillis = __expectInt32 ( data . timeoutInMillis ) ; } if ( data . tlsConfig !== undefined && data . tlsConfig !== null ) { contents . tlsConfig = deserializeAws_restJson1TlsConfig ( data . tlsConfig , context ) ; } if ( data . type !== undefined && data . type !== null ) { contents . type = __expectString ( data . type ) ; } if ( data . uri !== undefined && data . uri !== null ) { contents . uri = __expectString ( data . uri ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateIntegrationCommandError = async ( output , context ) : Promise < UpdateIntegrationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateIntegrationResponseCommand = async ( output , context ) : Promise < UpdateIntegrationResponseCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateIntegrationResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentHandling : undefined , responseParameters : undefined , responseTemplates : undefined , selectionPattern : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentHandling !== undefined && data . contentHandling !== null ) { contents . contentHandling = __expectString ( data . contentHandling ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToString ( data . responseParameters , context ) ; } if ( data . responseTemplates !== undefined && data . responseTemplates !== null ) { contents . responseTemplates = deserializeAws_restJson1MapOfStringToString ( data . responseTemplates , context ) ; } if ( data . selectionPattern !== undefined && data . selectionPattern !== null ) { contents . selectionPattern = __expectString ( data . selectionPattern ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateIntegrationResponseCommandError = async ( output , context ) : Promise < UpdateIntegrationResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateMethodCommand = async ( output , context ) : Promise < UpdateMethodCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateMethodCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeyRequired : undefined , authorizationScopes : undefined , authorizationType : undefined , authorizerId : undefined , httpMethod : undefined , methodIntegration : undefined , methodResponses : undefined , operationName : undefined , requestModels : undefined , requestParameters : undefined , requestValidatorId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeyRequired !== undefined && data . apiKeyRequired !== null ) { contents . apiKeyRequired = __expectBoolean ( data . apiKeyRequired ) ; } if ( data . authorizationScopes !== undefined && data . authorizationScopes !== null ) { contents . authorizationScopes = deserializeAws_restJson1ListOfString ( data . authorizationScopes , context ) ; } if ( data . authorizationType !== undefined && data . authorizationType !== null ) { contents . authorizationType = __expectString ( data . authorizationType ) ; } if ( data . authorizerId !== undefined && data . authorizerId !== null ) { contents . authorizerId = __expectString ( data . authorizerId ) ; } if ( data . httpMethod !== undefined && data . httpMethod !== null ) { contents . httpMethod = __expectString ( data . httpMethod ) ; } if ( data . methodIntegration !== undefined && data . methodIntegration !== null ) { contents . methodIntegration = deserializeAws_restJson1Integration ( data . methodIntegration , context ) ; } if ( data . methodResponses !== undefined && data . methodResponses !== null ) { contents . methodResponses = deserializeAws_restJson1MapOfMethodResponse ( data . methodResponses , context ) ; } if ( data . operationName !== undefined && data . operationName !== null ) { contents . operationName = __expectString ( data . operationName ) ; } if ( data . requestModels !== undefined && data . requestModels !== null ) { contents . requestModels = deserializeAws_restJson1MapOfStringToString ( data . requestModels , context ) ; } if ( data . requestParameters !== undefined && data . requestParameters !== null ) { contents . requestParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . requestParameters , context ) ; } if ( data . requestValidatorId !== undefined && data . requestValidatorId !== null ) { contents . requestValidatorId = __expectString ( data . requestValidatorId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateMethodCommandError = async ( output , context ) : Promise < UpdateMethodCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateMethodResponseCommand = async ( output , context ) : Promise < UpdateMethodResponseCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateMethodResponseCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , responseModels : undefined , responseParameters : undefined , statusCode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . responseModels !== undefined && data . responseModels !== null ) { contents . responseModels = deserializeAws_restJson1MapOfStringToString ( data . responseModels , context ) ; } if ( data . responseParameters !== undefined && data . responseParameters !== null ) { contents . responseParameters = deserializeAws_restJson1MapOfStringToBoolean ( data . responseParameters , context ) ; } if ( data . statusCode !== undefined && data . statusCode !== null ) { contents . statusCode = __expectString ( data . statusCode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateMethodResponseCommandError = async ( output , context ) : Promise < UpdateMethodResponseCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateModelCommand = async ( output , context ) : Promise < UpdateModelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , contentType : undefined , description : undefined , id : undefined , name : undefined , schema : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . contentType !== undefined && data . contentType !== null ) { contents . contentType = __expectString ( data . contentType ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . schema !== undefined && data . schema !== null ) { contents . schema = __expectString ( data . schema ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateModelCommandError = async ( output , context ) : Promise < UpdateModelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateRequestValidatorCommand = async ( output , context ) : Promise < UpdateRequestValidatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRequestValidatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , name : undefined , validateRequestBody : undefined , validateRequestParameters : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . validateRequestBody !== undefined && data . validateRequestBody !== null ) { contents . validateRequestBody = __expectBoolean ( data . validateRequestBody ) ; } if ( data . validateRequestParameters !== undefined && data . validateRequestParameters !== null ) { contents . validateRequestParameters = __expectBoolean ( data . validateRequestParameters ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRequestValidatorCommandError = async ( output , context ) : Promise < UpdateRequestValidatorCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateResourceCommand = async ( output , context ) : Promise < UpdateResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , id : undefined , parentId : undefined , path : undefined , pathPart : undefined , resourceMethods : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . parentId !== undefined && data . parentId !== null ) { contents . parentId = __expectString ( data . parentId ) ; } if ( data . path !== undefined && data . path !== null ) { contents . path = __expectString ( data . path ) ; } if ( data . pathPart !== undefined && data . pathPart !== null ) { contents . pathPart = __expectString ( data . pathPart ) ; } if ( data . resourceMethods !== undefined && data . resourceMethods !== null ) { contents . resourceMethods = deserializeAws_restJson1MapOfMethod ( data . resourceMethods , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateResourceCommandError = async ( output , context ) : Promise < UpdateResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateRestApiCommand = async ( output , context ) : Promise < UpdateRestApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRestApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeySource : undefined , binaryMediaTypes : undefined , createdDate : undefined , description : undefined , disableExecuteApiEndpoint : undefined , endpointConfiguration : undefined , id : undefined , minimumCompressionSize : undefined , name : undefined , policy : undefined , tags : undefined , version : undefined , warnings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeySource !== undefined && data . apiKeySource !== null ) { contents . apiKeySource = __expectString ( data . apiKeySource ) ; } if ( data . binaryMediaTypes !== undefined && data . binaryMediaTypes !== null ) { contents . binaryMediaTypes = deserializeAws_restJson1ListOfString ( data . binaryMediaTypes , context ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . disableExecuteApiEndpoint !== undefined && data . disableExecuteApiEndpoint !== null ) { contents . disableExecuteApiEndpoint = __expectBoolean ( data . disableExecuteApiEndpoint ) ; } if ( data . endpointConfiguration !== undefined && data . endpointConfiguration !== null ) { contents . endpointConfiguration = deserializeAws_restJson1EndpointConfiguration ( data . endpointConfiguration , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . minimumCompressionSize !== undefined && data . minimumCompressionSize !== null ) { contents . minimumCompressionSize = __expectInt32 ( data . minimumCompressionSize ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . policy !== undefined && data . policy !== null ) { contents . policy = __expectString ( data . policy ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . version !== undefined && data . version !== null ) { contents . version = __expectString ( data . version ) ; } if ( data . warnings !== undefined && data . warnings !== null ) { contents . warnings = deserializeAws_restJson1ListOfString ( data . warnings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRestApiCommandError = async ( output , context ) : Promise < UpdateRestApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateStageCommand = async ( output , context ) : Promise < UpdateStageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateStageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , accessLogSettings : undefined , cacheClusterEnabled : undefined , cacheClusterSize : undefined , cacheClusterStatus : undefined , canarySettings : undefined , clientCertificateId : undefined , createdDate : undefined , deploymentId : undefined , description : undefined , documentationVersion : undefined , lastUpdatedDate : undefined , methodSettings : undefined , stageName : undefined , tags : undefined , tracingEnabled : undefined , variables : undefined , webAclArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . accessLogSettings !== undefined && data . accessLogSettings !== null ) { contents . accessLogSettings = deserializeAws_restJson1AccessLogSettings ( data . accessLogSettings , context ) ; } if ( data . cacheClusterEnabled !== undefined && data . cacheClusterEnabled !== null ) { contents . cacheClusterEnabled = __expectBoolean ( data . cacheClusterEnabled ) ; } if ( data . cacheClusterSize !== undefined && data . cacheClusterSize !== null ) { contents . cacheClusterSize = __expectString ( data . cacheClusterSize ) ; } if ( data . cacheClusterStatus !== undefined && data . cacheClusterStatus !== null ) { contents . cacheClusterStatus = __expectString ( data . cacheClusterStatus ) ; } if ( data . canarySettings !== undefined && data . canarySettings !== null ) { contents . canarySettings = deserializeAws_restJson1CanarySettings ( data . canarySettings , context ) ; } if ( data . clientCertificateId !== undefined && data . clientCertificateId !== null ) { contents . clientCertificateId = __expectString ( data . clientCertificateId ) ; } if ( data . createdDate !== undefined && data . createdDate !== null ) { contents . createdDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . createdDate ) ) ) ; } if ( data . deploymentId !== undefined && data . deploymentId !== null ) { contents . deploymentId = __expectString ( data . deploymentId ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . documentationVersion !== undefined && data . documentationVersion !== null ) { contents . documentationVersion = __expectString ( data . documentationVersion ) ; } if ( data . lastUpdatedDate !== undefined && data . lastUpdatedDate !== null ) { contents . lastUpdatedDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastUpdatedDate ) ) ) ; } if ( data . methodSettings !== undefined && data . methodSettings !== null ) { contents . methodSettings = deserializeAws_restJson1MapOfMethodSettings ( data . methodSettings , context ) ; } if ( data . stageName !== undefined && data . stageName !== null ) { contents . stageName = __expectString ( data . stageName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . tracingEnabled !== undefined && data . tracingEnabled !== null ) { contents . tracingEnabled = __expectBoolean ( data . tracingEnabled ) ; } if ( data . variables !== undefined && data . variables !== null ) { contents . variables = deserializeAws_restJson1MapOfStringToString ( data . variables , context ) ; } if ( data . webAclArn !== undefined && data . webAclArn !== null ) { contents . webAclArn = __expectString ( data . webAclArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateStageCommandError = async ( output , context ) : Promise < UpdateStageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateUsageCommand = async ( output , context ) : Promise < UpdateUsageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateUsageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , endDate : undefined , items : undefined , position : undefined , startDate : undefined , usagePlanId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . endDate !== undefined && data . endDate !== null ) { contents . endDate = __expectString ( data . endDate ) ; } if ( data . values !== undefined && data . values !== null ) { contents . items = deserializeAws_restJson1MapOfKeyUsages ( data . values , context ) ; } if ( data . position !== undefined && data . position !== null ) { contents . position = __expectString ( data . position ) ; } if ( data . startDate !== undefined && data . startDate !== null ) { contents . startDate = __expectString ( data . startDate ) ; } if ( data . usagePlanId !== undefined && data . usagePlanId !== null ) { contents . usagePlanId = __expectString ( data . usagePlanId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateUsageCommandError = async ( output , context ) : Promise < UpdateUsageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateUsagePlanCommand = async ( output , context ) : Promise < UpdateUsagePlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateUsagePlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiStages : undefined , description : undefined , id : undefined , name : undefined , productCode : undefined , quota : undefined , tags : undefined , throttle : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiStages !== undefined && data . apiStages !== null ) { contents . apiStages = deserializeAws_restJson1ListOfApiStage ( data . apiStages , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . productCode !== undefined && data . productCode !== null ) { contents . productCode = __expectString ( data . productCode ) ; } if ( data . quota !== undefined && data . quota !== null ) { contents . quota = deserializeAws_restJson1QuotaSettings ( data . quota , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . throttle !== undefined && data . throttle !== null ) { contents . throttle = deserializeAws_restJson1ThrottleSettings ( data . throttle , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateUsagePlanCommandError = async ( output , context ) : Promise < UpdateUsagePlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateVpcLinkCommand = async ( output , context ) : Promise < UpdateVpcLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateVpcLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , description : undefined , id : undefined , name : undefined , status : undefined , statusMessage : undefined , tags : undefined , targetArns : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . id !== undefined && data . id !== null ) { contents . id = __expectString ( data . id ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } if ( data . statusMessage !== undefined && data . statusMessage !== null ) { contents . statusMessage = __expectString ( data . statusMessage ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1MapOfStringToString ( data . tags , context ) ; } if ( data . targetArns !== undefined && data . targetArns !== null ) { contents . targetArns = deserializeAws_restJson1ListOfString ( data . targetArns , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateVpcLinkCommandError = async ( output , context ) : Promise < UpdateVpcLinkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.apigateway#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.apigateway#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.apigateway#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.apigateway#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.apigateway#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.apigateway#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = parsedOutput . headers [ "retry-after" ] ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const contents = { name : "NotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = parsedOutput . headers [ "retry-after" ] ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = parsedOutput . headers [ "retry-after" ] ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1UnauthorizedExceptionResponse = async ( parsedOutput , context ) : Promise < UnauthorizedException > => { const contents = { name : "UnauthorizedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1ApiStage = ( input , context ) : any => { return { ... ( input . apiId !== undefined && input . apiId !== null && { apiId : input . apiId } ) , ... ( input . stage !== undefined && input . stage !== null && { stage : input . stage } ) , ... ( input . throttle !== undefined && input . throttle !== null && { throttle : serializeAws_restJson1MapOfApiStageThrottleSettings ( input . throttle , context ) , } ) , } ; } ; const serializeAws_restJson1CanarySettings = ( input , context ) : any => { return { ... ( input . deploymentId !== undefined && input . deploymentId !== null && { deploymentId : input . deploymentId } ) , ... ( input . percentTraffic !== undefined && input . percentTraffic !== null && { percentTraffic : __serializeFloat ( input . percentTraffic ) } ) , ... ( input . stageVariableOverrides !== undefined && input . stageVariableOverrides !== null && { stageVariableOverrides : serializeAws_restJson1MapOfStringToString ( input . stageVariableOverrides , context ) , } ) , ... ( input . useStageCache !== undefined && input . useStageCache !== null && { useStageCache : input . useStageCache } ) , } ; } ; const serializeAws_restJson1DeploymentCanarySettings = ( input , context ) : any => { return { ... ( input . percentTraffic !== undefined && input . percentTraffic !== null && { percentTraffic : __serializeFloat ( input . percentTraffic ) } ) , ... ( input . stageVariableOverrides !== undefined && input . stageVariableOverrides !== null && { stageVariableOverrides : serializeAws_restJson1MapOfStringToString ( input . stageVariableOverrides , context ) , } ) , ... ( input . useStageCache !== undefined && input . useStageCache !== null && { useStageCache : input . useStageCache } ) , } ; } ; const serializeAws_restJson1DocumentationPartLocation = ( input , context ) : any => { return { ... ( input . method !== undefined && input . method !== null && { method : input . method } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . path !== undefined && input . path !== null && { path : input . path } ) , ... ( input . statusCode !== undefined && input . statusCode !== null && { statusCode : input . statusCode } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ; } ; const serializeAws_restJson1EndpointConfiguration = ( input , context ) : any => { return { ... ( input . types !== undefined && input . types !== null && { types : serializeAws_restJson1ListOfEndpointType ( input . types , context ) } ) , ... ( input . vpcEndpointIds !== undefined && input . vpcEndpointIds !== null && { vpcEndpointIds : serializeAws_restJson1ListOfString ( input . vpcEndpointIds , context ) , } ) , } ; } ; const serializeAws_restJson1ListOfApiStage = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ApiStage ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfARNs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ListOfEndpointType = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ListOfPatchOperation = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1PatchOperation ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfStageKeys = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1StageKey ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfString = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1MapOfApiStageThrottleSettings = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ThrottleSettings ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfStringToBoolean = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfStringToList = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ListOfString ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfStringToString = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1MutualTlsAuthenticationInput = ( input , context ) : any => { return { ... ( input . truststoreUri !== undefined && input . truststoreUri !== null && { truststoreUri : input . truststoreUri } ) , ... ( input . truststoreVersion !== undefined && input . truststoreVersion !== null && { truststoreVersion : input . truststoreVersion } ) , } ; } ; const serializeAws_restJson1PatchOperation = ( input , context ) : any => { return { ... ( input . from !== undefined && input . from !== null && { from : input . from } ) , ... ( input . op !== undefined && input . op !== null && { op : input . op } ) , ... ( input . path !== undefined && input . path !== null && { path : input . path } ) , ... ( input . value !== undefined && input . value !== null && { value : input . value } ) , } ; } ; const serializeAws_restJson1QuotaSettings = ( input , context ) : any => { return { ... ( input . limit !== undefined && input . limit !== null && { limit : input . limit } ) , ... ( input . offset !== undefined && input . offset !== null && { offset : input . offset } ) , ... ( input . period !== undefined && input . period !== null && { period : input . period } ) , } ; } ; const serializeAws_restJson1StageKey = ( input , context ) : any => { return { ... ( input . restApiId !== undefined && input . restApiId !== null && { restApiId : input . restApiId } ) , ... ( input . stageName !== undefined && input . stageName !== null && { stageName : input . stageName } ) , } ; } ; const serializeAws_restJson1ThrottleSettings = ( input , context ) : any => { return { ... ( input . burstLimit !== undefined && input . burstLimit !== null && { burstLimit : input . burstLimit } ) , ... ( input . rateLimit !== undefined && input . rateLimit !== null && { rateLimit : __serializeFloat ( input . rateLimit ) } ) , } ; } ; const serializeAws_restJson1TlsConfig = ( input , context ) : any => { return { ... ( input . insecureSkipVerification !== undefined && input . insecureSkipVerification !== null && { insecureSkipVerification : input . insecureSkipVerification } ) , } ; } ; const deserializeAws_restJson1AccessLogSettings = ( output , context ) : AccessLogSettings => { return { destinationArn : __expectString ( output . destinationArn ) , format : __expectString ( output . format ) , } as any ; } ; const deserializeAws_restJson1ApiKey = ( output , context ) : ApiKey => { return { createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , customerId : __expectString ( output . customerId ) , description : __expectString ( output . description ) , enabled : __expectBoolean ( output . enabled ) , id : __expectString ( output . id ) , lastUpdatedDate : output . lastUpdatedDate !== undefined && output . lastUpdatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedDate ) ) ) : undefined , name : __expectString ( output . name ) , stageKeys : output . stageKeys !== undefined && output . stageKeys !== null ? deserializeAws_restJson1ListOfString ( output . stageKeys , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , value : __expectString ( output . value ) , } as any ; } ; const deserializeAws_restJson1ApiStage = ( output , context ) : ApiStage => { return { apiId : __expectString ( output . apiId ) , stage : __expectString ( output . stage ) , throttle : output . throttle !== undefined && output . throttle !== null ? deserializeAws_restJson1MapOfApiStageThrottleSettings ( output . throttle , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Authorizer = ( output , context ) : Authorizer => { return { authType : __expectString ( output . authType ) , authorizerCredentials : __expectString ( output . authorizerCredentials ) , authorizerResultTtlInSeconds : __expectInt32 ( output . authorizerResultTtlInSeconds ) , authorizerUri : __expectString ( output . authorizerUri ) , id : __expectString ( output . id ) , identitySource : __expectString ( output . identitySource ) , identityValidationExpression : __expectString ( output . identityValidationExpression ) , name : __expectString ( output . name ) , providerARNs : output . providerARNs !== undefined && output . providerARNs !== null ? deserializeAws_restJson1ListOfARNs ( output . providerARNs , context ) : undefined , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1BasePathMapping = ( output , context ) : BasePathMapping => { return { basePath : __expectString ( output . basePath ) , restApiId : __expectString ( output . restApiId ) , stage : __expectString ( output . stage ) , } as any ; } ; const deserializeAws_restJson1CanarySettings = ( output , context ) : CanarySettings => { return { deploymentId : __expectString ( output . deploymentId ) , percentTraffic : __limitedParseDouble ( output . percentTraffic ) , stageVariableOverrides : output . stageVariableOverrides !== undefined && output . stageVariableOverrides !== null ? deserializeAws_restJson1MapOfStringToString ( output . stageVariableOverrides , context ) : undefined , useStageCache : __expectBoolean ( output . useStageCache ) , } as any ; } ; const deserializeAws_restJson1ClientCertificate = ( output , context ) : ClientCertificate => { return { clientCertificateId : __expectString ( output . clientCertificateId ) , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , description : __expectString ( output . description ) , expirationDate : output . expirationDate !== undefined && output . expirationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . expirationDate ) ) ) : undefined , pemEncodedCertificate : __expectString ( output . pemEncodedCertificate ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Deployment = ( output , context ) : Deployment => { return { apiSummary : output . apiSummary !== undefined && output . apiSummary !== null ? deserializeAws_restJson1PathToMapOfMethodSnapshot ( output . apiSummary , context ) : undefined , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , } as any ; } ; const deserializeAws_restJson1DocumentationPart = ( output , context ) : DocumentationPart => { return { id : __expectString ( output . id ) , location : output . location !== undefined && output . location !== null ? deserializeAws_restJson1DocumentationPartLocation ( output . location , context ) : undefined , properties : __expectString ( output . properties ) , } as any ; } ; const deserializeAws_restJson1DocumentationPartLocation = ( output , context ) : DocumentationPartLocation => { return { method : __expectString ( output . method ) , name : __expectString ( output . name ) , path : __expectString ( output . path ) , statusCode : __expectString ( output . statusCode ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1DocumentationVersion = ( output , context ) : DocumentationVersion => { return { createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , description : __expectString ( output . description ) , version : __expectString ( output . version ) , } as any ; } ; const deserializeAws_restJson1DomainName = ( output , context ) : DomainName => { return { certificateArn : __expectString ( output . certificateArn ) , certificateName : __expectString ( output . certificateName ) , certificateUploadDate : output . certificateUploadDate !== undefined && output . certificateUploadDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . certificateUploadDate ) ) ) : undefined , distributionDomainName : __expectString ( output . distributionDomainName ) , distributionHostedZoneId : __expectString ( output . distributionHostedZoneId ) , domainName : __expectString ( output . domainName ) , domainNameStatus : __expectString ( output . domainNameStatus ) , domainNameStatusMessage : __expectString ( output . domainNameStatusMessage ) , endpointConfiguration : output . endpointConfiguration !== undefined && output . endpointConfiguration !== null ? deserializeAws_restJson1EndpointConfiguration ( output . endpointConfiguration , context ) : undefined , mutualTlsAuthentication : output . mutualTlsAuthentication !== undefined && output . mutualTlsAuthentication !== null ? deserializeAws_restJson1MutualTlsAuthentication ( output . mutualTlsAuthentication , context ) : undefined , ownershipVerificationCertificateArn : __expectString ( output . ownershipVerificationCertificateArn ) , regionalCertificateArn : __expectString ( output . regionalCertificateArn ) , regionalCertificateName : __expectString ( output . regionalCertificateName ) , regionalDomainName : __expectString ( output . regionalDomainName ) , regionalHostedZoneId : __expectString ( output . regionalHostedZoneId ) , securityPolicy : __expectString ( output . securityPolicy ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EndpointConfiguration = ( output , context ) : EndpointConfiguration => { return { types : output . types !== undefined && output . types !== null ? deserializeAws_restJson1ListOfEndpointType ( output . types , context ) : undefined , vpcEndpointIds : output . vpcEndpointIds !== undefined && output . vpcEndpointIds !== null ? deserializeAws_restJson1ListOfString ( output . vpcEndpointIds , context ) : undefined , } as any ; } ; const deserializeAws_restJson1GatewayResponse = ( output , context ) : GatewayResponse => { return { defaultResponse : __expectBoolean ( output . defaultResponse ) , responseParameters : output . responseParameters !== undefined && output . responseParameters !== null ? deserializeAws_restJson1MapOfStringToString ( output . responseParameters , context ) : undefined , responseTemplates : output . responseTemplates !== undefined && output . responseTemplates !== null ? deserializeAws_restJson1MapOfStringToString ( output . responseTemplates , context ) : undefined , responseType : __expectString ( output . responseType ) , statusCode : __expectString ( output . statusCode ) , } as any ; } ; const deserializeAws_restJson1Integration = ( output , context ) : Integration => { return { cacheKeyParameters : output . cacheKeyParameters !== undefined && output . cacheKeyParameters !== null ? deserializeAws_restJson1ListOfString ( output . cacheKeyParameters , context ) : undefined , cacheNamespace : __expectString ( output . cacheNamespace ) , connectionId : __expectString ( output . connectionId ) , connectionType : __expectString ( output . connectionType ) , contentHandling : __expectString ( output . contentHandling ) , credentials : __expectString ( output . credentials ) , httpMethod : __expectString ( output . httpMethod ) , integrationResponses : output . integrationResponses !== undefined && output . integrationResponses !== null ? deserializeAws_restJson1MapOfIntegrationResponse ( output . integrationResponses , context ) : undefined , passthroughBehavior : __expectString ( output . passthroughBehavior ) , requestParameters : output . requestParameters !== undefined && output . requestParameters !== null ? deserializeAws_restJson1MapOfStringToString ( output . requestParameters , context ) : undefined , requestTemplates : output . requestTemplates !== undefined && output . requestTemplates !== null ? deserializeAws_restJson1MapOfStringToString ( output . requestTemplates , context ) : undefined , timeoutInMillis : __expectInt32 ( output . timeoutInMillis ) , tlsConfig : output . tlsConfig !== undefined && output . tlsConfig !== null ? deserializeAws_restJson1TlsConfig ( output . tlsConfig , context ) : undefined , type : __expectString ( output . type ) , uri : __expectString ( output . uri ) , } as any ; } ; const deserializeAws_restJson1IntegrationResponse = ( output , context ) : IntegrationResponse => { return { contentHandling : __expectString ( output . contentHandling ) , responseParameters : output . responseParameters !== undefined && output . responseParameters !== null ? deserializeAws_restJson1MapOfStringToString ( output . responseParameters , context ) : undefined , responseTemplates : output . responseTemplates !== undefined && output . responseTemplates !== null ? deserializeAws_restJson1MapOfStringToString ( output . responseTemplates , context ) : undefined , selectionPattern : __expectString ( output . selectionPattern ) , statusCode : __expectString ( output . statusCode ) , } as any ; } ; const deserializeAws_restJson1ListOfApiKey = ( output , context ) : ApiKey [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ApiKey ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfApiStage = ( output , context ) : ApiStage [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ApiStage ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfARNs = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOfAuthorizer = ( output , context ) : Authorizer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Authorizer ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfBasePathMapping = ( output , context ) : BasePathMapping [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BasePathMapping ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfClientCertificate = ( output , context ) : ClientCertificate [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ClientCertificate ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDeployment = ( output , context ) : Deployment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Deployment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDocumentationPart = ( output , context ) : DocumentationPart [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DocumentationPart ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDocumentationVersion = ( output , context ) : DocumentationVersion [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DocumentationVersion ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDomainName = ( output , context ) : DomainName [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DomainName ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfEndpointType = ( output , context ) : ( EndpointType | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOfGatewayResponse = ( output , context ) : GatewayResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1GatewayResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfLong = ( output , context ) : number [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectLong ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOfModel = ( output , context ) : Model [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Model ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRequestValidator = ( output , context ) : RequestValidator [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RequestValidator ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfResource = ( output , context ) : Resource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Resource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRestApi = ( output , context ) : RestApi [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RestApi ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSdkConfigurationProperty = ( output , context ) : SdkConfigurationProperty [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SdkConfigurationProperty ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSdkType = ( output , context ) : SdkType [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SdkType ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfStage = ( output , context ) : Stage [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Stage ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfString = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOfUsage = ( output , context ) : number [ ] [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListOfLong ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfUsagePlan = ( output , context ) : UsagePlan [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UsagePlan ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfUsagePlanKey = ( output , context ) : UsagePlanKey [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UsagePlanKey ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfVpcLink = ( output , context ) : VpcLink [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1VpcLink ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1MapOfApiStageThrottleSettings = ( output , context ) : { [ key ] : ThrottleSettings ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ThrottleSettings ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfIntegrationResponse = ( output , context ) : { [ key ] : IntegrationResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1IntegrationResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfKeyUsages = ( output , context ) : { [ key ] : number [ ] [ ] ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ListOfUsage ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMethod = ( output , context ) : { [ key ] : Method ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1Method ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMethodResponse = ( output , context ) : { [ key ] : MethodResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MethodResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMethodSettings = ( output , context ) : { [ key ] : MethodSetting ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MethodSetting ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMethodSnapshot = ( output , context ) : { [ key ] : MethodSnapshot ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MethodSnapshot ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfStringToBoolean = ( output , context ) : { [ key ] : boolean ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectBoolean ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfStringToList = ( output , context ) : { [ key ] : string [ ] ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ListOfString ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfStringToString = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1Method = ( output , context ) : Method => { return { apiKeyRequired : __expectBoolean ( output . apiKeyRequired ) , authorizationScopes : output . authorizationScopes !== undefined && output . authorizationScopes !== null ? deserializeAws_restJson1ListOfString ( output . authorizationScopes , context ) : undefined , authorizationType : __expectString ( output . authorizationType ) , authorizerId : __expectString ( output . authorizerId ) , httpMethod : __expectString ( output . httpMethod ) , methodIntegration : output . methodIntegration !== undefined && output . methodIntegration !== null ? deserializeAws_restJson1Integration ( output . methodIntegration , context ) : undefined , methodResponses : output . methodResponses !== undefined && output . methodResponses !== null ? deserializeAws_restJson1MapOfMethodResponse ( output . methodResponses , context ) : undefined , operationName : __expectString ( output . operationName ) , requestModels : output . requestModels !== undefined && output . requestModels !== null ? deserializeAws_restJson1MapOfStringToString ( output . requestModels , context ) : undefined , requestParameters : output . requestParameters !== undefined && output . requestParameters !== null ? deserializeAws_restJson1MapOfStringToBoolean ( output . requestParameters , context ) : undefined , requestValidatorId : __expectString ( output . requestValidatorId ) , } as any ; } ; const deserializeAws_restJson1MethodResponse = ( output , context ) : MethodResponse => { return { responseModels : output . responseModels !== undefined && output . responseModels !== null ? deserializeAws_restJson1MapOfStringToString ( output . responseModels , context ) : undefined , responseParameters : output . responseParameters !== undefined && output . responseParameters !== null ? deserializeAws_restJson1MapOfStringToBoolean ( output . responseParameters , context ) : undefined , statusCode : __expectString ( output . statusCode ) , } as any ; } ; const deserializeAws_restJson1MethodSetting = ( output , context ) : MethodSetting => { return { cacheDataEncrypted : __expectBoolean ( output . cacheDataEncrypted ) , cacheTtlInSeconds : __expectInt32 ( output . cacheTtlInSeconds ) , cachingEnabled : __expectBoolean ( output . cachingEnabled ) , dataTraceEnabled : __expectBoolean ( output . dataTraceEnabled ) , loggingLevel : __expectString ( output . loggingLevel ) , metricsEnabled : __expectBoolean ( output . metricsEnabled ) , requireAuthorizationForCacheControl : __expectBoolean ( output . requireAuthorizationForCacheControl ) , throttlingBurstLimit : __expectInt32 ( output . throttlingBurstLimit ) , throttlingRateLimit : __limitedParseDouble ( output . throttlingRateLimit ) , unauthorizedCacheControlHeaderStrategy : __expectString ( output . unauthorizedCacheControlHeaderStrategy ) , } as any ; } ; const deserializeAws_restJson1MethodSnapshot = ( output , context ) : MethodSnapshot => { return { apiKeyRequired : __expectBoolean ( output . apiKeyRequired ) , authorizationType : __expectString ( output . authorizationType ) , } as any ; } ; const deserializeAws_restJson1Model = ( output , context ) : Model => { return { contentType : __expectString ( output . contentType ) , description : __expectString ( output . description ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , schema : __expectString ( output . schema ) , } as any ; } ; const deserializeAws_restJson1MutualTlsAuthentication = ( output , context ) : MutualTlsAuthentication => { return { truststoreUri : __expectString ( output . truststoreUri ) , truststoreVersion : __expectString ( output . truststoreVersion ) , truststoreWarnings : output . truststoreWarnings !== undefined && output . truststoreWarnings !== null ? deserializeAws_restJson1ListOfString ( output . truststoreWarnings , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PathToMapOfMethodSnapshot = ( output , context ) : { [ key ] : { [ key ] : MethodSnapshot ; } ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MapOfMethodSnapshot ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1QuotaSettings = ( output , context ) : QuotaSettings => { return { limit : __expectInt32 ( output . limit ) , offset : __expectInt32 ( output . offset ) , period : __expectString ( output . period ) , } as any ; } ; const deserializeAws_restJson1RequestValidator = ( output , context ) : RequestValidator => { return { id : __expectString ( output . id ) , name : __expectString ( output . name ) , validateRequestBody : __expectBoolean ( output . validateRequestBody ) , validateRequestParameters : __expectBoolean ( output . validateRequestParameters ) , } as any ; } ; const deserializeAws_restJson1Resource = ( output , context ) : Resource => { return { id : __expectString ( output . id ) , parentId : __expectString ( output . parentId ) , path : __expectString ( output . path ) , pathPart : __expectString ( output . pathPart ) , resourceMethods : output . resourceMethods !== undefined && output . resourceMethods !== null ? deserializeAws_restJson1MapOfMethod ( output . resourceMethods , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RestApi = ( output , context ) : RestApi => { return { apiKeySource : __expectString ( output . apiKeySource ) , binaryMediaTypes : output . binaryMediaTypes !== undefined && output . binaryMediaTypes !== null ? deserializeAws_restJson1ListOfString ( output . binaryMediaTypes , context ) : undefined , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , description : __expectString ( output . description ) , disableExecuteApiEndpoint : __expectBoolean ( output . disableExecuteApiEndpoint ) , endpointConfiguration : output . endpointConfiguration !== undefined && output . endpointConfiguration !== null ? deserializeAws_restJson1EndpointConfiguration ( output . endpointConfiguration , context ) : undefined , id : __expectString ( output . id ) , minimumCompressionSize : __expectInt32 ( output . minimumCompressionSize ) , name : __expectString ( output . name ) , policy : __expectString ( output . policy ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , version : __expectString ( output . version ) , warnings : output . warnings !== undefined && output . warnings !== null ? deserializeAws_restJson1ListOfString ( output . warnings , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SdkConfigurationProperty = ( output , context ) : SdkConfigurationProperty => { return { defaultValue : __expectString ( output . defaultValue ) , description : __expectString ( output . description ) , friendlyName : __expectString ( output . friendlyName ) , name : __expectString ( output . name ) , required : __expectBoolean ( output . required ) , } as any ; } ; const deserializeAws_restJson1SdkType = ( output , context ) : SdkType => { return { configurationProperties : output . configurationProperties !== undefined && output . configurationProperties !== null ? deserializeAws_restJson1ListOfSdkConfigurationProperty ( output . configurationProperties , context ) : undefined , description : __expectString ( output . description ) , friendlyName : __expectString ( output . friendlyName ) , id : __expectString ( output . id ) , } as any ; } ; const deserializeAws_restJson1Stage = ( output , context ) : Stage => { return { accessLogSettings : output . accessLogSettings !== undefined && output . accessLogSettings !== null ? deserializeAws_restJson1AccessLogSettings ( output . accessLogSettings , context ) : undefined , cacheClusterEnabled : __expectBoolean ( output . cacheClusterEnabled ) , cacheClusterSize : __expectString ( output . cacheClusterSize ) , cacheClusterStatus : __expectString ( output . cacheClusterStatus ) , canarySettings : output . canarySettings !== undefined && output . canarySettings !== null ? deserializeAws_restJson1CanarySettings ( output . canarySettings , context ) : undefined , clientCertificateId : __expectString ( output . clientCertificateId ) , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , deploymentId : __expectString ( output . deploymentId ) , description : __expectString ( output . description ) , documentationVersion : __expectString ( output . documentationVersion ) , lastUpdatedDate : output . lastUpdatedDate !== undefined && output . lastUpdatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedDate ) ) ) : undefined , methodSettings : output . methodSettings !== undefined && output . methodSettings !== null ? deserializeAws_restJson1MapOfMethodSettings ( output . methodSettings , context ) : undefined , stageName : __expectString ( output . stageName ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , tracingEnabled : __expectBoolean ( output . tracingEnabled ) , variables : output . variables !== undefined && output . variables !== null ? deserializeAws_restJson1MapOfStringToString ( output . variables , context ) : undefined , webAclArn : __expectString ( output . webAclArn ) , } as any ; } ; const deserializeAws_restJson1ThrottleSettings = ( output , context ) : ThrottleSettings => { return { burstLimit : __expectInt32 ( output . burstLimit ) , rateLimit : __limitedParseDouble ( output . rateLimit ) , } as any ; } ; const deserializeAws_restJson1TlsConfig = ( output , context ) : TlsConfig => { return { insecureSkipVerification : __expectBoolean ( output . insecureSkipVerification ) , } as any ; } ; const deserializeAws_restJson1UsagePlan = ( output , context ) : UsagePlan => { return { apiStages : output . apiStages !== undefined && output . apiStages !== null ? deserializeAws_restJson1ListOfApiStage ( output . apiStages , context ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , productCode : __expectString ( output . productCode ) , quota : output . quota !== undefined && output . quota !== null ? deserializeAws_restJson1QuotaSettings ( output . quota , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , throttle : output . throttle !== undefined && output . throttle !== null ? deserializeAws_restJson1ThrottleSettings ( output . throttle , context ) : undefined , } as any ; } ; const deserializeAws_restJson1UsagePlanKey = ( output , context ) : UsagePlanKey => { return { id : __expectString ( output . id ) , name : __expectString ( output . name ) , type : __expectString ( output . type ) , value : __expectString ( output . value ) , } as any ; } ; const deserializeAws_restJson1VpcLink = ( output , context ) : VpcLink => { return { description : __expectString ( output . description ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , status : __expectString ( output . status ) , statusMessage : __expectString ( output . statusMessage ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOfStringToString ( output . tags , context ) : undefined , targetArns : output . targetArns !== undefined && output . targetArns !== null ? deserializeAws_restJson1ListOfString ( output . targetArns , context ) : undefined , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;