import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , strictParseInt32 as __strictParseInt32 , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { CreateApplicationCommandInput , CreateApplicationCommandOutput } from "../commands/CreateApplicationCommand" ; import { CreateEnvironmentCommandInput , CreateEnvironmentCommandOutput } from "../commands/CreateEnvironmentCommand" ; import { CreateRouteCommandInput , CreateRouteCommandOutput } from "../commands/CreateRouteCommand" ; import { CreateServiceCommandInput , CreateServiceCommandOutput } from "../commands/CreateServiceCommand" ; import { DeleteApplicationCommandInput , DeleteApplicationCommandOutput } from "../commands/DeleteApplicationCommand" ; import { DeleteEnvironmentCommandInput , DeleteEnvironmentCommandOutput } from "../commands/DeleteEnvironmentCommand" ; import { DeleteResourcePolicyCommandInput , DeleteResourcePolicyCommandOutput , } from "../commands/DeleteResourcePolicyCommand" ; import { DeleteRouteCommandInput , DeleteRouteCommandOutput } from "../commands/DeleteRouteCommand" ; import { DeleteServiceCommandInput , DeleteServiceCommandOutput } from "../commands/DeleteServiceCommand" ; import { GetApplicationCommandInput , GetApplicationCommandOutput } from "../commands/GetApplicationCommand" ; import { GetEnvironmentCommandInput , GetEnvironmentCommandOutput } from "../commands/GetEnvironmentCommand" ; import { GetResourcePolicyCommandInput , GetResourcePolicyCommandOutput } from "../commands/GetResourcePolicyCommand" ; import { GetRouteCommandInput , GetRouteCommandOutput } from "../commands/GetRouteCommand" ; import { GetServiceCommandInput , GetServiceCommandOutput } from "../commands/GetServiceCommand" ; import { ListApplicationsCommandInput , ListApplicationsCommandOutput } from "../commands/ListApplicationsCommand" ; import { ListEnvironmentsCommandInput , ListEnvironmentsCommandOutput } from "../commands/ListEnvironmentsCommand" ; import { ListEnvironmentVpcsCommandInput , ListEnvironmentVpcsCommandOutput , } from "../commands/ListEnvironmentVpcsCommand" ; import { ListRoutesCommandInput , ListRoutesCommandOutput } from "../commands/ListRoutesCommand" ; import { ListServicesCommandInput , ListServicesCommandOutput } from "../commands/ListServicesCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PutResourcePolicyCommandInput , PutResourcePolicyCommandOutput } from "../commands/PutResourcePolicyCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { AccessDeniedException , ApiGatewayProxyConfig , ApiGatewayProxyInput , ApiGatewayProxySummary , ApplicationSummary , ConflictException , EnvironmentSummary , EnvironmentVpc , ErrorResponse , HttpMethod , InternalServerException , InvalidResourcePolicyException , LambdaEndpointConfig , LambdaEndpointInput , LambdaEndpointSummary , ResourceNotFoundException , RouteSummary , ServiceQuotaExceededException , ServiceSummary , ThrottlingException , UriPathRouteInput , UrlEndpointConfig , UrlEndpointInput , UrlEndpointSummary , ValidationException , } from "../models/models_0" ; export const serializeAws_restJson1CreateApplicationCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } let body ; body = JSON . stringify ( { ... ( input . ApiGatewayProxy !== undefined && input . ApiGatewayProxy !== null && { ApiGatewayProxy : serializeAws_restJson1ApiGatewayProxyInput ( input . ApiGatewayProxy , context ) , } ) , ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . ProxyType !== undefined && input . ProxyType !== null && { ProxyType : input . ProxyType } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , ... ( input . VpcId !== undefined && input . VpcId !== null && { VpcId : input . VpcId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEnvironmentCommand = 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 || "" }` + "/environments" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . NetworkFabricType !== undefined && input . NetworkFabricType !== null && { NetworkFabricType : input . NetworkFabricType } ) , ... ( 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_restJson1CreateRouteCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/routes" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . RouteType !== undefined && input . RouteType !== null && { RouteType : input . RouteType } ) , ... ( input . ServiceIdentifier !== undefined && input . ServiceIdentifier !== null && { ServiceIdentifier : input . ServiceIdentifier } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , ... ( input . UriPathRoute !== undefined && input . UriPathRoute !== null && { UriPathRoute : serializeAws_restJson1UriPathRouteInput ( input . UriPathRoute , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateServiceCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/services" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . EndpointType !== undefined && input . EndpointType !== null && { EndpointType : input . EndpointType } ) , ... ( input . LambdaEndpoint !== undefined && input . LambdaEndpoint !== null && { LambdaEndpoint : serializeAws_restJson1LambdaEndpointInput ( input . LambdaEndpoint , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , ... ( input . UrlEndpoint !== undefined && input . UrlEndpoint !== null && { UrlEndpoint : serializeAws_restJson1UrlEndpointInput ( input . UrlEndpoint , context ) , } ) , ... ( input . VpcId !== undefined && input . VpcId !== null && { VpcId : input . VpcId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApplicationCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEnvironmentCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteResourcePolicyCommand = 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 || "" }` + "/resourcepolicy/{Identifier}" ; if ( input . Identifier !== undefined ) { const labelValue = input . Identifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Identifier." ) ; } resolvedPath = resolvedPath . replace ( "{Identifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Identifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRouteCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/routes/{RouteIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } if ( input . RouteIdentifier !== undefined ) { const labelValue = input . RouteIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RouteIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{RouteIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RouteIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteServiceCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/services/{ServiceIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } if ( input . ServiceIdentifier !== undefined ) { const labelValue = input . ServiceIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ServiceIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ServiceIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ServiceIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApplicationCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEnvironmentCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetResourcePolicyCommand = 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 || "" }` + "/resourcepolicy/{Identifier}" ; if ( input . Identifier !== undefined ) { const labelValue = input . Identifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Identifier." ) ; } resolvedPath = resolvedPath . replace ( "{Identifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Identifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRouteCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/routes/{RouteIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } if ( input . RouteIdentifier !== undefined ) { const labelValue = input . RouteIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RouteIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{RouteIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RouteIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetServiceCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/services/{ServiceIdentifier}" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } if ( input . ServiceIdentifier !== undefined ) { const labelValue = input . ServiceIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ServiceIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ServiceIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ServiceIdentifier." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListApplicationsCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } 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_restJson1ListEnvironmentsCommand = 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 || "" }` + "/environments" ; 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_restJson1ListEnvironmentVpcsCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/vpcs" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } 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_restJson1ListRoutesCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/routes" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } 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_restJson1ListServicesCommand = 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 || "" }` + "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/services" ; if ( input . EnvironmentIdentifier !== undefined ) { const labelValue = input . EnvironmentIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentIdentifier." ) ; } if ( input . ApplicationIdentifier !== undefined ) { const labelValue = input . ApplicationIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationIdentifier." ) ; } 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 || "" }` + "/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_restJson1PutResourcePolicyCommand = 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 || "" }` + "/resourcepolicy" ; let body ; body = JSON . stringify ( { ... ( input . Policy !== undefined && input . Policy !== null && { Policy : input . Policy } ) , ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , 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 || "" }` + "/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 || "" }` + "/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 deserializeAws_restJson1CreateApplicationCommand = async ( output , context ) : Promise < CreateApplicationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateApplicationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApiGatewayProxy : undefined , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , EnvironmentId : undefined , LastUpdatedTime : undefined , Name : undefined , OwnerAccountId : undefined , ProxyType : undefined , State : undefined , Tags : undefined , VpcId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApiGatewayProxy !== undefined && data . ApiGatewayProxy !== null ) { contents . ApiGatewayProxy = deserializeAws_restJson1ApiGatewayProxyInput ( data . ApiGatewayProxy , context ) ; } if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . ProxyType !== undefined && data . ProxyType !== null ) { contents . ProxyType = __expectString ( data . ProxyType ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . VpcId !== undefined && data . VpcId !== null ) { contents . VpcId = __expectString ( data . VpcId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateApplicationCommandError = async ( output , context ) : Promise < CreateApplicationCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateEnvironmentCommand = async ( output , context ) : Promise < CreateEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , CreatedTime : undefined , Description : undefined , EnvironmentId : undefined , LastUpdatedTime : undefined , Name : undefined , NetworkFabricType : undefined , OwnerAccountId : undefined , State : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . NetworkFabricType !== undefined && data . NetworkFabricType !== null ) { contents . NetworkFabricType = __expectString ( data . NetworkFabricType ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEnvironmentCommandError = async ( output , context ) : Promise < CreateEnvironmentCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateRouteCommand = async ( output , context ) : Promise < CreateRouteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRouteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , LastUpdatedTime : undefined , OwnerAccountId : undefined , RouteId : undefined , RouteType : undefined , ServiceId : undefined , State : undefined , Tags : undefined , UriPathRoute : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . RouteId !== undefined && data . RouteId !== null ) { contents . RouteId = __expectString ( data . RouteId ) ; } if ( data . RouteType !== undefined && data . RouteType !== null ) { contents . RouteType = __expectString ( data . RouteType ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UriPathRoute !== undefined && data . UriPathRoute !== null ) { contents . UriPathRoute = deserializeAws_restJson1UriPathRouteInput ( data . UriPathRoute , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRouteCommandError = async ( output , context ) : Promise < CreateRouteCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateServiceCommand = async ( output , context ) : Promise < CreateServiceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateServiceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , Description : undefined , EndpointType : undefined , EnvironmentId : undefined , LambdaEndpoint : undefined , LastUpdatedTime : undefined , Name : undefined , OwnerAccountId : undefined , ServiceId : undefined , State : undefined , Tags : undefined , UrlEndpoint : undefined , VpcId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . EndpointType !== undefined && data . EndpointType !== null ) { contents . EndpointType = __expectString ( data . EndpointType ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LambdaEndpoint !== undefined && data . LambdaEndpoint !== null ) { contents . LambdaEndpoint = deserializeAws_restJson1LambdaEndpointInput ( data . LambdaEndpoint , context ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UrlEndpoint !== undefined && data . UrlEndpoint !== null ) { contents . UrlEndpoint = deserializeAws_restJson1UrlEndpointInput ( data . UrlEndpoint , context ) ; } if ( data . VpcId !== undefined && data . VpcId !== null ) { contents . VpcId = __expectString ( data . VpcId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateServiceCommandError = async ( output , context ) : Promise < CreateServiceCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteApplicationCommand = async ( output , context ) : Promise < DeleteApplicationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApplicationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , EnvironmentId : undefined , LastUpdatedTime : undefined , Name : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApplicationCommandError = async ( output , context ) : Promise < DeleteApplicationCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteEnvironmentCommand = async ( output , context ) : Promise < DeleteEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , EnvironmentId : undefined , LastUpdatedTime : undefined , Name : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEnvironmentCommandError = async ( output , context ) : Promise < DeleteEnvironmentCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteResourcePolicyCommand = async ( output , context ) : Promise < DeleteResourcePolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteResourcePolicyCommandError = async ( output , context ) : Promise < DeleteResourcePolicyCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteRouteCommand = async ( output , context ) : Promise < DeleteRouteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRouteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , LastUpdatedTime : undefined , RouteId : undefined , ServiceId : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . RouteId !== undefined && data . RouteId !== null ) { contents . RouteId = __expectString ( data . RouteId ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRouteCommandError = async ( output , context ) : Promise < DeleteRouteCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteServiceCommand = async ( output , context ) : Promise < DeleteServiceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteServiceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , EnvironmentId : undefined , LastUpdatedTime : undefined , Name : undefined , ServiceId : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteServiceCommandError = async ( output , context ) : Promise < DeleteServiceCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetApplicationCommand = async ( output , context ) : Promise < GetApplicationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApplicationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApiGatewayProxy : undefined , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , EnvironmentId : undefined , Error : undefined , LastUpdatedTime : undefined , Name : undefined , OwnerAccountId : undefined , ProxyType : undefined , State : undefined , Tags : undefined , VpcId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApiGatewayProxy !== undefined && data . ApiGatewayProxy !== null ) { contents . ApiGatewayProxy = deserializeAws_restJson1ApiGatewayProxyConfig ( data . ApiGatewayProxy , context ) ; } if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . Error !== undefined && data . Error !== null ) { contents . Error = deserializeAws_restJson1ErrorResponse ( data . Error , context ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . ProxyType !== undefined && data . ProxyType !== null ) { contents . ProxyType = __expectString ( data . ProxyType ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . VpcId !== undefined && data . VpcId !== null ) { contents . VpcId = __expectString ( data . VpcId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApplicationCommandError = async ( output , context ) : Promise < GetApplicationCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetEnvironmentCommand = async ( output , context ) : Promise < GetEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , CreatedTime : undefined , Description : undefined , EnvironmentId : undefined , Error : undefined , LastUpdatedTime : undefined , Name : undefined , NetworkFabricType : undefined , OwnerAccountId : undefined , State : undefined , Tags : undefined , TransitGatewayId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . Error !== undefined && data . Error !== null ) { contents . Error = deserializeAws_restJson1ErrorResponse ( data . Error , context ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . NetworkFabricType !== undefined && data . NetworkFabricType !== null ) { contents . NetworkFabricType = __expectString ( data . NetworkFabricType ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . TransitGatewayId !== undefined && data . TransitGatewayId !== null ) { contents . TransitGatewayId = __expectString ( data . TransitGatewayId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEnvironmentCommandError = async ( output , context ) : Promise < GetEnvironmentCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetResourcePolicyCommand = async ( output , context ) : Promise < GetResourcePolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Policy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = __expectString ( data . Policy ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResourcePolicyCommandError = async ( output , context ) : Promise < GetResourcePolicyCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetRouteCommand = async ( output , context ) : Promise < GetRouteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRouteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , EnvironmentId : undefined , Error : undefined , IncludeChildPaths : undefined , LastUpdatedTime : undefined , Methods : undefined , OwnerAccountId : undefined , PathResourceToId : undefined , RouteId : undefined , RouteType : undefined , ServiceId : undefined , SourcePath : undefined , State : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . Error !== undefined && data . Error !== null ) { contents . Error = deserializeAws_restJson1ErrorResponse ( data . Error , context ) ; } if ( data . IncludeChildPaths !== undefined && data . IncludeChildPaths !== null ) { contents . IncludeChildPaths = __expectBoolean ( data . IncludeChildPaths ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Methods !== undefined && data . Methods !== null ) { contents . Methods = deserializeAws_restJson1HttpMethods ( data . Methods , context ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . PathResourceToId !== undefined && data . PathResourceToId !== null ) { contents . PathResourceToId = deserializeAws_restJson1PathResourceToId ( data . PathResourceToId , context ) ; } if ( data . RouteId !== undefined && data . RouteId !== null ) { contents . RouteId = __expectString ( data . RouteId ) ; } if ( data . RouteType !== undefined && data . RouteType !== null ) { contents . RouteType = __expectString ( data . RouteType ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . SourcePath !== undefined && data . SourcePath !== null ) { contents . SourcePath = __expectString ( data . SourcePath ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRouteCommandError = async ( output , context ) : Promise < GetRouteCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetServiceCommand = async ( output , context ) : Promise < GetServiceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetServiceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationId : undefined , Arn : undefined , CreatedByAccountId : undefined , CreatedTime : undefined , Description : undefined , EndpointType : undefined , EnvironmentId : undefined , Error : undefined , LambdaEndpoint : undefined , LastUpdatedTime : undefined , Name : undefined , OwnerAccountId : undefined , ServiceId : undefined , State : undefined , Tags : undefined , UrlEndpoint : undefined , VpcId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationId !== undefined && data . ApplicationId !== null ) { contents . ApplicationId = __expectString ( data . ApplicationId ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedByAccountId !== undefined && data . CreatedByAccountId !== null ) { contents . CreatedByAccountId = __expectString ( data . CreatedByAccountId ) ; } if ( data . CreatedTime !== undefined && data . CreatedTime !== null ) { contents . CreatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTime ) ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . EndpointType !== undefined && data . EndpointType !== null ) { contents . EndpointType = __expectString ( data . EndpointType ) ; } if ( data . EnvironmentId !== undefined && data . EnvironmentId !== null ) { contents . EnvironmentId = __expectString ( data . EnvironmentId ) ; } if ( data . Error !== undefined && data . Error !== null ) { contents . Error = deserializeAws_restJson1ErrorResponse ( data . Error , context ) ; } if ( data . LambdaEndpoint !== undefined && data . LambdaEndpoint !== null ) { contents . LambdaEndpoint = deserializeAws_restJson1LambdaEndpointConfig ( data . LambdaEndpoint , context ) ; } if ( data . LastUpdatedTime !== undefined && data . LastUpdatedTime !== null ) { contents . LastUpdatedTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTime ) ) ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . OwnerAccountId !== undefined && data . OwnerAccountId !== null ) { contents . OwnerAccountId = __expectString ( data . OwnerAccountId ) ; } if ( data . ServiceId !== undefined && data . ServiceId !== null ) { contents . ServiceId = __expectString ( data . ServiceId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UrlEndpoint !== undefined && data . UrlEndpoint !== null ) { contents . UrlEndpoint = deserializeAws_restJson1UrlEndpointConfig ( data . UrlEndpoint , context ) ; } if ( data . VpcId !== undefined && data . VpcId !== null ) { contents . VpcId = __expectString ( data . VpcId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetServiceCommandError = async ( output , context ) : Promise < GetServiceCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListApplicationsCommand = async ( output , context ) : Promise < ListApplicationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListApplicationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationSummaryList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ApplicationSummaryList !== undefined && data . ApplicationSummaryList !== null ) { contents . ApplicationSummaryList = deserializeAws_restJson1ApplicationSummaries ( data . ApplicationSummaryList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListApplicationsCommandError = async ( output , context ) : Promise < ListApplicationsCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListEnvironmentsCommand = async ( output , context ) : Promise < ListEnvironmentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEnvironmentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EnvironmentSummaryList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . EnvironmentSummaryList !== undefined && data . EnvironmentSummaryList !== null ) { contents . EnvironmentSummaryList = deserializeAws_restJson1EnvironmentSummaries ( data . EnvironmentSummaryList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEnvironmentsCommandError = async ( output , context ) : Promise < ListEnvironmentsCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListEnvironmentVpcsCommand = async ( output , context ) : Promise < ListEnvironmentVpcsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEnvironmentVpcsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EnvironmentVpcList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . EnvironmentVpcList !== undefined && data . EnvironmentVpcList !== null ) { contents . EnvironmentVpcList = deserializeAws_restJson1EnvironmentVpcs ( data . EnvironmentVpcList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEnvironmentVpcsCommandError = async ( output , context ) : Promise < ListEnvironmentVpcsCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListRoutesCommand = async ( output , context ) : Promise < ListRoutesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRoutesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , RouteSummaryList : 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 . RouteSummaryList !== undefined && data . RouteSummaryList !== null ) { contents . RouteSummaryList = deserializeAws_restJson1RouteSummaries ( data . RouteSummaryList , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRoutesCommandError = async ( output , context ) : Promise < ListRoutesCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListServicesCommand = async ( output , context ) : Promise < ListServicesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListServicesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ServiceSummaryList : 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 . ServiceSummaryList !== undefined && data . ServiceSummaryList !== null ) { contents . ServiceSummaryList = deserializeAws_restJson1ServiceSummaries ( data . ServiceSummaryList , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListServicesCommandError = async ( output , context ) : Promise < ListServicesCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.migrationhubrefactorspaces#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.migrationhubrefactorspaces#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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 "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1PutResourcePolicyCommand = async ( output , context ) : Promise < PutResourcePolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutResourcePolicyCommandError = async ( output , context ) : Promise < PutResourcePolicyCommandOutput > => { 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.migrationhubrefactorspaces#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidResourcePolicyException" : case "com.amazonaws.migrationhubrefactorspaces#InvalidResourcePolicyException" : response = { ... ( await deserializeAws_restJson1InvalidResourcePolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.migrationhubrefactorspaces#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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 "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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 "InternalServerException" : case "com.amazonaws.migrationhubrefactorspaces#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.migrationhubrefactorspaces#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.migrationhubrefactorspaces#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , ResourceId : undefined , ResourceType : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $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_restJson1InvalidResourcePolicyExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidResourcePolicyException > => { const contents = { name : "InvalidResourcePolicyException" , $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_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , ResourceId : undefined , ResourceType : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } return contents ; } ; const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , QuotaCode : undefined , ResourceId : undefined , ResourceType : undefined , ServiceCode : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . QuotaCode !== undefined && data . QuotaCode !== null ) { contents . QuotaCode = __expectString ( data . QuotaCode ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } if ( data . ServiceCode !== undefined && data . ServiceCode !== null ) { contents . ServiceCode = __expectString ( data . ServiceCode ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , QuotaCode : undefined , RetryAfterSeconds : undefined , ServiceCode : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . RetryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . QuotaCode !== undefined && data . QuotaCode !== null ) { contents . QuotaCode = __expectString ( data . QuotaCode ) ; } if ( data . ServiceCode !== undefined && data . ServiceCode !== null ) { contents . ServiceCode = __expectString ( data . ServiceCode ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $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_restJson1ApiGatewayProxyInput = ( input , context ) : any => { return { ... ( input . EndpointType !== undefined && input . EndpointType !== null && { EndpointType : input . EndpointType } ) , ... ( input . StageName !== undefined && input . StageName !== null && { StageName : input . StageName } ) , } ; } ; const serializeAws_restJson1HttpMethods = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1LambdaEndpointInput = ( input , context ) : any => { return { ... ( input . Arn !== undefined && input . Arn !== null && { Arn : input . Arn } ) , } ; } ; 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_restJson1UriPathRouteInput = ( input , context ) : any => { return { ... ( input . ActivationState !== undefined && input . ActivationState !== null && { ActivationState : input . ActivationState } ) , ... ( input . IncludeChildPaths !== undefined && input . IncludeChildPaths !== null && { IncludeChildPaths : input . IncludeChildPaths } ) , ... ( input . Methods !== undefined && input . Methods !== null && { Methods : serializeAws_restJson1HttpMethods ( input . Methods , context ) } ) , ... ( input . SourcePath !== undefined && input . SourcePath !== null && { SourcePath : input . SourcePath } ) , } ; } ; const serializeAws_restJson1UrlEndpointInput = ( input , context ) : any => { return { ... ( input . HealthUrl !== undefined && input . HealthUrl !== null && { HealthUrl : input . HealthUrl } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const deserializeAws_restJson1AdditionalDetails = ( 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_restJson1ApiGatewayProxyConfig = ( output , context ) : ApiGatewayProxyConfig => { return { ApiGatewayId : __expectString ( output . ApiGatewayId ) , EndpointType : __expectString ( output . EndpointType ) , NlbArn : __expectString ( output . NlbArn ) , NlbName : __expectString ( output . NlbName ) , ProxyUrl : __expectString ( output . ProxyUrl ) , StageName : __expectString ( output . StageName ) , VpcLinkId : __expectString ( output . VpcLinkId ) , } as any ; } ; const deserializeAws_restJson1ApiGatewayProxyInput = ( output , context ) : ApiGatewayProxyInput => { return { EndpointType : __expectString ( output . EndpointType ) , StageName : __expectString ( output . StageName ) , } as any ; } ; const deserializeAws_restJson1ApiGatewayProxySummary = ( output , context ) : ApiGatewayProxySummary => { return { ApiGatewayId : __expectString ( output . ApiGatewayId ) , EndpointType : __expectString ( output . EndpointType ) , NlbArn : __expectString ( output . NlbArn ) , NlbName : __expectString ( output . NlbName ) , ProxyUrl : __expectString ( output . ProxyUrl ) , StageName : __expectString ( output . StageName ) , VpcLinkId : __expectString ( output . VpcLinkId ) , } as any ; } ; const deserializeAws_restJson1ApplicationSummaries = ( output , context ) : ApplicationSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ApplicationSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ApplicationSummary = ( output , context ) : ApplicationSummary => { return { ApiGatewayProxy : output . ApiGatewayProxy !== undefined && output . ApiGatewayProxy !== null ? deserializeAws_restJson1ApiGatewayProxySummary ( output . ApiGatewayProxy , context ) : undefined , ApplicationId : __expectString ( output . ApplicationId ) , Arn : __expectString ( output . Arn ) , CreatedByAccountId : __expectString ( output . CreatedByAccountId ) , CreatedTime : output . CreatedTime !== undefined && output . CreatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTime ) ) ) : undefined , EnvironmentId : __expectString ( output . EnvironmentId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1ErrorResponse ( output . Error , context ) : undefined , LastUpdatedTime : output . LastUpdatedTime !== undefined && output . LastUpdatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTime ) ) ) : undefined , Name : __expectString ( output . Name ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , ProxyType : __expectString ( output . ProxyType ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagMap ( output . Tags , context ) : undefined , VpcId : __expectString ( output . VpcId ) , } as any ; } ; const deserializeAws_restJson1CidrBlocks = ( 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_restJson1EnvironmentSummaries = ( output , context ) : EnvironmentSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EnvironmentSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EnvironmentSummary = ( output , context ) : EnvironmentSummary => { return { Arn : __expectString ( output . Arn ) , CreatedTime : output . CreatedTime !== undefined && output . CreatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTime ) ) ) : undefined , Description : __expectString ( output . Description ) , EnvironmentId : __expectString ( output . EnvironmentId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1ErrorResponse ( output . Error , context ) : undefined , LastUpdatedTime : output . LastUpdatedTime !== undefined && output . LastUpdatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTime ) ) ) : undefined , Name : __expectString ( output . Name ) , NetworkFabricType : __expectString ( output . NetworkFabricType ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagMap ( output . Tags , context ) : undefined , TransitGatewayId : __expectString ( output . TransitGatewayId ) , } as any ; } ; const deserializeAws_restJson1EnvironmentVpc = ( output , context ) : EnvironmentVpc => { return { AccountId : __expectString ( output . AccountId ) , CidrBlocks : output . CidrBlocks !== undefined && output . CidrBlocks !== null ? deserializeAws_restJson1CidrBlocks ( output . CidrBlocks , context ) : undefined , CreatedTime : output . CreatedTime !== undefined && output . CreatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTime ) ) ) : undefined , EnvironmentId : __expectString ( output . EnvironmentId ) , LastUpdatedTime : output . LastUpdatedTime !== undefined && output . LastUpdatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTime ) ) ) : undefined , VpcId : __expectString ( output . VpcId ) , VpcName : __expectString ( output . VpcName ) , } as any ; } ; const deserializeAws_restJson1EnvironmentVpcs = ( output , context ) : EnvironmentVpc [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EnvironmentVpc ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ErrorResponse = ( output , context ) : ErrorResponse => { return { AccountId : __expectString ( output . AccountId ) , AdditionalDetails : output . AdditionalDetails !== undefined && output . AdditionalDetails !== null ? deserializeAws_restJson1AdditionalDetails ( output . AdditionalDetails , context ) : undefined , Code : __expectString ( output . Code ) , Message : __expectString ( output . Message ) , ResourceIdentifier : __expectString ( output . ResourceIdentifier ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1HttpMethods = ( output , context ) : ( HttpMethod | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1LambdaEndpointConfig = ( output , context ) : LambdaEndpointConfig => { return { Arn : __expectString ( output . Arn ) , } as any ; } ; const deserializeAws_restJson1LambdaEndpointInput = ( output , context ) : LambdaEndpointInput => { return { Arn : __expectString ( output . Arn ) , } as any ; } ; const deserializeAws_restJson1LambdaEndpointSummary = ( output , context ) : LambdaEndpointSummary => { return { Arn : __expectString ( output . Arn ) , } as any ; } ; const deserializeAws_restJson1PathResourceToId = ( 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_restJson1RouteSummaries = ( output , context ) : RouteSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RouteSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RouteSummary = ( output , context ) : RouteSummary => { return { ApplicationId : __expectString ( output . ApplicationId ) , Arn : __expectString ( output . Arn ) , CreatedByAccountId : __expectString ( output . CreatedByAccountId ) , CreatedTime : output . CreatedTime !== undefined && output . CreatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTime ) ) ) : undefined , EnvironmentId : __expectString ( output . EnvironmentId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1ErrorResponse ( output . Error , context ) : undefined , IncludeChildPaths : __expectBoolean ( output . IncludeChildPaths ) , LastUpdatedTime : output . LastUpdatedTime !== undefined && output . LastUpdatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTime ) ) ) : undefined , Methods : output . Methods !== undefined && output . Methods !== null ? deserializeAws_restJson1HttpMethods ( output . Methods , context ) : undefined , OwnerAccountId : __expectString ( output . OwnerAccountId ) , PathResourceToId : output . PathResourceToId !== undefined && output . PathResourceToId !== null ? deserializeAws_restJson1PathResourceToId ( output . PathResourceToId , context ) : undefined , RouteId : __expectString ( output . RouteId ) , RouteType : __expectString ( output . RouteType ) , ServiceId : __expectString ( output . ServiceId ) , SourcePath : __expectString ( output . SourcePath ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagMap ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ServiceSummaries = ( output , context ) : ServiceSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ServiceSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ServiceSummary = ( output , context ) : ServiceSummary => { return { ApplicationId : __expectString ( output . ApplicationId ) , Arn : __expectString ( output . Arn ) , CreatedByAccountId : __expectString ( output . CreatedByAccountId ) , CreatedTime : output . CreatedTime !== undefined && output . CreatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTime ) ) ) : undefined , Description : __expectString ( output . Description ) , EndpointType : __expectString ( output . EndpointType ) , EnvironmentId : __expectString ( output . EnvironmentId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1ErrorResponse ( output . Error , context ) : undefined , LambdaEndpoint : output . LambdaEndpoint !== undefined && output . LambdaEndpoint !== null ? deserializeAws_restJson1LambdaEndpointSummary ( output . LambdaEndpoint , context ) : undefined , LastUpdatedTime : output . LastUpdatedTime !== undefined && output . LastUpdatedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTime ) ) ) : undefined , Name : __expectString ( output . Name ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , ServiceId : __expectString ( output . ServiceId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagMap ( output . Tags , context ) : undefined , UrlEndpoint : output . UrlEndpoint !== undefined && output . UrlEndpoint !== null ? deserializeAws_restJson1UrlEndpointSummary ( output . UrlEndpoint , context ) : undefined , VpcId : __expectString ( output . VpcId ) , } 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_restJson1UriPathRouteInput = ( output , context ) : UriPathRouteInput => { return { ActivationState : __expectString ( output . ActivationState ) , IncludeChildPaths : __expectBoolean ( output . IncludeChildPaths ) , Methods : output . Methods !== undefined && output . Methods !== null ? deserializeAws_restJson1HttpMethods ( output . Methods , context ) : undefined , SourcePath : __expectString ( output . SourcePath ) , } as any ; } ; const deserializeAws_restJson1UrlEndpointConfig = ( output , context ) : UrlEndpointConfig => { return { HealthUrl : __expectString ( output . HealthUrl ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1UrlEndpointInput = ( output , context ) : UrlEndpointInput => { return { HealthUrl : __expectString ( output . HealthUrl ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1UrlEndpointSummary = ( output , context ) : UrlEndpointSummary => { return { HealthUrl : __expectString ( output . HealthUrl ) , Url : __expectString ( output . Url ) , } 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 "" ; } ;