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 , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AssociateApiCommandInput , AssociateApiCommandOutput } from "../commands/AssociateApiCommand" ; import { CreateApiCacheCommandInput , CreateApiCacheCommandOutput } from "../commands/CreateApiCacheCommand" ; import { CreateApiKeyCommandInput , CreateApiKeyCommandOutput } from "../commands/CreateApiKeyCommand" ; import { CreateDataSourceCommandInput , CreateDataSourceCommandOutput } from "../commands/CreateDataSourceCommand" ; import { CreateDomainNameCommandInput , CreateDomainNameCommandOutput } from "../commands/CreateDomainNameCommand" ; import { CreateFunctionCommandInput , CreateFunctionCommandOutput } from "../commands/CreateFunctionCommand" ; import { CreateGraphqlApiCommandInput , CreateGraphqlApiCommandOutput } from "../commands/CreateGraphqlApiCommand" ; import { CreateResolverCommandInput , CreateResolverCommandOutput } from "../commands/CreateResolverCommand" ; import { CreateTypeCommandInput , CreateTypeCommandOutput } from "../commands/CreateTypeCommand" ; import { DeleteApiCacheCommandInput , DeleteApiCacheCommandOutput } from "../commands/DeleteApiCacheCommand" ; import { DeleteApiKeyCommandInput , DeleteApiKeyCommandOutput } from "../commands/DeleteApiKeyCommand" ; import { DeleteDataSourceCommandInput , DeleteDataSourceCommandOutput } from "../commands/DeleteDataSourceCommand" ; import { DeleteDomainNameCommandInput , DeleteDomainNameCommandOutput } from "../commands/DeleteDomainNameCommand" ; import { DeleteFunctionCommandInput , DeleteFunctionCommandOutput } from "../commands/DeleteFunctionCommand" ; import { DeleteGraphqlApiCommandInput , DeleteGraphqlApiCommandOutput } from "../commands/DeleteGraphqlApiCommand" ; import { DeleteResolverCommandInput , DeleteResolverCommandOutput } from "../commands/DeleteResolverCommand" ; import { DeleteTypeCommandInput , DeleteTypeCommandOutput } from "../commands/DeleteTypeCommand" ; import { DisassociateApiCommandInput , DisassociateApiCommandOutput } from "../commands/DisassociateApiCommand" ; import { FlushApiCacheCommandInput , FlushApiCacheCommandOutput } from "../commands/FlushApiCacheCommand" ; import { GetApiAssociationCommandInput , GetApiAssociationCommandOutput } from "../commands/GetApiAssociationCommand" ; import { GetApiCacheCommandInput , GetApiCacheCommandOutput } from "../commands/GetApiCacheCommand" ; import { GetDataSourceCommandInput , GetDataSourceCommandOutput } from "../commands/GetDataSourceCommand" ; import { GetDomainNameCommandInput , GetDomainNameCommandOutput } from "../commands/GetDomainNameCommand" ; import { GetFunctionCommandInput , GetFunctionCommandOutput } from "../commands/GetFunctionCommand" ; import { GetGraphqlApiCommandInput , GetGraphqlApiCommandOutput } from "../commands/GetGraphqlApiCommand" ; import { GetIntrospectionSchemaCommandInput , GetIntrospectionSchemaCommandOutput , } from "../commands/GetIntrospectionSchemaCommand" ; import { GetResolverCommandInput , GetResolverCommandOutput } from "../commands/GetResolverCommand" ; import { GetSchemaCreationStatusCommandInput , GetSchemaCreationStatusCommandOutput , } from "../commands/GetSchemaCreationStatusCommand" ; import { GetTypeCommandInput , GetTypeCommandOutput } from "../commands/GetTypeCommand" ; import { ListApiKeysCommandInput , ListApiKeysCommandOutput } from "../commands/ListApiKeysCommand" ; import { ListDataSourcesCommandInput , ListDataSourcesCommandOutput } from "../commands/ListDataSourcesCommand" ; import { ListDomainNamesCommandInput , ListDomainNamesCommandOutput } from "../commands/ListDomainNamesCommand" ; import { ListFunctionsCommandInput , ListFunctionsCommandOutput } from "../commands/ListFunctionsCommand" ; import { ListGraphqlApisCommandInput , ListGraphqlApisCommandOutput } from "../commands/ListGraphqlApisCommand" ; import { ListResolversByFunctionCommandInput , ListResolversByFunctionCommandOutput , } from "../commands/ListResolversByFunctionCommand" ; import { ListResolversCommandInput , ListResolversCommandOutput } from "../commands/ListResolversCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListTypesCommandInput , ListTypesCommandOutput } from "../commands/ListTypesCommand" ; import { StartSchemaCreationCommandInput , StartSchemaCreationCommandOutput , } from "../commands/StartSchemaCreationCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateApiCacheCommandInput , UpdateApiCacheCommandOutput } from "../commands/UpdateApiCacheCommand" ; import { UpdateApiKeyCommandInput , UpdateApiKeyCommandOutput } from "../commands/UpdateApiKeyCommand" ; import { UpdateDataSourceCommandInput , UpdateDataSourceCommandOutput } from "../commands/UpdateDataSourceCommand" ; import { UpdateDomainNameCommandInput , UpdateDomainNameCommandOutput } from "../commands/UpdateDomainNameCommand" ; import { UpdateFunctionCommandInput , UpdateFunctionCommandOutput } from "../commands/UpdateFunctionCommand" ; import { UpdateGraphqlApiCommandInput , UpdateGraphqlApiCommandOutput } from "../commands/UpdateGraphqlApiCommand" ; import { UpdateResolverCommandInput , UpdateResolverCommandOutput } from "../commands/UpdateResolverCommand" ; import { UpdateTypeCommandInput , UpdateTypeCommandOutput } from "../commands/UpdateTypeCommand" ; import { AccessDeniedException , AdditionalAuthenticationProvider , ApiAssociation , ApiCache , ApiKey , ApiKeyLimitExceededException , ApiKeyValidityOutOfBoundsException , ApiLimitExceededException , AuthorizationConfig , AwsIamConfig , BadRequestException , CachingConfig , CognitoUserPoolConfig , ConcurrentModificationException , DataSource , DeltaSyncConfig , DomainNameConfig , DynamodbDataSourceConfig , ElasticsearchDataSourceConfig , FunctionConfiguration , GraphqlApi , GraphQLSchemaException , HttpDataSourceConfig , InternalFailureException , LambdaAuthorizerConfig , LambdaConflictHandlerConfig , LambdaDataSourceConfig , LimitExceededException , LogConfig , NotFoundException , OpenIDConnectConfig , OpenSearchServiceDataSourceConfig , PipelineConfig , RdsHttpEndpointConfig , RelationalDatabaseDataSourceConfig , Resolver , SyncConfig , Type , UnauthorizedException , UserPoolConfig , } from "../models/models_0" ; export const serializeAws_restJson1AssociateApiCommand = 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}/apiassociation" ; 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 . apiId !== undefined && input . apiId !== null && { apiId : input . apiId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateApiCacheCommand = 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 || "" }` + "/v1/apis/{apiId}/ApiCaches" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . apiCachingBehavior !== undefined && input . apiCachingBehavior !== null && { apiCachingBehavior : input . apiCachingBehavior } ) , ... ( input . atRestEncryptionEnabled !== undefined && input . atRestEncryptionEnabled !== null && { atRestEncryptionEnabled : input . atRestEncryptionEnabled } ) , ... ( input . transitEncryptionEnabled !== undefined && input . transitEncryptionEnabled !== null && { transitEncryptionEnabled : input . transitEncryptionEnabled } ) , ... ( input . ttl !== undefined && input . ttl !== null && { ttl : input . ttl } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; 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" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/apis/{apiId}/apikeys" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . expires !== undefined && input . expires !== null && { expires : input . expires } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDataSourceCommand = 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 || "" }` + "/v1/apis/{apiId}/datasources" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . dynamodbConfig !== undefined && input . dynamodbConfig !== null && { dynamodbConfig : serializeAws_restJson1DynamodbDataSourceConfig ( input . dynamodbConfig , context ) , } ) , ... ( input . elasticsearchConfig !== undefined && input . elasticsearchConfig !== null && { elasticsearchConfig : serializeAws_restJson1ElasticsearchDataSourceConfig ( input . elasticsearchConfig , context ) , } ) , ... ( input . httpConfig !== undefined && input . httpConfig !== null && { httpConfig : serializeAws_restJson1HttpDataSourceConfig ( input . httpConfig , context ) , } ) , ... ( input . lambdaConfig !== undefined && input . lambdaConfig !== null && { lambdaConfig : serializeAws_restJson1LambdaDataSourceConfig ( input . lambdaConfig , context ) , } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . openSearchServiceConfig !== undefined && input . openSearchServiceConfig !== null && { openSearchServiceConfig : serializeAws_restJson1OpenSearchServiceDataSourceConfig ( input . openSearchServiceConfig , context ) , } ) , ... ( input . relationalDatabaseConfig !== undefined && input . relationalDatabaseConfig !== null && { relationalDatabaseConfig : serializeAws_restJson1RelationalDatabaseDataSourceConfig ( input . relationalDatabaseConfig , context ) , } ) , ... ( input . serviceRoleArn !== undefined && input . serviceRoleArn !== null && { serviceRoleArn : input . serviceRoleArn } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ) ; 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 . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . domainName !== undefined && input . domainName !== null && { domainName : input . domainName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateFunctionCommand = 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 || "" }` + "/v1/apis/{apiId}/functions" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . dataSourceName !== undefined && input . dataSourceName !== null && { dataSourceName : input . dataSourceName } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . functionVersion !== undefined && input . functionVersion !== null && { functionVersion : input . functionVersion } ) , ... ( input . maxBatchSize !== undefined && input . maxBatchSize !== null && { maxBatchSize : input . maxBatchSize } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . requestMappingTemplate !== undefined && input . requestMappingTemplate !== null && { requestMappingTemplate : input . requestMappingTemplate } ) , ... ( input . responseMappingTemplate !== undefined && input . responseMappingTemplate !== null && { responseMappingTemplate : input . responseMappingTemplate } ) , ... ( input . syncConfig !== undefined && input . syncConfig !== null && { syncConfig : serializeAws_restJson1SyncConfig ( input . syncConfig , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateGraphqlApiCommand = 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 || "" }` + "/v1/apis" ; let body ; body = JSON . stringify ( { ... ( input . additionalAuthenticationProviders !== undefined && input . additionalAuthenticationProviders !== null && { additionalAuthenticationProviders : serializeAws_restJson1AdditionalAuthenticationProviders ( input . additionalAuthenticationProviders , context ) , } ) , ... ( input . authenticationType !== undefined && input . authenticationType !== null && { authenticationType : input . authenticationType } ) , ... ( input . lambdaAuthorizerConfig !== undefined && input . lambdaAuthorizerConfig !== null && { lambdaAuthorizerConfig : serializeAws_restJson1LambdaAuthorizerConfig ( input . lambdaAuthorizerConfig , context ) , } ) , ... ( input . logConfig !== undefined && input . logConfig !== null && { logConfig : serializeAws_restJson1LogConfig ( input . logConfig , context ) } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . openIDConnectConfig !== undefined && input . openIDConnectConfig !== null && { openIDConnectConfig : serializeAws_restJson1OpenIDConnectConfig ( input . openIDConnectConfig , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , ... ( input . userPoolConfig !== undefined && input . userPoolConfig !== null && { userPoolConfig : serializeAws_restJson1UserPoolConfig ( input . userPoolConfig , context ) , } ) , ... ( input . xrayEnabled !== undefined && input . xrayEnabled !== null && { xrayEnabled : input . xrayEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateResolverCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}/resolvers" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } let body ; body = JSON . stringify ( { ... ( input . cachingConfig !== undefined && input . cachingConfig !== null && { cachingConfig : serializeAws_restJson1CachingConfig ( input . cachingConfig , context ) , } ) , ... ( input . dataSourceName !== undefined && input . dataSourceName !== null && { dataSourceName : input . dataSourceName } ) , ... ( input . fieldName !== undefined && input . fieldName !== null && { fieldName : input . fieldName } ) , ... ( input . kind !== undefined && input . kind !== null && { kind : input . kind } ) , ... ( input . maxBatchSize !== undefined && input . maxBatchSize !== null && { maxBatchSize : input . maxBatchSize } ) , ... ( input . pipelineConfig !== undefined && input . pipelineConfig !== null && { pipelineConfig : serializeAws_restJson1PipelineConfig ( input . pipelineConfig , context ) , } ) , ... ( input . requestMappingTemplate !== undefined && input . requestMappingTemplate !== null && { requestMappingTemplate : input . requestMappingTemplate } ) , ... ( input . responseMappingTemplate !== undefined && input . responseMappingTemplate !== null && { responseMappingTemplate : input . responseMappingTemplate } ) , ... ( input . syncConfig !== undefined && input . syncConfig !== null && { syncConfig : serializeAws_restJson1SyncConfig ( input . syncConfig , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateTypeCommand = 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 || "" }` + "/v1/apis/{apiId}/types" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . definition !== undefined && input . definition !== null && { definition : input . definition } ) , ... ( input . format !== undefined && input . format !== null && { format : input . format } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApiCacheCommand = 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 || "" }` + "/v1/apis/{apiId}/ApiCaches" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , 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 || "" }` + "/v1/apis/{apiId}/apikeys/{id}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } 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 : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDataSourceCommand = 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 || "" }` + "/v1/apis/{apiId}/datasources/{name}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . name !== undefined ) { const labelValue = input . name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: name." ) ; } resolvedPath = resolvedPath . replace ( "{name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: name." ) ; } 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_restJson1DeleteFunctionCommand = 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 || "" }` + "/v1/apis/{apiId}/functions/{functionId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . functionId !== undefined ) { const labelValue = input . functionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: functionId." ) ; } resolvedPath = resolvedPath . replace ( "{functionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: functionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteGraphqlApiCommand = 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 || "" }` + "/v1/apis/{apiId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteResolverCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } if ( input . fieldName !== undefined ) { const labelValue = input . fieldName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: fieldName." ) ; } resolvedPath = resolvedPath . replace ( "{fieldName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: fieldName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteTypeCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateApiCommand = 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}/apiassociation" ; 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_restJson1FlushApiCacheCommand = 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 || "" }` + "/v1/apis/{apiId}/FlushCache" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApiAssociationCommand = 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}/apiassociation" ; 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_restJson1GetApiCacheCommand = 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 || "" }` + "/v1/apis/{apiId}/ApiCaches" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDataSourceCommand = 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 || "" }` + "/v1/apis/{apiId}/datasources/{name}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . name !== undefined ) { const labelValue = input . name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: name." ) ; } resolvedPath = resolvedPath . replace ( "{name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: name." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , 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_restJson1GetFunctionCommand = 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 || "" }` + "/v1/apis/{apiId}/functions/{functionId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . functionId !== undefined ) { const labelValue = input . functionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: functionId." ) ; } resolvedPath = resolvedPath . replace ( "{functionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: functionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetGraphqlApiCommand = 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 || "" }` + "/v1/apis/{apiId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetIntrospectionSchemaCommand = 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 || "" }` + "/v1/apis/{apiId}/schema" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } const query = { ... ( input . format !== undefined && { format : input . format } ) , ... ( input . includeDirectives !== undefined && { includeDirectives : input . includeDirectives . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetResolverCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } if ( input . fieldName !== undefined ) { const labelValue = input . fieldName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: fieldName." ) ; } resolvedPath = resolvedPath . replace ( "{fieldName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: fieldName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSchemaCreationStatusCommand = 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 || "" }` + "/v1/apis/{apiId}/schemacreation" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetTypeCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } const query = { ... ( input . format !== undefined && { format : input . format } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListApiKeysCommand = 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 || "" }` + "/v1/apis/{apiId}/apikeys" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDataSourcesCommand = 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 || "" }` + "/v1/apis/{apiId}/datasources" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDomainNamesCommand = 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 . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListFunctionsCommand = 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 || "" }` + "/v1/apis/{apiId}/functions" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListGraphqlApisCommand = 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 || "" }` + "/v1/apis" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListResolversCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}/resolvers" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListResolversByFunctionCommand = 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 || "" }` + "/v1/apis/{apiId}/functions/{functionId}/resolvers" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . functionId !== undefined ) { const labelValue = input . functionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: functionId." ) ; } resolvedPath = resolvedPath . replace ( "{functionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: functionId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = 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 || "" }` + "/v1/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 ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTypesCommand = 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 || "" }` + "/v1/apis/{apiId}/types" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } const query = { ... ( input . format !== undefined && { format : input . format } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1StartSchemaCreationCommand = 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 || "" }` + "/v1/apis/{apiId}/schemacreation" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . definition !== undefined && input . definition !== null && { definition : context . base64Encoder ( input . definition ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , 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 || "" }` + "/v1/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_restJson1TagMap ( input . tags , 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 || "" }` + "/v1/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_restJson1UpdateApiCacheCommand = 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 || "" }` + "/v1/apis/{apiId}/ApiCaches/update" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . apiCachingBehavior !== undefined && input . apiCachingBehavior !== null && { apiCachingBehavior : input . apiCachingBehavior } ) , ... ( input . ttl !== undefined && input . ttl !== null && { ttl : input . ttl } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , 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 || "" }` + "/v1/apis/{apiId}/apikeys/{id}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } 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 ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . expires !== undefined && input . expires !== null && { expires : input . expires } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDataSourceCommand = 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 || "" }` + "/v1/apis/{apiId}/datasources/{name}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . name !== undefined ) { const labelValue = input . name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: name." ) ; } resolvedPath = resolvedPath . replace ( "{name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: name." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . dynamodbConfig !== undefined && input . dynamodbConfig !== null && { dynamodbConfig : serializeAws_restJson1DynamodbDataSourceConfig ( input . dynamodbConfig , context ) , } ) , ... ( input . elasticsearchConfig !== undefined && input . elasticsearchConfig !== null && { elasticsearchConfig : serializeAws_restJson1ElasticsearchDataSourceConfig ( input . elasticsearchConfig , context ) , } ) , ... ( input . httpConfig !== undefined && input . httpConfig !== null && { httpConfig : serializeAws_restJson1HttpDataSourceConfig ( input . httpConfig , context ) , } ) , ... ( input . lambdaConfig !== undefined && input . lambdaConfig !== null && { lambdaConfig : serializeAws_restJson1LambdaDataSourceConfig ( input . lambdaConfig , context ) , } ) , ... ( input . openSearchServiceConfig !== undefined && input . openSearchServiceConfig !== null && { openSearchServiceConfig : serializeAws_restJson1OpenSearchServiceDataSourceConfig ( input . openSearchServiceConfig , context ) , } ) , ... ( input . relationalDatabaseConfig !== undefined && input . relationalDatabaseConfig !== null && { relationalDatabaseConfig : serializeAws_restJson1RelationalDatabaseDataSourceConfig ( input . relationalDatabaseConfig , context ) , } ) , ... ( input . serviceRoleArn !== undefined && input . serviceRoleArn !== null && { serviceRoleArn : input . serviceRoleArn } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , 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 . description !== undefined && input . description !== null && { description : input . description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateFunctionCommand = 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 || "" }` + "/v1/apis/{apiId}/functions/{functionId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . functionId !== undefined ) { const labelValue = input . functionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: functionId." ) ; } resolvedPath = resolvedPath . replace ( "{functionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: functionId." ) ; } let body ; body = JSON . stringify ( { ... ( input . dataSourceName !== undefined && input . dataSourceName !== null && { dataSourceName : input . dataSourceName } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . functionVersion !== undefined && input . functionVersion !== null && { functionVersion : input . functionVersion } ) , ... ( input . maxBatchSize !== undefined && input . maxBatchSize !== null && { maxBatchSize : input . maxBatchSize } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . requestMappingTemplate !== undefined && input . requestMappingTemplate !== null && { requestMappingTemplate : input . requestMappingTemplate } ) , ... ( input . responseMappingTemplate !== undefined && input . responseMappingTemplate !== null && { responseMappingTemplate : input . responseMappingTemplate } ) , ... ( input . syncConfig !== undefined && input . syncConfig !== null && { syncConfig : serializeAws_restJson1SyncConfig ( input . syncConfig , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateGraphqlApiCommand = 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 || "" }` + "/v1/apis/{apiId}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } let body ; body = JSON . stringify ( { ... ( input . additionalAuthenticationProviders !== undefined && input . additionalAuthenticationProviders !== null && { additionalAuthenticationProviders : serializeAws_restJson1AdditionalAuthenticationProviders ( input . additionalAuthenticationProviders , context ) , } ) , ... ( input . authenticationType !== undefined && input . authenticationType !== null && { authenticationType : input . authenticationType } ) , ... ( input . lambdaAuthorizerConfig !== undefined && input . lambdaAuthorizerConfig !== null && { lambdaAuthorizerConfig : serializeAws_restJson1LambdaAuthorizerConfig ( input . lambdaAuthorizerConfig , context ) , } ) , ... ( input . logConfig !== undefined && input . logConfig !== null && { logConfig : serializeAws_restJson1LogConfig ( input . logConfig , context ) } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . openIDConnectConfig !== undefined && input . openIDConnectConfig !== null && { openIDConnectConfig : serializeAws_restJson1OpenIDConnectConfig ( input . openIDConnectConfig , context ) , } ) , ... ( input . userPoolConfig !== undefined && input . userPoolConfig !== null && { userPoolConfig : serializeAws_restJson1UserPoolConfig ( input . userPoolConfig , context ) , } ) , ... ( input . xrayEnabled !== undefined && input . xrayEnabled !== null && { xrayEnabled : input . xrayEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateResolverCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } if ( input . fieldName !== undefined ) { const labelValue = input . fieldName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: fieldName." ) ; } resolvedPath = resolvedPath . replace ( "{fieldName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: fieldName." ) ; } let body ; body = JSON . stringify ( { ... ( input . cachingConfig !== undefined && input . cachingConfig !== null && { cachingConfig : serializeAws_restJson1CachingConfig ( input . cachingConfig , context ) , } ) , ... ( input . dataSourceName !== undefined && input . dataSourceName !== null && { dataSourceName : input . dataSourceName } ) , ... ( input . kind !== undefined && input . kind !== null && { kind : input . kind } ) , ... ( input . maxBatchSize !== undefined && input . maxBatchSize !== null && { maxBatchSize : input . maxBatchSize } ) , ... ( input . pipelineConfig !== undefined && input . pipelineConfig !== null && { pipelineConfig : serializeAws_restJson1PipelineConfig ( input . pipelineConfig , context ) , } ) , ... ( input . requestMappingTemplate !== undefined && input . requestMappingTemplate !== null && { requestMappingTemplate : input . requestMappingTemplate } ) , ... ( input . responseMappingTemplate !== undefined && input . responseMappingTemplate !== null && { responseMappingTemplate : input . responseMappingTemplate } ) , ... ( input . syncConfig !== undefined && input . syncConfig !== null && { syncConfig : serializeAws_restJson1SyncConfig ( input . syncConfig , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateTypeCommand = 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 || "" }` + "/v1/apis/{apiId}/types/{typeName}" ; if ( input . apiId !== undefined ) { const labelValue = input . apiId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: apiId." ) ; } resolvedPath = resolvedPath . replace ( "{apiId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: apiId." ) ; } if ( input . typeName !== undefined ) { const labelValue = input . typeName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: typeName." ) ; } resolvedPath = resolvedPath . replace ( "{typeName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: typeName." ) ; } let body ; body = JSON . stringify ( { ... ( input . definition !== undefined && input . definition !== null && { definition : input . definition } ) , ... ( input . format !== undefined && input . format !== null && { format : input . format } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateApiCommand = async ( output , context ) : Promise < AssociateApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiAssociation !== undefined && data . apiAssociation !== null ) { contents . apiAssociation = deserializeAws_restJson1ApiAssociation ( data . apiAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateApiCommandError = async ( output , context ) : Promise < AssociateApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1CreateApiCacheCommand = async ( output , context ) : Promise < CreateApiCacheCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateApiCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiCache : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiCache !== undefined && data . apiCache !== null ) { contents . apiCache = deserializeAws_restJson1ApiCache ( data . apiCache , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateApiCacheCommandError = async ( output , context ) : Promise < CreateApiCacheCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1CreateApiKeyCommand = async ( output , context ) : Promise < CreateApiKeyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateApiKeyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKey : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKey !== undefined && data . apiKey !== null ) { contents . apiKey = deserializeAws_restJson1ApiKey ( data . apiKey , context ) ; } 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 "ApiKeyLimitExceededException" : case "com.amazonaws.appsync#ApiKeyLimitExceededException" : response = { ... ( await deserializeAws_restJson1ApiKeyLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ApiKeyValidityOutOfBoundsException" : case "com.amazonaws.appsync#ApiKeyValidityOutOfBoundsException" : response = { ... ( await deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1CreateDataSourceCommand = async ( output , context ) : Promise < CreateDataSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDataSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , dataSource : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . dataSource !== undefined && data . dataSource !== null ) { contents . dataSource = deserializeAws_restJson1DataSource ( data . dataSource , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDataSourceCommandError = async ( output , context ) : Promise < CreateDataSourceCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDomainNameCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , domainNameConfig : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . domainNameConfig !== undefined && data . domainNameConfig !== null ) { contents . domainNameConfig = deserializeAws_restJson1DomainNameConfig ( data . domainNameConfig , 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( 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_restJson1CreateFunctionCommand = async ( output , context ) : Promise < CreateFunctionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateFunctionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , functionConfiguration : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . functionConfiguration !== undefined && data . functionConfiguration !== null ) { contents . functionConfiguration = deserializeAws_restJson1FunctionConfiguration ( data . functionConfiguration , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateFunctionCommandError = async ( output , context ) : Promise < CreateFunctionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1CreateGraphqlApiCommand = async ( output , context ) : Promise < CreateGraphqlApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateGraphqlApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , graphqlApi : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . graphqlApi !== undefined && data . graphqlApi !== null ) { contents . graphqlApi = deserializeAws_restJson1GraphqlApi ( data . graphqlApi , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateGraphqlApiCommandError = async ( output , context ) : Promise < CreateGraphqlApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ApiLimitExceededException" : case "com.amazonaws.appsync#ApiLimitExceededException" : response = { ... ( await deserializeAws_restJson1ApiLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1CreateResolverCommand = async ( output , context ) : Promise < CreateResolverCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateResolverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , resolver : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resolver !== undefined && data . resolver !== null ) { contents . resolver = deserializeAws_restJson1Resolver ( data . resolver , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateResolverCommandError = async ( output , context ) : Promise < CreateResolverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1CreateTypeCommand = async ( output , context ) : Promise < CreateTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . type !== undefined && data . type !== null ) { contents . type = deserializeAws_restJson1Type ( data . type , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateTypeCommandError = async ( output , context ) : Promise < CreateTypeCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DeleteApiCacheCommand = async ( output , context ) : Promise < DeleteApiCacheCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApiCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApiCacheCommandError = async ( output , context ) : Promise < DeleteApiCacheCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 !== 200 && 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DeleteDataSourceCommand = async ( output , context ) : Promise < DeleteDataSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDataSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDataSourceCommandError = async ( output , context ) : Promise < DeleteDataSourceCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 !== 200 && 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1DeleteFunctionCommand = async ( output , context ) : Promise < DeleteFunctionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteFunctionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteFunctionCommandError = async ( output , context ) : Promise < DeleteFunctionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DeleteGraphqlApiCommand = async ( output , context ) : Promise < DeleteGraphqlApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteGraphqlApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteGraphqlApiCommandError = async ( output , context ) : Promise < DeleteGraphqlApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DeleteResolverCommand = async ( output , context ) : Promise < DeleteResolverCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteResolverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteResolverCommandError = async ( output , context ) : Promise < DeleteResolverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DeleteTypeCommand = async ( output , context ) : Promise < DeleteTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteTypeCommandError = async ( output , context ) : Promise < DeleteTypeCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1DisassociateApiCommand = async ( output , context ) : Promise < DisassociateApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateApiCommandError = async ( output , context ) : Promise < DisassociateApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1FlushApiCacheCommand = async ( output , context ) : Promise < FlushApiCacheCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1FlushApiCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1FlushApiCacheCommandError = async ( output , context ) : Promise < FlushApiCacheCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetApiAssociationCommand = async ( output , context ) : Promise < GetApiAssociationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApiAssociationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiAssociation !== undefined && data . apiAssociation !== null ) { contents . apiAssociation = deserializeAws_restJson1ApiAssociation ( data . apiAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApiAssociationCommandError = async ( output , context ) : Promise < GetApiAssociationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1GetApiCacheCommand = async ( output , context ) : Promise < GetApiCacheCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApiCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiCache : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiCache !== undefined && data . apiCache !== null ) { contents . apiCache = deserializeAws_restJson1ApiCache ( data . apiCache , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApiCacheCommandError = async ( output , context ) : Promise < GetApiCacheCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetDataSourceCommand = async ( output , context ) : Promise < GetDataSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDataSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , dataSource : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . dataSource !== undefined && data . dataSource !== null ) { contents . dataSource = deserializeAws_restJson1DataSource ( data . dataSource , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDataSourceCommandError = async ( output , context ) : Promise < GetDataSourceCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 ) , domainNameConfig : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . domainNameConfig !== undefined && data . domainNameConfig !== null ) { contents . domainNameConfig = deserializeAws_restJson1DomainNameConfig ( data . domainNameConfig , 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1GetFunctionCommand = async ( output , context ) : Promise < GetFunctionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetFunctionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , functionConfiguration : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . functionConfiguration !== undefined && data . functionConfiguration !== null ) { contents . functionConfiguration = deserializeAws_restJson1FunctionConfiguration ( data . functionConfiguration , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetFunctionCommandError = async ( output , context ) : Promise < GetFunctionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetGraphqlApiCommand = async ( output , context ) : Promise < GetGraphqlApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetGraphqlApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , graphqlApi : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . graphqlApi !== undefined && data . graphqlApi !== null ) { contents . graphqlApi = deserializeAws_restJson1GraphqlApi ( data . graphqlApi , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetGraphqlApiCommandError = async ( output , context ) : Promise < GetGraphqlApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetIntrospectionSchemaCommand = async ( output , context ) : Promise < GetIntrospectionSchemaCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetIntrospectionSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , schema : undefined , } ; const data = await collectBody ( output . body , context ) ; contents . schema = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async ( output , context ) : Promise < GetIntrospectionSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "GraphQLSchemaException" : case "com.amazonaws.appsync#GraphQLSchemaException" : response = { ... ( await deserializeAws_restJson1GraphQLSchemaExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetResolverCommand = async ( output , context ) : Promise < GetResolverCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResolverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , resolver : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resolver !== undefined && data . resolver !== null ) { contents . resolver = deserializeAws_restJson1Resolver ( data . resolver , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResolverCommandError = async ( output , context ) : Promise < GetResolverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetSchemaCreationStatusCommand = async ( output , context ) : Promise < GetSchemaCreationStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSchemaCreationStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , details : undefined , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . details !== undefined && data . details !== null ) { contents . details = __expectString ( data . details ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async ( output , context ) : Promise < GetSchemaCreationStatusCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1GetTypeCommand = async ( output , context ) : Promise < GetTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . type !== undefined && data . type !== null ) { contents . type = deserializeAws_restJson1Type ( data . type , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTypeCommandError = async ( output , context ) : Promise < GetTypeCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListApiKeysCommand = async ( output , context ) : Promise < ListApiKeysCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListApiKeysCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiKeys : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKeys !== undefined && data . apiKeys !== null ) { contents . apiKeys = deserializeAws_restJson1ApiKeys ( data . apiKeys , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListApiKeysCommandError = async ( output , context ) : Promise < ListApiKeysCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListDataSourcesCommand = async ( output , context ) : Promise < ListDataSourcesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDataSourcesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , dataSources : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . dataSources !== undefined && data . dataSources !== null ) { contents . dataSources = deserializeAws_restJson1DataSources ( data . dataSources , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDataSourcesCommandError = async ( output , context ) : Promise < ListDataSourcesCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListDomainNamesCommand = async ( output , context ) : Promise < ListDomainNamesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDomainNamesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , domainNameConfigs : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . domainNameConfigs !== undefined && data . domainNameConfigs !== null ) { contents . domainNameConfigs = deserializeAws_restJson1DomainNameConfigs ( data . domainNameConfigs , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDomainNamesCommandError = async ( output , context ) : Promise < ListDomainNamesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( 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_restJson1ListFunctionsCommand = async ( output , context ) : Promise < ListFunctionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListFunctionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , functions : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . functions !== undefined && data . functions !== null ) { contents . functions = deserializeAws_restJson1Functions ( data . functions , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListFunctionsCommandError = async ( output , context ) : Promise < ListFunctionsCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListGraphqlApisCommand = async ( output , context ) : Promise < ListGraphqlApisCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListGraphqlApisCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , graphqlApis : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . graphqlApis !== undefined && data . graphqlApis !== null ) { contents . graphqlApis = deserializeAws_restJson1GraphqlApis ( data . graphqlApis , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListGraphqlApisCommandError = async ( output , context ) : Promise < ListGraphqlApisCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListResolversCommand = async ( output , context ) : Promise < ListResolversCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListResolversCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , resolvers : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . resolvers !== undefined && data . resolvers !== null ) { contents . resolvers = deserializeAws_restJson1Resolvers ( data . resolvers , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListResolversCommandError = async ( output , context ) : Promise < ListResolversCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListResolversByFunctionCommand = async ( output , context ) : Promise < ListResolversByFunctionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListResolversByFunctionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , resolvers : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . resolvers !== undefined && data . resolvers !== null ) { contents . resolvers = deserializeAws_restJson1Resolvers ( data . resolvers , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListResolversByFunctionCommandError = async ( output , context ) : Promise < ListResolversByFunctionCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( 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_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1ListTypesCommand = async ( output , context ) : Promise < ListTypesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTypesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , types : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . types !== undefined && data . types !== null ) { contents . types = deserializeAws_restJson1TypeList ( data . types , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTypesCommandError = async ( output , context ) : Promise < ListTypesCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1StartSchemaCreationCommand = async ( output , context ) : Promise < StartSchemaCreationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartSchemaCreationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartSchemaCreationCommandError = async ( output , context ) : Promise < StartSchemaCreationCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 !== 200 && 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 !== 200 && 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1UpdateApiCacheCommand = async ( output , context ) : Promise < UpdateApiCacheCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApiCacheCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , apiCache : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiCache !== undefined && data . apiCache !== null ) { contents . apiCache = deserializeAws_restJson1ApiCache ( data . apiCache , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApiCacheCommandError = async ( output , context ) : Promise < UpdateApiCacheCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 ) , apiKey : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . apiKey !== undefined && data . apiKey !== null ) { contents . apiKey = deserializeAws_restJson1ApiKey ( data . apiKey , context ) ; } 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 "ApiKeyValidityOutOfBoundsException" : case "com.amazonaws.appsync#ApiKeyValidityOutOfBoundsException" : response = { ... ( await deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.appsync#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1UpdateDataSourceCommand = async ( output , context ) : Promise < UpdateDataSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDataSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , dataSource : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . dataSource !== undefined && data . dataSource !== null ) { contents . dataSource = deserializeAws_restJson1DataSource ( data . dataSource , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDataSourceCommandError = async ( output , context ) : Promise < UpdateDataSourceCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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 ) , domainNameConfig : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . domainNameConfig !== undefined && data . domainNameConfig !== null ) { contents . domainNameConfig = deserializeAws_restJson1DomainNameConfig ( data . domainNameConfig , 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 "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1UpdateFunctionCommand = async ( output , context ) : Promise < UpdateFunctionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateFunctionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , functionConfiguration : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . functionConfiguration !== undefined && data . functionConfiguration !== null ) { contents . functionConfiguration = deserializeAws_restJson1FunctionConfiguration ( data . functionConfiguration , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateFunctionCommandError = async ( output , context ) : Promise < UpdateFunctionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1UpdateGraphqlApiCommand = async ( output , context ) : Promise < UpdateGraphqlApiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGraphqlApiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , graphqlApi : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . graphqlApi !== undefined && data . graphqlApi !== null ) { contents . graphqlApi = deserializeAws_restJson1GraphqlApi ( data . graphqlApi , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGraphqlApiCommandError = async ( output , context ) : Promise < UpdateGraphqlApiCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.appsync#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1UpdateResolverCommand = async ( output , context ) : Promise < UpdateResolverCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateResolverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , resolver : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resolver !== undefined && data . resolver !== null ) { contents . resolver = deserializeAws_restJson1Resolver ( data . resolver , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateResolverCommandError = async ( output , context ) : Promise < UpdateResolverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1UpdateTypeCommand = async ( output , context ) : Promise < UpdateTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . type !== undefined && data . type !== null ) { contents . type = deserializeAws_restJson1Type ( data . type , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateTypeCommandError = async ( output , context ) : Promise < UpdateTypeCommandOutput > => { 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.appsync#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.appsync#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalFailureException" : case "com.amazonaws.appsync#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.appsync#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.appsync#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_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $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_restJson1ApiKeyLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ApiKeyLimitExceededException > => { const contents = { name : "ApiKeyLimitExceededException" , $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_restJson1ApiKeyValidityOutOfBoundsExceptionResponse = async ( parsedOutput , context ) : Promise < ApiKeyValidityOutOfBoundsException > => { const contents = { name : "ApiKeyValidityOutOfBoundsException" , $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_restJson1ApiLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ApiLimitExceededException > => { const contents = { name : "ApiLimitExceededException" , $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_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_restJson1ConcurrentModificationExceptionResponse = async ( parsedOutput , context ) : Promise < ConcurrentModificationException > => { const contents = { name : "ConcurrentModificationException" , $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_restJson1GraphQLSchemaExceptionResponse = async ( parsedOutput , context ) : Promise < GraphQLSchemaException > => { const contents = { name : "GraphQLSchemaException" , $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_restJson1InternalFailureExceptionResponse = async ( parsedOutput , context ) : Promise < InternalFailureException > => { const contents = { name : "InternalFailureException" , $fault : "server" , $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 , } ; 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_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_restJson1AdditionalAuthenticationProvider = ( input , context ) : any => { return { ... ( input . authenticationType !== undefined && input . authenticationType !== null && { authenticationType : input . authenticationType } ) , ... ( input . lambdaAuthorizerConfig !== undefined && input . lambdaAuthorizerConfig !== null && { lambdaAuthorizerConfig : serializeAws_restJson1LambdaAuthorizerConfig ( input . lambdaAuthorizerConfig , context ) , } ) , ... ( input . openIDConnectConfig !== undefined && input . openIDConnectConfig !== null && { openIDConnectConfig : serializeAws_restJson1OpenIDConnectConfig ( input . openIDConnectConfig , context ) , } ) , ... ( input . userPoolConfig !== undefined && input . userPoolConfig !== null && { userPoolConfig : serializeAws_restJson1CognitoUserPoolConfig ( input . userPoolConfig , context ) , } ) , } ; } ; const serializeAws_restJson1AdditionalAuthenticationProviders = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AdditionalAuthenticationProvider ( entry , context ) ; } ) ; } ; const serializeAws_restJson1AuthorizationConfig = ( input , context ) : any => { return { ... ( input . authorizationType !== undefined && input . authorizationType !== null && { authorizationType : input . authorizationType } ) , ... ( input . awsIamConfig !== undefined && input . awsIamConfig !== null && { awsIamConfig : serializeAws_restJson1AwsIamConfig ( input . awsIamConfig , context ) } ) , } ; } ; const serializeAws_restJson1AwsIamConfig = ( input , context ) : any => { return { ... ( input . signingRegion !== undefined && input . signingRegion !== null && { signingRegion : input . signingRegion } ) , ... ( input . signingServiceName !== undefined && input . signingServiceName !== null && { signingServiceName : input . signingServiceName } ) , } ; } ; const serializeAws_restJson1CachingConfig = ( input , context ) : any => { return { ... ( input . cachingKeys !== undefined && input . cachingKeys !== null && { cachingKeys : serializeAws_restJson1CachingKeys ( input . cachingKeys , context ) } ) , ... ( input . ttl !== undefined && input . ttl !== null && { ttl : input . ttl } ) , } ; } ; const serializeAws_restJson1CachingKeys = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1CognitoUserPoolConfig = ( input , context ) : any => { return { ... ( input . appIdClientRegex !== undefined && input . appIdClientRegex !== null && { appIdClientRegex : input . appIdClientRegex } ) , ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . userPoolId !== undefined && input . userPoolId !== null && { userPoolId : input . userPoolId } ) , } ; } ; const serializeAws_restJson1DeltaSyncConfig = ( input , context ) : any => { return { ... ( input . baseTableTTL !== undefined && input . baseTableTTL !== null && { baseTableTTL : input . baseTableTTL } ) , ... ( input . deltaSyncTableName !== undefined && input . deltaSyncTableName !== null && { deltaSyncTableName : input . deltaSyncTableName } ) , ... ( input . deltaSyncTableTTL !== undefined && input . deltaSyncTableTTL !== null && { deltaSyncTableTTL : input . deltaSyncTableTTL } ) , } ; } ; const serializeAws_restJson1DynamodbDataSourceConfig = ( input , context ) : any => { return { ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . deltaSyncConfig !== undefined && input . deltaSyncConfig !== null && { deltaSyncConfig : serializeAws_restJson1DeltaSyncConfig ( input . deltaSyncConfig , context ) , } ) , ... ( input . tableName !== undefined && input . tableName !== null && { tableName : input . tableName } ) , ... ( input . useCallerCredentials !== undefined && input . useCallerCredentials !== null && { useCallerCredentials : input . useCallerCredentials } ) , ... ( input . versioned !== undefined && input . versioned !== null && { versioned : input . versioned } ) , } ; } ; const serializeAws_restJson1ElasticsearchDataSourceConfig = ( input , context ) : any => { return { ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . endpoint !== undefined && input . endpoint !== null && { endpoint : input . endpoint } ) , } ; } ; const serializeAws_restJson1FunctionsIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1HttpDataSourceConfig = ( input , context ) : any => { return { ... ( input . authorizationConfig !== undefined && input . authorizationConfig !== null && { authorizationConfig : serializeAws_restJson1AuthorizationConfig ( input . authorizationConfig , context ) , } ) , ... ( input . endpoint !== undefined && input . endpoint !== null && { endpoint : input . endpoint } ) , } ; } ; const serializeAws_restJson1LambdaAuthorizerConfig = ( input , context ) : any => { return { ... ( input . authorizerResultTtlInSeconds !== undefined && input . authorizerResultTtlInSeconds !== null && { authorizerResultTtlInSeconds : input . authorizerResultTtlInSeconds , } ) , ... ( input . authorizerUri !== undefined && input . authorizerUri !== null && { authorizerUri : input . authorizerUri } ) , ... ( input . identityValidationExpression !== undefined && input . identityValidationExpression !== null && { identityValidationExpression : input . identityValidationExpression , } ) , } ; } ; const serializeAws_restJson1LambdaConflictHandlerConfig = ( input , context ) : any => { return { ... ( input . lambdaConflictHandlerArn !== undefined && input . lambdaConflictHandlerArn !== null && { lambdaConflictHandlerArn : input . lambdaConflictHandlerArn } ) , } ; } ; const serializeAws_restJson1LambdaDataSourceConfig = ( input , context ) : any => { return { ... ( input . lambdaFunctionArn !== undefined && input . lambdaFunctionArn !== null && { lambdaFunctionArn : input . lambdaFunctionArn } ) , } ; } ; const serializeAws_restJson1LogConfig = ( input , context ) : any => { return { ... ( input . cloudWatchLogsRoleArn !== undefined && input . cloudWatchLogsRoleArn !== null && { cloudWatchLogsRoleArn : input . cloudWatchLogsRoleArn } ) , ... ( input . excludeVerboseContent !== undefined && input . excludeVerboseContent !== null && { excludeVerboseContent : input . excludeVerboseContent } ) , ... ( input . fieldLogLevel !== undefined && input . fieldLogLevel !== null && { fieldLogLevel : input . fieldLogLevel } ) , } ; } ; const serializeAws_restJson1OpenIDConnectConfig = ( input , context ) : any => { return { ... ( input . authTTL !== undefined && input . authTTL !== null && { authTTL : input . authTTL } ) , ... ( input . clientId !== undefined && input . clientId !== null && { clientId : input . clientId } ) , ... ( input . iatTTL !== undefined && input . iatTTL !== null && { iatTTL : input . iatTTL } ) , ... ( input . issuer !== undefined && input . issuer !== null && { issuer : input . issuer } ) , } ; } ; const serializeAws_restJson1OpenSearchServiceDataSourceConfig = ( input , context ) : any => { return { ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . endpoint !== undefined && input . endpoint !== null && { endpoint : input . endpoint } ) , } ; } ; const serializeAws_restJson1PipelineConfig = ( input , context ) : any => { return { ... ( input . functions !== undefined && input . functions !== null && { functions : serializeAws_restJson1FunctionsIds ( input . functions , context ) } ) , } ; } ; const serializeAws_restJson1RdsHttpEndpointConfig = ( input , context ) : any => { return { ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . awsSecretStoreArn !== undefined && input . awsSecretStoreArn !== null && { awsSecretStoreArn : input . awsSecretStoreArn } ) , ... ( input . databaseName !== undefined && input . databaseName !== null && { databaseName : input . databaseName } ) , ... ( input . dbClusterIdentifier !== undefined && input . dbClusterIdentifier !== null && { dbClusterIdentifier : input . dbClusterIdentifier } ) , ... ( input . schema !== undefined && input . schema !== null && { schema : input . schema } ) , } ; } ; const serializeAws_restJson1RelationalDatabaseDataSourceConfig = ( input , context ) : any => { return { ... ( input . rdsHttpEndpointConfig !== undefined && input . rdsHttpEndpointConfig !== null && { rdsHttpEndpointConfig : serializeAws_restJson1RdsHttpEndpointConfig ( input . rdsHttpEndpointConfig , context ) , } ) , ... ( input . relationalDatabaseSourceType !== undefined && input . relationalDatabaseSourceType !== null && { relationalDatabaseSourceType : input . relationalDatabaseSourceType , } ) , } ; } ; const serializeAws_restJson1SyncConfig = ( input , context ) : any => { return { ... ( input . conflictDetection !== undefined && input . conflictDetection !== null && { conflictDetection : input . conflictDetection } ) , ... ( input . conflictHandler !== undefined && input . conflictHandler !== null && { conflictHandler : input . conflictHandler } ) , ... ( input . lambdaConflictHandlerConfig !== undefined && input . lambdaConflictHandlerConfig !== null && { lambdaConflictHandlerConfig : serializeAws_restJson1LambdaConflictHandlerConfig ( input . lambdaConflictHandlerConfig , context ) , } ) , } ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1UserPoolConfig = ( input , context ) : any => { return { ... ( input . appIdClientRegex !== undefined && input . appIdClientRegex !== null && { appIdClientRegex : input . appIdClientRegex } ) , ... ( input . awsRegion !== undefined && input . awsRegion !== null && { awsRegion : input . awsRegion } ) , ... ( input . defaultAction !== undefined && input . defaultAction !== null && { defaultAction : input . defaultAction } ) , ... ( input . userPoolId !== undefined && input . userPoolId !== null && { userPoolId : input . userPoolId } ) , } ; } ; const deserializeAws_restJson1AdditionalAuthenticationProvider = ( output , context ) : AdditionalAuthenticationProvider => { return { authenticationType : __expectString ( output . authenticationType ) , lambdaAuthorizerConfig : output . lambdaAuthorizerConfig !== undefined && output . lambdaAuthorizerConfig !== null ? deserializeAws_restJson1LambdaAuthorizerConfig ( output . lambdaAuthorizerConfig , context ) : undefined , openIDConnectConfig : output . openIDConnectConfig !== undefined && output . openIDConnectConfig !== null ? deserializeAws_restJson1OpenIDConnectConfig ( output . openIDConnectConfig , context ) : undefined , userPoolConfig : output . userPoolConfig !== undefined && output . userPoolConfig !== null ? deserializeAws_restJson1CognitoUserPoolConfig ( output . userPoolConfig , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AdditionalAuthenticationProviders = ( output , context ) : AdditionalAuthenticationProvider [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AdditionalAuthenticationProvider ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ApiAssociation = ( output , context ) : ApiAssociation => { return { apiId : __expectString ( output . apiId ) , associationStatus : __expectString ( output . associationStatus ) , deploymentDetail : __expectString ( output . deploymentDetail ) , domainName : __expectString ( output . domainName ) , } as any ; } ; const deserializeAws_restJson1ApiCache = ( output , context ) : ApiCache => { return { apiCachingBehavior : __expectString ( output . apiCachingBehavior ) , atRestEncryptionEnabled : __expectBoolean ( output . atRestEncryptionEnabled ) , status : __expectString ( output . status ) , transitEncryptionEnabled : __expectBoolean ( output . transitEncryptionEnabled ) , ttl : __expectLong ( output . ttl ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1ApiKey = ( output , context ) : ApiKey => { return { deletes : __expectLong ( output . deletes ) , description : __expectString ( output . description ) , expires : __expectLong ( output . expires ) , id : __expectString ( output . id ) , } as any ; } ; const deserializeAws_restJson1ApiKeys = ( 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_restJson1AuthorizationConfig = ( output , context ) : AuthorizationConfig => { return { authorizationType : __expectString ( output . authorizationType ) , awsIamConfig : output . awsIamConfig !== undefined && output . awsIamConfig !== null ? deserializeAws_restJson1AwsIamConfig ( output . awsIamConfig , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AwsIamConfig = ( output , context ) : AwsIamConfig => { return { signingRegion : __expectString ( output . signingRegion ) , signingServiceName : __expectString ( output . signingServiceName ) , } as any ; } ; const deserializeAws_restJson1CachingConfig = ( output , context ) : CachingConfig => { return { cachingKeys : output . cachingKeys !== undefined && output . cachingKeys !== null ? deserializeAws_restJson1CachingKeys ( output . cachingKeys , context ) : undefined , ttl : __expectLong ( output . ttl ) , } as any ; } ; const deserializeAws_restJson1CachingKeys = ( 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_restJson1CognitoUserPoolConfig = ( output , context ) : CognitoUserPoolConfig => { return { appIdClientRegex : __expectString ( output . appIdClientRegex ) , awsRegion : __expectString ( output . awsRegion ) , userPoolId : __expectString ( output . userPoolId ) , } as any ; } ; const deserializeAws_restJson1DataSource = ( output , context ) : DataSource => { return { dataSourceArn : __expectString ( output . dataSourceArn ) , description : __expectString ( output . description ) , dynamodbConfig : output . dynamodbConfig !== undefined && output . dynamodbConfig !== null ? deserializeAws_restJson1DynamodbDataSourceConfig ( output . dynamodbConfig , context ) : undefined , elasticsearchConfig : output . elasticsearchConfig !== undefined && output . elasticsearchConfig !== null ? deserializeAws_restJson1ElasticsearchDataSourceConfig ( output . elasticsearchConfig , context ) : undefined , httpConfig : output . httpConfig !== undefined && output . httpConfig !== null ? deserializeAws_restJson1HttpDataSourceConfig ( output . httpConfig , context ) : undefined , lambdaConfig : output . lambdaConfig !== undefined && output . lambdaConfig !== null ? deserializeAws_restJson1LambdaDataSourceConfig ( output . lambdaConfig , context ) : undefined , name : __expectString ( output . name ) , openSearchServiceConfig : output . openSearchServiceConfig !== undefined && output . openSearchServiceConfig !== null ? deserializeAws_restJson1OpenSearchServiceDataSourceConfig ( output . openSearchServiceConfig , context ) : undefined , relationalDatabaseConfig : output . relationalDatabaseConfig !== undefined && output . relationalDatabaseConfig !== null ? deserializeAws_restJson1RelationalDatabaseDataSourceConfig ( output . relationalDatabaseConfig , context ) : undefined , serviceRoleArn : __expectString ( output . serviceRoleArn ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1DataSources = ( output , context ) : DataSource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DataSource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DeltaSyncConfig = ( output , context ) : DeltaSyncConfig => { return { baseTableTTL : __expectLong ( output . baseTableTTL ) , deltaSyncTableName : __expectString ( output . deltaSyncTableName ) , deltaSyncTableTTL : __expectLong ( output . deltaSyncTableTTL ) , } as any ; } ; const deserializeAws_restJson1DomainNameConfig = ( output , context ) : DomainNameConfig => { return { appsyncDomainName : __expectString ( output . appsyncDomainName ) , certificateArn : __expectString ( output . certificateArn ) , description : __expectString ( output . description ) , domainName : __expectString ( output . domainName ) , hostedZoneId : __expectString ( output . hostedZoneId ) , } as any ; } ; const deserializeAws_restJson1DomainNameConfigs = ( output , context ) : DomainNameConfig [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DomainNameConfig ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DynamodbDataSourceConfig = ( output , context ) : DynamodbDataSourceConfig => { return { awsRegion : __expectString ( output . awsRegion ) , deltaSyncConfig : output . deltaSyncConfig !== undefined && output . deltaSyncConfig !== null ? deserializeAws_restJson1DeltaSyncConfig ( output . deltaSyncConfig , context ) : undefined , tableName : __expectString ( output . tableName ) , useCallerCredentials : __expectBoolean ( output . useCallerCredentials ) , versioned : __expectBoolean ( output . versioned ) , } as any ; } ; const deserializeAws_restJson1ElasticsearchDataSourceConfig = ( output , context ) : ElasticsearchDataSourceConfig => { return { awsRegion : __expectString ( output . awsRegion ) , endpoint : __expectString ( output . endpoint ) , } as any ; } ; const deserializeAws_restJson1FunctionConfiguration = ( output , context ) : FunctionConfiguration => { return { dataSourceName : __expectString ( output . dataSourceName ) , description : __expectString ( output . description ) , functionArn : __expectString ( output . functionArn ) , functionId : __expectString ( output . functionId ) , functionVersion : __expectString ( output . functionVersion ) , maxBatchSize : __expectInt32 ( output . maxBatchSize ) , name : __expectString ( output . name ) , requestMappingTemplate : __expectString ( output . requestMappingTemplate ) , responseMappingTemplate : __expectString ( output . responseMappingTemplate ) , syncConfig : output . syncConfig !== undefined && output . syncConfig !== null ? deserializeAws_restJson1SyncConfig ( output . syncConfig , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Functions = ( output , context ) : FunctionConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1FunctionConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1FunctionsIds = ( 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_restJson1GraphqlApi = ( output , context ) : GraphqlApi => { return { additionalAuthenticationProviders : output . additionalAuthenticationProviders !== undefined && output . additionalAuthenticationProviders !== null ? deserializeAws_restJson1AdditionalAuthenticationProviders ( output . additionalAuthenticationProviders , context ) : undefined , apiId : __expectString ( output . apiId ) , arn : __expectString ( output . arn ) , authenticationType : __expectString ( output . authenticationType ) , lambdaAuthorizerConfig : output . lambdaAuthorizerConfig !== undefined && output . lambdaAuthorizerConfig !== null ? deserializeAws_restJson1LambdaAuthorizerConfig ( output . lambdaAuthorizerConfig , context ) : undefined , logConfig : output . logConfig !== undefined && output . logConfig !== null ? deserializeAws_restJson1LogConfig ( output . logConfig , context ) : undefined , name : __expectString ( output . name ) , openIDConnectConfig : output . openIDConnectConfig !== undefined && output . openIDConnectConfig !== null ? deserializeAws_restJson1OpenIDConnectConfig ( output . openIDConnectConfig , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , uris : output . uris !== undefined && output . uris !== null ? deserializeAws_restJson1MapOfStringToString ( output . uris , context ) : undefined , userPoolConfig : output . userPoolConfig !== undefined && output . userPoolConfig !== null ? deserializeAws_restJson1UserPoolConfig ( output . userPoolConfig , context ) : undefined , wafWebAclArn : __expectString ( output . wafWebAclArn ) , xrayEnabled : __expectBoolean ( output . xrayEnabled ) , } as any ; } ; const deserializeAws_restJson1GraphqlApis = ( output , context ) : GraphqlApi [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1GraphqlApi ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1HttpDataSourceConfig = ( output , context ) : HttpDataSourceConfig => { return { authorizationConfig : output . authorizationConfig !== undefined && output . authorizationConfig !== null ? deserializeAws_restJson1AuthorizationConfig ( output . authorizationConfig , context ) : undefined , endpoint : __expectString ( output . endpoint ) , } as any ; } ; const deserializeAws_restJson1LambdaAuthorizerConfig = ( output , context ) : LambdaAuthorizerConfig => { return { authorizerResultTtlInSeconds : __expectInt32 ( output . authorizerResultTtlInSeconds ) , authorizerUri : __expectString ( output . authorizerUri ) , identityValidationExpression : __expectString ( output . identityValidationExpression ) , } as any ; } ; const deserializeAws_restJson1LambdaConflictHandlerConfig = ( output , context ) : LambdaConflictHandlerConfig => { return { lambdaConflictHandlerArn : __expectString ( output . lambdaConflictHandlerArn ) , } as any ; } ; const deserializeAws_restJson1LambdaDataSourceConfig = ( output , context ) : LambdaDataSourceConfig => { return { lambdaFunctionArn : __expectString ( output . lambdaFunctionArn ) , } as any ; } ; const deserializeAws_restJson1LogConfig = ( output , context ) : LogConfig => { return { cloudWatchLogsRoleArn : __expectString ( output . cloudWatchLogsRoleArn ) , excludeVerboseContent : __expectBoolean ( output . excludeVerboseContent ) , fieldLogLevel : __expectString ( output . fieldLogLevel ) , } as any ; } ; 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_restJson1OpenIDConnectConfig = ( output , context ) : OpenIDConnectConfig => { return { authTTL : __expectLong ( output . authTTL ) , clientId : __expectString ( output . clientId ) , iatTTL : __expectLong ( output . iatTTL ) , issuer : __expectString ( output . issuer ) , } as any ; } ; const deserializeAws_restJson1OpenSearchServiceDataSourceConfig = ( output , context ) : OpenSearchServiceDataSourceConfig => { return { awsRegion : __expectString ( output . awsRegion ) , endpoint : __expectString ( output . endpoint ) , } as any ; } ; const deserializeAws_restJson1PipelineConfig = ( output , context ) : PipelineConfig => { return { functions : output . functions !== undefined && output . functions !== null ? deserializeAws_restJson1FunctionsIds ( output . functions , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RdsHttpEndpointConfig = ( output , context ) : RdsHttpEndpointConfig => { return { awsRegion : __expectString ( output . awsRegion ) , awsSecretStoreArn : __expectString ( output . awsSecretStoreArn ) , databaseName : __expectString ( output . databaseName ) , dbClusterIdentifier : __expectString ( output . dbClusterIdentifier ) , schema : __expectString ( output . schema ) , } as any ; } ; const deserializeAws_restJson1RelationalDatabaseDataSourceConfig = ( output , context ) : RelationalDatabaseDataSourceConfig => { return { rdsHttpEndpointConfig : output . rdsHttpEndpointConfig !== undefined && output . rdsHttpEndpointConfig !== null ? deserializeAws_restJson1RdsHttpEndpointConfig ( output . rdsHttpEndpointConfig , context ) : undefined , relationalDatabaseSourceType : __expectString ( output . relationalDatabaseSourceType ) , } as any ; } ; const deserializeAws_restJson1Resolver = ( output , context ) : Resolver => { return { cachingConfig : output . cachingConfig !== undefined && output . cachingConfig !== null ? deserializeAws_restJson1CachingConfig ( output . cachingConfig , context ) : undefined , dataSourceName : __expectString ( output . dataSourceName ) , fieldName : __expectString ( output . fieldName ) , kind : __expectString ( output . kind ) , maxBatchSize : __expectInt32 ( output . maxBatchSize ) , pipelineConfig : output . pipelineConfig !== undefined && output . pipelineConfig !== null ? deserializeAws_restJson1PipelineConfig ( output . pipelineConfig , context ) : undefined , requestMappingTemplate : __expectString ( output . requestMappingTemplate ) , resolverArn : __expectString ( output . resolverArn ) , responseMappingTemplate : __expectString ( output . responseMappingTemplate ) , syncConfig : output . syncConfig !== undefined && output . syncConfig !== null ? deserializeAws_restJson1SyncConfig ( output . syncConfig , context ) : undefined , typeName : __expectString ( output . typeName ) , } as any ; } ; const deserializeAws_restJson1Resolvers = ( output , context ) : Resolver [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Resolver ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SyncConfig = ( output , context ) : SyncConfig => { return { conflictDetection : __expectString ( output . conflictDetection ) , conflictHandler : __expectString ( output . conflictHandler ) , lambdaConflictHandlerConfig : output . lambdaConflictHandlerConfig !== undefined && output . lambdaConflictHandlerConfig !== null ? deserializeAws_restJson1LambdaConflictHandlerConfig ( output . lambdaConflictHandlerConfig , context ) : undefined , } as any ; } ; const deserializeAws_restJson1TagMap = ( 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_restJson1Type = ( output , context ) : Type => { return { arn : __expectString ( output . arn ) , definition : __expectString ( output . definition ) , description : __expectString ( output . description ) , format : __expectString ( output . format ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1TypeList = ( output , context ) : Type [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Type ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UserPoolConfig = ( output , context ) : UserPoolConfig => { return { appIdClientRegex : __expectString ( output . appIdClientRegex ) , awsRegion : __expectString ( output . awsRegion ) , defaultAction : __expectString ( output . defaultAction ) , userPoolId : __expectString ( output . userPoolId ) , } 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 "" ; } ;