import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , LazyJsonString as __LazyJsonString , 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 { AcceptAttachmentCommandInput , AcceptAttachmentCommandOutput } from "../commands/AcceptAttachmentCommand" ; import { AssociateConnectPeerCommandInput , AssociateConnectPeerCommandOutput , } from "../commands/AssociateConnectPeerCommand" ; import { AssociateCustomerGatewayCommandInput , AssociateCustomerGatewayCommandOutput , } from "../commands/AssociateCustomerGatewayCommand" ; import { AssociateLinkCommandInput , AssociateLinkCommandOutput } from "../commands/AssociateLinkCommand" ; import { AssociateTransitGatewayConnectPeerCommandInput , AssociateTransitGatewayConnectPeerCommandOutput , } from "../commands/AssociateTransitGatewayConnectPeerCommand" ; import { CreateConnectAttachmentCommandInput , CreateConnectAttachmentCommandOutput , } from "../commands/CreateConnectAttachmentCommand" ; import { CreateConnectionCommandInput , CreateConnectionCommandOutput } from "../commands/CreateConnectionCommand" ; import { CreateConnectPeerCommandInput , CreateConnectPeerCommandOutput } from "../commands/CreateConnectPeerCommand" ; import { CreateCoreNetworkCommandInput , CreateCoreNetworkCommandOutput } from "../commands/CreateCoreNetworkCommand" ; import { CreateDeviceCommandInput , CreateDeviceCommandOutput } from "../commands/CreateDeviceCommand" ; import { CreateGlobalNetworkCommandInput , CreateGlobalNetworkCommandOutput , } from "../commands/CreateGlobalNetworkCommand" ; import { CreateLinkCommandInput , CreateLinkCommandOutput } from "../commands/CreateLinkCommand" ; import { CreateSiteCommandInput , CreateSiteCommandOutput } from "../commands/CreateSiteCommand" ; import { CreateSiteToSiteVpnAttachmentCommandInput , CreateSiteToSiteVpnAttachmentCommandOutput , } from "../commands/CreateSiteToSiteVpnAttachmentCommand" ; import { CreateVpcAttachmentCommandInput , CreateVpcAttachmentCommandOutput , } from "../commands/CreateVpcAttachmentCommand" ; import { DeleteAttachmentCommandInput , DeleteAttachmentCommandOutput } from "../commands/DeleteAttachmentCommand" ; import { DeleteConnectionCommandInput , DeleteConnectionCommandOutput } from "../commands/DeleteConnectionCommand" ; import { DeleteConnectPeerCommandInput , DeleteConnectPeerCommandOutput } from "../commands/DeleteConnectPeerCommand" ; import { DeleteCoreNetworkCommandInput , DeleteCoreNetworkCommandOutput } from "../commands/DeleteCoreNetworkCommand" ; import { DeleteCoreNetworkPolicyVersionCommandInput , DeleteCoreNetworkPolicyVersionCommandOutput , } from "../commands/DeleteCoreNetworkPolicyVersionCommand" ; import { DeleteDeviceCommandInput , DeleteDeviceCommandOutput } from "../commands/DeleteDeviceCommand" ; import { DeleteGlobalNetworkCommandInput , DeleteGlobalNetworkCommandOutput , } from "../commands/DeleteGlobalNetworkCommand" ; import { DeleteLinkCommandInput , DeleteLinkCommandOutput } from "../commands/DeleteLinkCommand" ; import { DeleteResourcePolicyCommandInput , DeleteResourcePolicyCommandOutput , } from "../commands/DeleteResourcePolicyCommand" ; import { DeleteSiteCommandInput , DeleteSiteCommandOutput } from "../commands/DeleteSiteCommand" ; import { DeregisterTransitGatewayCommandInput , DeregisterTransitGatewayCommandOutput , } from "../commands/DeregisterTransitGatewayCommand" ; import { DescribeGlobalNetworksCommandInput , DescribeGlobalNetworksCommandOutput , } from "../commands/DescribeGlobalNetworksCommand" ; import { DisassociateConnectPeerCommandInput , DisassociateConnectPeerCommandOutput , } from "../commands/DisassociateConnectPeerCommand" ; import { DisassociateCustomerGatewayCommandInput , DisassociateCustomerGatewayCommandOutput , } from "../commands/DisassociateCustomerGatewayCommand" ; import { DisassociateLinkCommandInput , DisassociateLinkCommandOutput } from "../commands/DisassociateLinkCommand" ; import { DisassociateTransitGatewayConnectPeerCommandInput , DisassociateTransitGatewayConnectPeerCommandOutput , } from "../commands/DisassociateTransitGatewayConnectPeerCommand" ; import { ExecuteCoreNetworkChangeSetCommandInput , ExecuteCoreNetworkChangeSetCommandOutput , } from "../commands/ExecuteCoreNetworkChangeSetCommand" ; import { GetConnectAttachmentCommandInput , GetConnectAttachmentCommandOutput , } from "../commands/GetConnectAttachmentCommand" ; import { GetConnectionsCommandInput , GetConnectionsCommandOutput } from "../commands/GetConnectionsCommand" ; import { GetConnectPeerAssociationsCommandInput , GetConnectPeerAssociationsCommandOutput , } from "../commands/GetConnectPeerAssociationsCommand" ; import { GetConnectPeerCommandInput , GetConnectPeerCommandOutput } from "../commands/GetConnectPeerCommand" ; import { GetCoreNetworkChangeSetCommandInput , GetCoreNetworkChangeSetCommandOutput , } from "../commands/GetCoreNetworkChangeSetCommand" ; import { GetCoreNetworkCommandInput , GetCoreNetworkCommandOutput } from "../commands/GetCoreNetworkCommand" ; import { GetCoreNetworkPolicyCommandInput , GetCoreNetworkPolicyCommandOutput , } from "../commands/GetCoreNetworkPolicyCommand" ; import { GetCustomerGatewayAssociationsCommandInput , GetCustomerGatewayAssociationsCommandOutput , } from "../commands/GetCustomerGatewayAssociationsCommand" ; import { GetDevicesCommandInput , GetDevicesCommandOutput } from "../commands/GetDevicesCommand" ; import { GetLinkAssociationsCommandInput , GetLinkAssociationsCommandOutput , } from "../commands/GetLinkAssociationsCommand" ; import { GetLinksCommandInput , GetLinksCommandOutput } from "../commands/GetLinksCommand" ; import { GetNetworkResourceCountsCommandInput , GetNetworkResourceCountsCommandOutput , } from "../commands/GetNetworkResourceCountsCommand" ; import { GetNetworkResourceRelationshipsCommandInput , GetNetworkResourceRelationshipsCommandOutput , } from "../commands/GetNetworkResourceRelationshipsCommand" ; import { GetNetworkResourcesCommandInput , GetNetworkResourcesCommandOutput , } from "../commands/GetNetworkResourcesCommand" ; import { GetNetworkRoutesCommandInput , GetNetworkRoutesCommandOutput } from "../commands/GetNetworkRoutesCommand" ; import { GetNetworkTelemetryCommandInput , GetNetworkTelemetryCommandOutput , } from "../commands/GetNetworkTelemetryCommand" ; import { GetResourcePolicyCommandInput , GetResourcePolicyCommandOutput } from "../commands/GetResourcePolicyCommand" ; import { GetRouteAnalysisCommandInput , GetRouteAnalysisCommandOutput } from "../commands/GetRouteAnalysisCommand" ; import { GetSitesCommandInput , GetSitesCommandOutput } from "../commands/GetSitesCommand" ; import { GetSiteToSiteVpnAttachmentCommandInput , GetSiteToSiteVpnAttachmentCommandOutput , } from "../commands/GetSiteToSiteVpnAttachmentCommand" ; import { GetTransitGatewayConnectPeerAssociationsCommandInput , GetTransitGatewayConnectPeerAssociationsCommandOutput , } from "../commands/GetTransitGatewayConnectPeerAssociationsCommand" ; import { GetTransitGatewayRegistrationsCommandInput , GetTransitGatewayRegistrationsCommandOutput , } from "../commands/GetTransitGatewayRegistrationsCommand" ; import { GetVpcAttachmentCommandInput , GetVpcAttachmentCommandOutput } from "../commands/GetVpcAttachmentCommand" ; import { ListAttachmentsCommandInput , ListAttachmentsCommandOutput } from "../commands/ListAttachmentsCommand" ; import { ListConnectPeersCommandInput , ListConnectPeersCommandOutput } from "../commands/ListConnectPeersCommand" ; import { ListCoreNetworkPolicyVersionsCommandInput , ListCoreNetworkPolicyVersionsCommandOutput , } from "../commands/ListCoreNetworkPolicyVersionsCommand" ; import { ListCoreNetworksCommandInput , ListCoreNetworksCommandOutput } from "../commands/ListCoreNetworksCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PutCoreNetworkPolicyCommandInput , PutCoreNetworkPolicyCommandOutput , } from "../commands/PutCoreNetworkPolicyCommand" ; import { PutResourcePolicyCommandInput , PutResourcePolicyCommandOutput } from "../commands/PutResourcePolicyCommand" ; import { RegisterTransitGatewayCommandInput , RegisterTransitGatewayCommandOutput , } from "../commands/RegisterTransitGatewayCommand" ; import { RejectAttachmentCommandInput , RejectAttachmentCommandOutput } from "../commands/RejectAttachmentCommand" ; import { RestoreCoreNetworkPolicyVersionCommandInput , RestoreCoreNetworkPolicyVersionCommandOutput , } from "../commands/RestoreCoreNetworkPolicyVersionCommand" ; import { StartRouteAnalysisCommandInput , StartRouteAnalysisCommandOutput } from "../commands/StartRouteAnalysisCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateConnectionCommandInput , UpdateConnectionCommandOutput } from "../commands/UpdateConnectionCommand" ; import { UpdateCoreNetworkCommandInput , UpdateCoreNetworkCommandOutput } from "../commands/UpdateCoreNetworkCommand" ; import { UpdateDeviceCommandInput , UpdateDeviceCommandOutput } from "../commands/UpdateDeviceCommand" ; import { UpdateGlobalNetworkCommandInput , UpdateGlobalNetworkCommandOutput , } from "../commands/UpdateGlobalNetworkCommand" ; import { UpdateLinkCommandInput , UpdateLinkCommandOutput } from "../commands/UpdateLinkCommand" ; import { UpdateNetworkResourceMetadataCommandInput , UpdateNetworkResourceMetadataCommandOutput , } from "../commands/UpdateNetworkResourceMetadataCommand" ; import { UpdateSiteCommandInput , UpdateSiteCommandOutput } from "../commands/UpdateSiteCommand" ; import { UpdateVpcAttachmentCommandInput , UpdateVpcAttachmentCommandOutput , } from "../commands/UpdateVpcAttachmentCommand" ; import { AccessDeniedException , Attachment , AWSLocation , Bandwidth , BgpOptions , ConflictException , ConnectAttachment , ConnectAttachmentOptions , Connection , ConnectionHealth , ConnectPeer , ConnectPeerAssociation , ConnectPeerBgpConfiguration , ConnectPeerConfiguration , ConnectPeerSummary , CoreNetwork , CoreNetworkChange , CoreNetworkChangeValues , CoreNetworkEdge , CoreNetworkPolicy , CoreNetworkPolicyError , CoreNetworkPolicyException , CoreNetworkPolicyVersion , CoreNetworkSegment , CoreNetworkSegmentEdgeIdentifier , CoreNetworkSummary , CustomerGatewayAssociation , Device , GlobalNetwork , InternalServerException , Link , LinkAssociation , Location , NetworkResource , NetworkResourceCount , NetworkResourceSummary , NetworkRoute , NetworkRouteDestination , NetworkTelemetry , PathComponent , ProposedSegmentChange , Relationship , ResourceNotFoundException , RouteAnalysis , RouteAnalysisCompletion , RouteAnalysisEndpointOptions , RouteAnalysisEndpointOptionsSpecification , RouteAnalysisPath , RouteState , RouteTableIdentifier , RouteType , ServiceQuotaExceededException , Site , SiteToSiteVpnAttachment , Tag , ThrottlingException , TransitGatewayConnectPeerAssociation , TransitGatewayRegistration , TransitGatewayRegistrationStateReason , ValidationException , ValidationExceptionField , VpcAttachment , VpcOptions , } from "../models/models_0" ; export const serializeAws_restJson1AcceptAttachmentCommand = 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 || "" }` + "/attachments/{AttachmentId}/accept" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1AssociateConnectPeerCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connect-peer-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . ConnectPeerId !== undefined && input . ConnectPeerId !== null && { ConnectPeerId : input . ConnectPeerId } ) , ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1AssociateCustomerGatewayCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/customer-gateway-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . CustomerGatewayArn !== undefined && input . CustomerGatewayArn !== null && { CustomerGatewayArn : input . CustomerGatewayArn } ) , ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1AssociateLinkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/link-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1AssociateTransitGatewayConnectPeerCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , ... ( input . TransitGatewayConnectPeerArn !== undefined && input . TransitGatewayConnectPeerArn !== null && { TransitGatewayConnectPeerArn : input . TransitGatewayConnectPeerArn , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateConnectAttachmentCommand = 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 || "" }` + "/connect-attachments" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . CoreNetworkId !== undefined && input . CoreNetworkId !== null && { CoreNetworkId : input . CoreNetworkId } ) , ... ( input . EdgeLocation !== undefined && input . EdgeLocation !== null && { EdgeLocation : input . EdgeLocation } ) , ... ( input . Options !== undefined && input . Options !== null && { Options : serializeAws_restJson1ConnectAttachmentOptions ( input . Options , context ) } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . TransportAttachmentId !== undefined && input . TransportAttachmentId !== null && { TransportAttachmentId : input . TransportAttachmentId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateConnectionCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connections" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . ConnectedDeviceId !== undefined && input . ConnectedDeviceId !== null && { ConnectedDeviceId : input . ConnectedDeviceId } ) , ... ( input . ConnectedLinkId !== undefined && input . ConnectedLinkId !== null && { ConnectedLinkId : input . ConnectedLinkId } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateConnectPeerCommand = 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 || "" }` + "/connect-peers" ; let body ; body = JSON . stringify ( { ... ( input . BgpOptions !== undefined && input . BgpOptions !== null && { BgpOptions : serializeAws_restJson1BgpOptions ( input . BgpOptions , context ) } ) , ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . ConnectAttachmentId !== undefined && input . ConnectAttachmentId !== null && { ConnectAttachmentId : input . ConnectAttachmentId } ) , ... ( input . CoreNetworkAddress !== undefined && input . CoreNetworkAddress !== null && { CoreNetworkAddress : input . CoreNetworkAddress } ) , ... ( input . InsideCidrBlocks !== undefined && input . InsideCidrBlocks !== null && { InsideCidrBlocks : serializeAws_restJson1ConstrainedStringList ( input . InsideCidrBlocks , context ) , } ) , ... ( input . PeerAddress !== undefined && input . PeerAddress !== null && { PeerAddress : input . PeerAddress } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateCoreNetworkCommand = 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 || "" }` + "/core-networks" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . GlobalNetworkId !== undefined && input . GlobalNetworkId !== null && { GlobalNetworkId : input . GlobalNetworkId } ) , ... ( input . PolicyDocument !== undefined && input . PolicyDocument !== null && { PolicyDocument : input . PolicyDocument } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDeviceCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/devices" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AWSLocation !== undefined && input . AWSLocation !== null && { AWSLocation : serializeAws_restJson1AWSLocation ( input . AWSLocation , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1Location ( input . Location , context ) } ) , ... ( input . Model !== undefined && input . Model !== null && { Model : input . Model } ) , ... ( input . SerialNumber !== undefined && input . SerialNumber !== null && { SerialNumber : input . SerialNumber } ) , ... ( input . SiteId !== undefined && input . SiteId !== null && { SiteId : input . SiteId } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . Vendor !== undefined && input . Vendor !== null && { Vendor : input . Vendor } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateGlobalNetworkCommand = 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 || "" }` + "/global-networks" ; let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateLinkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/links" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Bandwidth !== undefined && input . Bandwidth !== null && { Bandwidth : serializeAws_restJson1Bandwidth ( input . Bandwidth , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Provider !== undefined && input . Provider !== null && { Provider : input . Provider } ) , ... ( input . SiteId !== undefined && input . SiteId !== null && { SiteId : input . SiteId } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSiteCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/sites" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1Location ( input . Location , context ) } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSiteToSiteVpnAttachmentCommand = 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 || "" }` + "/site-to-site-vpn-attachments" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . CoreNetworkId !== undefined && input . CoreNetworkId !== null && { CoreNetworkId : input . CoreNetworkId } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . VpnConnectionArn !== undefined && input . VpnConnectionArn !== null && { VpnConnectionArn : input . VpnConnectionArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateVpcAttachmentCommand = 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 || "" }` + "/vpc-attachments" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . CoreNetworkId !== undefined && input . CoreNetworkId !== null && { CoreNetworkId : input . CoreNetworkId } ) , ... ( input . Options !== undefined && input . Options !== null && { Options : serializeAws_restJson1VpcOptions ( input . Options , context ) } ) , ... ( input . SubnetArns !== undefined && input . SubnetArns !== null && { SubnetArns : serializeAws_restJson1SubnetArnList ( input . SubnetArns , context ) } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . VpcArn !== undefined && input . VpcArn !== null && { VpcArn : input . VpcArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAttachmentCommand = 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 || "" }` + "/attachments/{AttachmentId}" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteConnectionCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . ConnectionId !== undefined ) { const labelValue = input . ConnectionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConnectionId." ) ; } resolvedPath = resolvedPath . replace ( "{ConnectionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConnectionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteConnectPeerCommand = 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 || "" }` + "/connect-peers/{ConnectPeerId}" ; if ( input . ConnectPeerId !== undefined ) { const labelValue = input . ConnectPeerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConnectPeerId." ) ; } resolvedPath = resolvedPath . replace ( "{ConnectPeerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConnectPeerId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCoreNetworkCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCoreNetworkPolicyVersionCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-policy-versions/{PolicyVersionId}" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } if ( input . PolicyVersionId !== undefined ) { const labelValue = input . PolicyVersionId . toString ( ) ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyVersionId." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyVersionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyVersionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDeviceCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/devices/{DeviceId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . DeviceId !== undefined ) { const labelValue = input . DeviceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DeviceId." ) ; } resolvedPath = resolvedPath . replace ( "{DeviceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DeviceId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteGlobalNetworkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteLinkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/links/{LinkId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . LinkId !== undefined ) { const labelValue = input . LinkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: LinkId." ) ; } resolvedPath = resolvedPath . replace ( "{LinkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: LinkId." ) ; } 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 || "" }` + "/resource-policy/{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 : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSiteCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/sites/{SiteId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . SiteId !== undefined ) { const labelValue = input . SiteId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SiteId." ) ; } resolvedPath = resolvedPath . replace ( "{SiteId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SiteId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeregisterTransitGatewayCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations/{TransitGatewayArn}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . TransitGatewayArn !== undefined ) { const labelValue = input . TransitGatewayArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TransitGatewayArn." ) ; } resolvedPath = resolvedPath . replace ( "{TransitGatewayArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TransitGatewayArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeGlobalNetworksCommand = 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 || "" }` + "/global-networks" ; const query = { ... ( input . GlobalNetworkIds !== undefined && { globalNetworkIds : ( input . GlobalNetworkIds || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DisassociateConnectPeerCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connect-peer-associations/{ConnectPeerId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . ConnectPeerId !== undefined ) { const labelValue = input . ConnectPeerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConnectPeerId." ) ; } resolvedPath = resolvedPath . replace ( "{ConnectPeerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConnectPeerId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateCustomerGatewayCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/customer-gateway-associations/{CustomerGatewayArn}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . CustomerGatewayArn !== undefined ) { const labelValue = input . CustomerGatewayArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CustomerGatewayArn." ) ; } resolvedPath = resolvedPath . replace ( "{CustomerGatewayArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CustomerGatewayArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateLinkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/link-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . DeviceId !== undefined && { deviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && { linkId : input . LinkId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DisassociateTransitGatewayConnectPeerCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations/{TransitGatewayConnectPeerArn}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . TransitGatewayConnectPeerArn !== undefined ) { const labelValue = input . TransitGatewayConnectPeerArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TransitGatewayConnectPeerArn." ) ; } resolvedPath = resolvedPath . replace ( "{TransitGatewayConnectPeerArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TransitGatewayConnectPeerArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ExecuteCoreNetworkChangeSetCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-change-sets/{PolicyVersionId}/execute" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } if ( input . PolicyVersionId !== undefined ) { const labelValue = input . PolicyVersionId . toString ( ) ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyVersionId." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyVersionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyVersionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetConnectAttachmentCommand = 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 || "" }` + "/connect-attachments/{AttachmentId}" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetConnectionsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connections" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . ConnectionIds !== undefined && { connectionIds : ( input . ConnectionIds || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . DeviceId !== undefined && { deviceId : input . DeviceId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetConnectPeerCommand = 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 || "" }` + "/connect-peers/{ConnectPeerId}" ; if ( input . ConnectPeerId !== undefined ) { const labelValue = input . ConnectPeerId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConnectPeerId." ) ; } resolvedPath = resolvedPath . replace ( "{ConnectPeerId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConnectPeerId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetConnectPeerAssociationsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connect-peer-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . ConnectPeerIds !== undefined && { connectPeerIds : ( input . ConnectPeerIds || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCoreNetworkCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCoreNetworkChangeSetCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-change-sets/{PolicyVersionId}" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } if ( input . PolicyVersionId !== undefined ) { const labelValue = input . PolicyVersionId . toString ( ) ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyVersionId." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyVersionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyVersionId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCoreNetworkPolicyCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-policy" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } const query = { ... ( input . PolicyVersionId !== undefined && { policyVersionId : input . PolicyVersionId . toString ( ) } ) , ... ( input . Alias !== undefined && { alias : input . Alias } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCustomerGatewayAssociationsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/customer-gateway-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . CustomerGatewayArns !== undefined && { customerGatewayArns : ( input . CustomerGatewayArns || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDevicesCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/devices" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . DeviceIds !== undefined && { deviceIds : ( input . DeviceIds || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , ... ( input . SiteId !== undefined && { siteId : input . SiteId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetLinkAssociationsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/link-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . DeviceId !== undefined && { deviceId : input . DeviceId } ) , ... ( input . LinkId !== undefined && { linkId : input . LinkId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetLinksCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/links" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . LinkIds !== undefined && { linkIds : ( input . LinkIds || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , ... ( input . SiteId !== undefined && { siteId : input . SiteId } ) , ... ( input . Type !== undefined && { type : input . Type } ) , ... ( input . Provider !== undefined && { provider : input . Provider } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetNetworkResourceCountsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-resource-count" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . ResourceType !== undefined && { resourceType : input . ResourceType } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetNetworkResourceRelationshipsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-resource-relationships" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . CoreNetworkId !== undefined && { coreNetworkId : input . CoreNetworkId } ) , ... ( input . RegisteredGatewayArn !== undefined && { registeredGatewayArn : input . RegisteredGatewayArn } ) , ... ( input . AwsRegion !== undefined && { awsRegion : input . AwsRegion } ) , ... ( input . AccountId !== undefined && { accountId : input . AccountId } ) , ... ( input . ResourceType !== undefined && { resourceType : input . ResourceType } ) , ... ( input . ResourceArn !== undefined && { resourceArn : input . ResourceArn } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetNetworkResourcesCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-resources" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . CoreNetworkId !== undefined && { coreNetworkId : input . CoreNetworkId } ) , ... ( input . RegisteredGatewayArn !== undefined && { registeredGatewayArn : input . RegisteredGatewayArn } ) , ... ( input . AwsRegion !== undefined && { awsRegion : input . AwsRegion } ) , ... ( input . AccountId !== undefined && { accountId : input . AccountId } ) , ... ( input . ResourceType !== undefined && { resourceType : input . ResourceType } ) , ... ( input . ResourceArn !== undefined && { resourceArn : input . ResourceArn } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetNetworkRoutesCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-routes" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . DestinationFilters !== undefined && input . DestinationFilters !== null && { DestinationFilters : serializeAws_restJson1FilterMap ( input . DestinationFilters , context ) , } ) , ... ( input . ExactCidrMatches !== undefined && input . ExactCidrMatches !== null && { ExactCidrMatches : serializeAws_restJson1ConstrainedStringList ( input . ExactCidrMatches , context ) , } ) , ... ( input . LongestPrefixMatches !== undefined && input . LongestPrefixMatches !== null && { LongestPrefixMatches : serializeAws_restJson1ConstrainedStringList ( input . LongestPrefixMatches , context ) , } ) , ... ( input . PrefixListIds !== undefined && input . PrefixListIds !== null && { PrefixListIds : serializeAws_restJson1ConstrainedStringList ( input . PrefixListIds , context ) , } ) , ... ( input . RouteTableIdentifier !== undefined && input . RouteTableIdentifier !== null && { RouteTableIdentifier : serializeAws_restJson1RouteTableIdentifier ( input . RouteTableIdentifier , context ) , } ) , ... ( input . States !== undefined && input . States !== null && { States : serializeAws_restJson1RouteStateList ( input . States , context ) } ) , ... ( input . SubnetOfMatches !== undefined && input . SubnetOfMatches !== null && { SubnetOfMatches : serializeAws_restJson1ConstrainedStringList ( input . SubnetOfMatches , context ) , } ) , ... ( input . SupernetOfMatches !== undefined && input . SupernetOfMatches !== null && { SupernetOfMatches : serializeAws_restJson1ConstrainedStringList ( input . SupernetOfMatches , context ) , } ) , ... ( input . Types !== undefined && input . Types !== null && { Types : serializeAws_restJson1RouteTypeList ( input . Types , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetNetworkTelemetryCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-telemetry" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . CoreNetworkId !== undefined && { coreNetworkId : input . CoreNetworkId } ) , ... ( input . RegisteredGatewayArn !== undefined && { registeredGatewayArn : input . RegisteredGatewayArn } ) , ... ( input . AwsRegion !== undefined && { awsRegion : input . AwsRegion } ) , ... ( input . AccountId !== undefined && { accountId : input . AccountId } ) , ... ( input . ResourceType !== undefined && { resourceType : input . ResourceType } ) , ... ( input . ResourceArn !== undefined && { resourceArn : input . ResourceArn } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , 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 || "" }` + "/resource-policy/{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_restJson1GetRouteAnalysisCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/route-analyses/{RouteAnalysisId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . RouteAnalysisId !== undefined ) { const labelValue = input . RouteAnalysisId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RouteAnalysisId." ) ; } resolvedPath = resolvedPath . replace ( "{RouteAnalysisId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RouteAnalysisId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSitesCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/sites" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . SiteIds !== undefined && { siteIds : ( input . SiteIds || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSiteToSiteVpnAttachmentCommand = 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 || "" }` + "/site-to-site-vpn-attachments/{AttachmentId}" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetTransitGatewayConnectPeerAssociationsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . TransitGatewayConnectPeerArns !== undefined && { transitGatewayConnectPeerArns : ( input . TransitGatewayConnectPeerArns || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetTransitGatewayRegistrationsCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } const query = { ... ( input . TransitGatewayArns !== undefined && { transitGatewayArns : ( input . TransitGatewayArns || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetVpcAttachmentCommand = 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 || "" }` + "/vpc-attachments/{AttachmentId}" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListAttachmentsCommand = 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 || "" }` + "/attachments" ; const query = { ... ( input . CoreNetworkId !== undefined && { coreNetworkId : input . CoreNetworkId } ) , ... ( input . AttachmentType !== undefined && { attachmentType : input . AttachmentType } ) , ... ( input . EdgeLocation !== undefined && { edgeLocation : input . EdgeLocation } ) , ... ( input . State !== undefined && { state : input . State } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListConnectPeersCommand = 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 || "" }` + "/connect-peers" ; const query = { ... ( input . CoreNetworkId !== undefined && { coreNetworkId : input . CoreNetworkId } ) , ... ( input . ConnectAttachmentId !== undefined && { connectAttachmentId : input . ConnectAttachmentId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListCoreNetworkPolicyVersionsCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-policy-versions" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListCoreNetworksCommand = 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 || "" }` + "/core-networks" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; 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_restJson1PutCoreNetworkPolicyCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-policy" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . LatestVersionId !== undefined && input . LatestVersionId !== null && { LatestVersionId : input . LatestVersionId } ) , ... ( input . PolicyDocument !== undefined && input . PolicyDocument !== null && { PolicyDocument : __LazyJsonString . fromObject ( input . PolicyDocument ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , 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" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/resource-policy/{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 . PolicyDocument !== undefined && input . PolicyDocument !== null && { PolicyDocument : __LazyJsonString . fromObject ( input . PolicyDocument ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RegisterTransitGatewayCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . TransitGatewayArn !== undefined && input . TransitGatewayArn !== null && { TransitGatewayArn : input . TransitGatewayArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RejectAttachmentCommand = 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 || "" }` + "/attachments/{AttachmentId}/reject" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RestoreCoreNetworkPolicyVersionCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}/core-network-policy-versions/{PolicyVersionId}/restore" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } if ( input . PolicyVersionId !== undefined ) { const labelValue = input . PolicyVersionId . toString ( ) ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyVersionId." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyVersionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyVersionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartRouteAnalysisCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/route-analyses" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Destination !== undefined && input . Destination !== null && { Destination : serializeAws_restJson1RouteAnalysisEndpointOptionsSpecification ( input . Destination , context ) , } ) , ... ( input . IncludeReturnPath !== undefined && input . IncludeReturnPath !== null && { IncludeReturnPath : input . IncludeReturnPath } ) , ... ( input . Source !== undefined && input . Source !== null && { Source : serializeAws_restJson1RouteAnalysisEndpointOptionsSpecification ( input . Source , context ) , } ) , ... ( input . UseMiddleboxes !== undefined && input . UseMiddleboxes !== null && { UseMiddleboxes : input . UseMiddleboxes } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/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_restJson1TagList ( 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 serializeAws_restJson1UpdateConnectionCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . ConnectionId !== undefined ) { const labelValue = input . ConnectionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConnectionId." ) ; } resolvedPath = resolvedPath . replace ( "{ConnectionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConnectionId." ) ; } let body ; body = JSON . stringify ( { ... ( input . ConnectedLinkId !== undefined && input . ConnectedLinkId !== null && { ConnectedLinkId : input . ConnectedLinkId } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . LinkId !== undefined && input . LinkId !== null && { LinkId : input . LinkId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateCoreNetworkCommand = 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 || "" }` + "/core-networks/{CoreNetworkId}" ; if ( input . CoreNetworkId !== undefined ) { const labelValue = input . CoreNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CoreNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{CoreNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CoreNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDeviceCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/devices/{DeviceId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . DeviceId !== undefined ) { const labelValue = input . DeviceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DeviceId." ) ; } resolvedPath = resolvedPath . replace ( "{DeviceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DeviceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AWSLocation !== undefined && input . AWSLocation !== null && { AWSLocation : serializeAws_restJson1AWSLocation ( input . AWSLocation , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1Location ( input . Location , context ) } ) , ... ( input . Model !== undefined && input . Model !== null && { Model : input . Model } ) , ... ( input . SerialNumber !== undefined && input . SerialNumber !== null && { SerialNumber : input . SerialNumber } ) , ... ( input . SiteId !== undefined && input . SiteId !== null && { SiteId : input . SiteId } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . Vendor !== undefined && input . Vendor !== null && { Vendor : input . Vendor } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateGlobalNetworkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateLinkCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/links/{LinkId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . LinkId !== undefined ) { const labelValue = input . LinkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: LinkId." ) ; } resolvedPath = resolvedPath . replace ( "{LinkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: LinkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Bandwidth !== undefined && input . Bandwidth !== null && { Bandwidth : serializeAws_restJson1Bandwidth ( input . Bandwidth , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Provider !== undefined && input . Provider !== null && { Provider : input . Provider } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateNetworkResourceMetadataCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/network-resources/{ResourceArn}/metadata" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } 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 . Metadata !== undefined && input . Metadata !== null && { Metadata : serializeAws_restJson1NetworkResourceMetadataMap ( input . Metadata , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSiteCommand = 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 || "" }` + "/global-networks/{GlobalNetworkId}/sites/{SiteId}" ; if ( input . GlobalNetworkId !== undefined ) { const labelValue = input . GlobalNetworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GlobalNetworkId." ) ; } resolvedPath = resolvedPath . replace ( "{GlobalNetworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GlobalNetworkId." ) ; } if ( input . SiteId !== undefined ) { const labelValue = input . SiteId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SiteId." ) ; } resolvedPath = resolvedPath . replace ( "{SiteId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SiteId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1Location ( input . Location , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateVpcAttachmentCommand = 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 || "" }` + "/vpc-attachments/{AttachmentId}" ; if ( input . AttachmentId !== undefined ) { const labelValue = input . AttachmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttachmentId." ) ; } resolvedPath = resolvedPath . replace ( "{AttachmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttachmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AddSubnetArns !== undefined && input . AddSubnetArns !== null && { AddSubnetArns : serializeAws_restJson1SubnetArnList ( input . AddSubnetArns , context ) , } ) , ... ( input . Options !== undefined && input . Options !== null && { Options : serializeAws_restJson1VpcOptions ( input . Options , context ) } ) , ... ( input . RemoveSubnetArns !== undefined && input . RemoveSubnetArns !== null && { RemoveSubnetArns : serializeAws_restJson1SubnetArnList ( input . RemoveSubnetArns , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AcceptAttachmentCommand = async ( output , context ) : Promise < AcceptAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AcceptAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attachment !== undefined && data . Attachment !== null ) { contents . Attachment = deserializeAws_restJson1Attachment ( data . Attachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AcceptAttachmentCommandError = async ( output , context ) : Promise < AcceptAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1AssociateConnectPeerCommand = async ( output , context ) : Promise < AssociateConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeerAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeerAssociation !== undefined && data . ConnectPeerAssociation !== null ) { contents . ConnectPeerAssociation = deserializeAws_restJson1ConnectPeerAssociation ( data . ConnectPeerAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateConnectPeerCommandError = async ( output , context ) : Promise < AssociateConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1AssociateCustomerGatewayCommand = async ( output , context ) : Promise < AssociateCustomerGatewayCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateCustomerGatewayCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CustomerGatewayAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CustomerGatewayAssociation !== undefined && data . CustomerGatewayAssociation !== null ) { contents . CustomerGatewayAssociation = deserializeAws_restJson1CustomerGatewayAssociation ( data . CustomerGatewayAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateCustomerGatewayCommandError = async ( output , context ) : Promise < AssociateCustomerGatewayCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1AssociateLinkCommand = async ( output , context ) : Promise < AssociateLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LinkAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LinkAssociation !== undefined && data . LinkAssociation !== null ) { contents . LinkAssociation = deserializeAws_restJson1LinkAssociation ( data . LinkAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateLinkCommandError = async ( output , context ) : Promise < AssociateLinkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1AssociateTransitGatewayConnectPeerCommand = async ( output , context ) : Promise < AssociateTransitGatewayConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateTransitGatewayConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TransitGatewayConnectPeerAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TransitGatewayConnectPeerAssociation !== undefined && data . TransitGatewayConnectPeerAssociation !== null ) { contents . TransitGatewayConnectPeerAssociation = deserializeAws_restJson1TransitGatewayConnectPeerAssociation ( data . TransitGatewayConnectPeerAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateTransitGatewayConnectPeerCommandError = async ( output , context ) : Promise < AssociateTransitGatewayConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateConnectAttachmentCommand = async ( output , context ) : Promise < CreateConnectAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateConnectAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectAttachment !== undefined && data . ConnectAttachment !== null ) { contents . ConnectAttachment = deserializeAws_restJson1ConnectAttachment ( data . ConnectAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateConnectAttachmentCommandError = async ( output , context ) : Promise < CreateConnectAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateConnectionCommand = async ( output , context ) : Promise < CreateConnectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateConnectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Connection : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Connection !== undefined && data . Connection !== null ) { contents . Connection = deserializeAws_restJson1Connection ( data . Connection , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateConnectionCommandError = async ( output , context ) : Promise < CreateConnectionCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateConnectPeerCommand = async ( output , context ) : Promise < CreateConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeer !== undefined && data . ConnectPeer !== null ) { contents . ConnectPeer = deserializeAws_restJson1ConnectPeer ( data . ConnectPeer , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateConnectPeerCommandError = async ( output , context ) : Promise < CreateConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateCoreNetworkCommand = async ( output , context ) : Promise < CreateCoreNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCoreNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetwork !== undefined && data . CoreNetwork !== null ) { contents . CoreNetwork = deserializeAws_restJson1CoreNetwork ( data . CoreNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCoreNetworkCommandError = async ( output , context ) : Promise < CreateCoreNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CoreNetworkPolicyException" : case "com.amazonaws.networkmanager#CoreNetworkPolicyException" : response = { ... ( await deserializeAws_restJson1CoreNetworkPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateDeviceCommand = async ( output , context ) : Promise < CreateDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Device : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Device !== undefined && data . Device !== null ) { contents . Device = deserializeAws_restJson1Device ( data . Device , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDeviceCommandError = async ( output , context ) : Promise < CreateDeviceCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateGlobalNetworkCommand = async ( output , context ) : Promise < CreateGlobalNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateGlobalNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GlobalNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . GlobalNetwork !== undefined && data . GlobalNetwork !== null ) { contents . GlobalNetwork = deserializeAws_restJson1GlobalNetwork ( data . GlobalNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateGlobalNetworkCommandError = async ( output , context ) : Promise < CreateGlobalNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateLinkCommand = async ( output , context ) : Promise < CreateLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Link : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Link !== undefined && data . Link !== null ) { contents . Link = deserializeAws_restJson1Link ( data . Link , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateLinkCommandError = async ( output , context ) : Promise < CreateLinkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateSiteCommand = async ( output , context ) : Promise < CreateSiteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSiteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Site : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Site !== undefined && data . Site !== null ) { contents . Site = deserializeAws_restJson1Site ( data . Site , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSiteCommandError = async ( output , context ) : Promise < CreateSiteCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateSiteToSiteVpnAttachmentCommand = async ( output , context ) : Promise < CreateSiteToSiteVpnAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSiteToSiteVpnAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SiteToSiteVpnAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . SiteToSiteVpnAttachment !== undefined && data . SiteToSiteVpnAttachment !== null ) { contents . SiteToSiteVpnAttachment = deserializeAws_restJson1SiteToSiteVpnAttachment ( data . SiteToSiteVpnAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSiteToSiteVpnAttachmentCommandError = async ( output , context ) : Promise < CreateSiteToSiteVpnAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CreateVpcAttachmentCommand = async ( output , context ) : Promise < CreateVpcAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateVpcAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VpcAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . VpcAttachment !== undefined && data . VpcAttachment !== null ) { contents . VpcAttachment = deserializeAws_restJson1VpcAttachment ( data . VpcAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateVpcAttachmentCommandError = async ( output , context ) : Promise < CreateVpcAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteAttachmentCommand = async ( output , context ) : Promise < DeleteAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attachment !== undefined && data . Attachment !== null ) { contents . Attachment = deserializeAws_restJson1Attachment ( data . Attachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAttachmentCommandError = async ( output , context ) : Promise < DeleteAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteConnectionCommand = async ( output , context ) : Promise < DeleteConnectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteConnectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Connection : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Connection !== undefined && data . Connection !== null ) { contents . Connection = deserializeAws_restJson1Connection ( data . Connection , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteConnectionCommandError = async ( output , context ) : Promise < DeleteConnectionCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteConnectPeerCommand = async ( output , context ) : Promise < DeleteConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeer !== undefined && data . ConnectPeer !== null ) { contents . ConnectPeer = deserializeAws_restJson1ConnectPeer ( data . ConnectPeer , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteConnectPeerCommandError = async ( output , context ) : Promise < DeleteConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteCoreNetworkCommand = async ( output , context ) : Promise < DeleteCoreNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCoreNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetwork !== undefined && data . CoreNetwork !== null ) { contents . CoreNetwork = deserializeAws_restJson1CoreNetwork ( data . CoreNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCoreNetworkCommandError = async ( output , context ) : Promise < DeleteCoreNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteCoreNetworkPolicyVersionCommand = async ( output , context ) : Promise < DeleteCoreNetworkPolicyVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCoreNetworkPolicyVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkPolicy !== undefined && data . CoreNetworkPolicy !== null ) { contents . CoreNetworkPolicy = deserializeAws_restJson1CoreNetworkPolicy ( data . CoreNetworkPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCoreNetworkPolicyVersionCommandError = async ( output , context ) : Promise < DeleteCoreNetworkPolicyVersionCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteDeviceCommand = async ( output , context ) : Promise < DeleteDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Device : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Device !== undefined && data . Device !== null ) { contents . Device = deserializeAws_restJson1Device ( data . Device , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDeviceCommandError = async ( output , context ) : Promise < DeleteDeviceCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteGlobalNetworkCommand = async ( output , context ) : Promise < DeleteGlobalNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteGlobalNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GlobalNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . GlobalNetwork !== undefined && data . GlobalNetwork !== null ) { contents . GlobalNetwork = deserializeAws_restJson1GlobalNetwork ( data . GlobalNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteGlobalNetworkCommandError = async ( output , context ) : Promise < DeleteGlobalNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteLinkCommand = async ( output , context ) : Promise < DeleteLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Link : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Link !== undefined && data . Link !== null ) { contents . Link = deserializeAws_restJson1Link ( data . Link , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteLinkCommandError = async ( output , context ) : Promise < DeleteLinkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeleteSiteCommand = async ( output , context ) : Promise < DeleteSiteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSiteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Site : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Site !== undefined && data . Site !== null ) { contents . Site = deserializeAws_restJson1Site ( data . Site , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSiteCommandError = async ( output , context ) : Promise < DeleteSiteCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DeregisterTransitGatewayCommand = async ( output , context ) : Promise < DeregisterTransitGatewayCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeregisterTransitGatewayCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TransitGatewayRegistration : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TransitGatewayRegistration !== undefined && data . TransitGatewayRegistration !== null ) { contents . TransitGatewayRegistration = deserializeAws_restJson1TransitGatewayRegistration ( data . TransitGatewayRegistration , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeregisterTransitGatewayCommandError = async ( output , context ) : Promise < DeregisterTransitGatewayCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DescribeGlobalNetworksCommand = async ( output , context ) : Promise < DescribeGlobalNetworksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeGlobalNetworksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GlobalNetworks : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . GlobalNetworks !== undefined && data . GlobalNetworks !== null ) { contents . GlobalNetworks = deserializeAws_restJson1GlobalNetworkList ( data . GlobalNetworks , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeGlobalNetworksCommandError = async ( output , context ) : Promise < DescribeGlobalNetworksCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DisassociateConnectPeerCommand = async ( output , context ) : Promise < DisassociateConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeerAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeerAssociation !== undefined && data . ConnectPeerAssociation !== null ) { contents . ConnectPeerAssociation = deserializeAws_restJson1ConnectPeerAssociation ( data . ConnectPeerAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateConnectPeerCommandError = async ( output , context ) : Promise < DisassociateConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DisassociateCustomerGatewayCommand = async ( output , context ) : Promise < DisassociateCustomerGatewayCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateCustomerGatewayCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CustomerGatewayAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CustomerGatewayAssociation !== undefined && data . CustomerGatewayAssociation !== null ) { contents . CustomerGatewayAssociation = deserializeAws_restJson1CustomerGatewayAssociation ( data . CustomerGatewayAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateCustomerGatewayCommandError = async ( output , context ) : Promise < DisassociateCustomerGatewayCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DisassociateLinkCommand = async ( output , context ) : Promise < DisassociateLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LinkAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LinkAssociation !== undefined && data . LinkAssociation !== null ) { contents . LinkAssociation = deserializeAws_restJson1LinkAssociation ( data . LinkAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateLinkCommandError = async ( output , context ) : Promise < DisassociateLinkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1DisassociateTransitGatewayConnectPeerCommand = async ( output , context ) : Promise < DisassociateTransitGatewayConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateTransitGatewayConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TransitGatewayConnectPeerAssociation : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TransitGatewayConnectPeerAssociation !== undefined && data . TransitGatewayConnectPeerAssociation !== null ) { contents . TransitGatewayConnectPeerAssociation = deserializeAws_restJson1TransitGatewayConnectPeerAssociation ( data . TransitGatewayConnectPeerAssociation , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateTransitGatewayConnectPeerCommandError = async ( output , context ) : Promise < DisassociateTransitGatewayConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1ExecuteCoreNetworkChangeSetCommand = async ( output , context ) : Promise < ExecuteCoreNetworkChangeSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ExecuteCoreNetworkChangeSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ExecuteCoreNetworkChangeSetCommandError = async ( output , context ) : Promise < ExecuteCoreNetworkChangeSetCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetConnectAttachmentCommand = async ( output , context ) : Promise < GetConnectAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConnectAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectAttachment !== undefined && data . ConnectAttachment !== null ) { contents . ConnectAttachment = deserializeAws_restJson1ConnectAttachment ( data . ConnectAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConnectAttachmentCommandError = async ( output , context ) : Promise < GetConnectAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetConnectionsCommand = async ( output , context ) : Promise < GetConnectionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConnectionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Connections : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Connections !== undefined && data . Connections !== null ) { contents . Connections = deserializeAws_restJson1ConnectionList ( data . Connections , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConnectionsCommandError = async ( output , context ) : Promise < GetConnectionsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetConnectPeerCommand = async ( output , context ) : Promise < GetConnectPeerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConnectPeerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeer !== undefined && data . ConnectPeer !== null ) { contents . ConnectPeer = deserializeAws_restJson1ConnectPeer ( data . ConnectPeer , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConnectPeerCommandError = async ( output , context ) : Promise < GetConnectPeerCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetConnectPeerAssociationsCommand = async ( output , context ) : Promise < GetConnectPeerAssociationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConnectPeerAssociationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeerAssociations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeerAssociations !== undefined && data . ConnectPeerAssociations !== null ) { contents . ConnectPeerAssociations = deserializeAws_restJson1ConnectPeerAssociationList ( data . ConnectPeerAssociations , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConnectPeerAssociationsCommandError = async ( output , context ) : Promise < GetConnectPeerAssociationsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetCoreNetworkCommand = async ( output , context ) : Promise < GetCoreNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCoreNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetwork !== undefined && data . CoreNetwork !== null ) { contents . CoreNetwork = deserializeAws_restJson1CoreNetwork ( data . CoreNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCoreNetworkCommandError = async ( output , context ) : Promise < GetCoreNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetCoreNetworkChangeSetCommand = async ( output , context ) : Promise < GetCoreNetworkChangeSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCoreNetworkChangeSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkChanges : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkChanges !== undefined && data . CoreNetworkChanges !== null ) { contents . CoreNetworkChanges = deserializeAws_restJson1CoreNetworkChangeList ( data . CoreNetworkChanges , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCoreNetworkChangeSetCommandError = async ( output , context ) : Promise < GetCoreNetworkChangeSetCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetCoreNetworkPolicyCommand = async ( output , context ) : Promise < GetCoreNetworkPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCoreNetworkPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkPolicy !== undefined && data . CoreNetworkPolicy !== null ) { contents . CoreNetworkPolicy = deserializeAws_restJson1CoreNetworkPolicy ( data . CoreNetworkPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCoreNetworkPolicyCommandError = async ( output , context ) : Promise < GetCoreNetworkPolicyCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetCustomerGatewayAssociationsCommand = async ( output , context ) : Promise < GetCustomerGatewayAssociationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCustomerGatewayAssociationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CustomerGatewayAssociations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CustomerGatewayAssociations !== undefined && data . CustomerGatewayAssociations !== null ) { contents . CustomerGatewayAssociations = deserializeAws_restJson1CustomerGatewayAssociationList ( data . CustomerGatewayAssociations , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCustomerGatewayAssociationsCommandError = async ( output , context ) : Promise < GetCustomerGatewayAssociationsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetDevicesCommand = async ( output , context ) : Promise < GetDevicesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDevicesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Devices : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Devices !== undefined && data . Devices !== null ) { contents . Devices = deserializeAws_restJson1DeviceList ( data . Devices , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDevicesCommandError = async ( output , context ) : Promise < GetDevicesCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetLinkAssociationsCommand = async ( output , context ) : Promise < GetLinkAssociationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetLinkAssociationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LinkAssociations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LinkAssociations !== undefined && data . LinkAssociations !== null ) { contents . LinkAssociations = deserializeAws_restJson1LinkAssociationList ( data . LinkAssociations , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetLinkAssociationsCommandError = async ( output , context ) : Promise < GetLinkAssociationsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetLinksCommand = async ( output , context ) : Promise < GetLinksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetLinksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Links : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Links !== undefined && data . Links !== null ) { contents . Links = deserializeAws_restJson1LinkList ( data . Links , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetLinksCommandError = async ( output , context ) : Promise < GetLinksCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetNetworkResourceCountsCommand = async ( output , context ) : Promise < GetNetworkResourceCountsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkResourceCountsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NetworkResourceCounts : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NetworkResourceCounts !== undefined && data . NetworkResourceCounts !== null ) { contents . NetworkResourceCounts = deserializeAws_restJson1NetworkResourceCountList ( data . NetworkResourceCounts , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkResourceCountsCommandError = async ( output , context ) : Promise < GetNetworkResourceCountsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetNetworkResourceRelationshipsCommand = async ( output , context ) : Promise < GetNetworkResourceRelationshipsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkResourceRelationshipsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Relationships : 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 . Relationships !== undefined && data . Relationships !== null ) { contents . Relationships = deserializeAws_restJson1RelationshipList ( data . Relationships , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkResourceRelationshipsCommandError = async ( output , context ) : Promise < GetNetworkResourceRelationshipsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetNetworkResourcesCommand = async ( output , context ) : Promise < GetNetworkResourcesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkResourcesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NetworkResources : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NetworkResources !== undefined && data . NetworkResources !== null ) { contents . NetworkResources = deserializeAws_restJson1NetworkResourceList ( data . NetworkResources , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkResourcesCommandError = async ( output , context ) : Promise < GetNetworkResourcesCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetNetworkRoutesCommand = async ( output , context ) : Promise < GetNetworkRoutesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkRoutesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkSegmentEdge : undefined , NetworkRoutes : undefined , RouteTableArn : undefined , RouteTableTimestamp : undefined , RouteTableType : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkSegmentEdge !== undefined && data . CoreNetworkSegmentEdge !== null ) { contents . CoreNetworkSegmentEdge = deserializeAws_restJson1CoreNetworkSegmentEdgeIdentifier ( data . CoreNetworkSegmentEdge , context ) ; } if ( data . NetworkRoutes !== undefined && data . NetworkRoutes !== null ) { contents . NetworkRoutes = deserializeAws_restJson1NetworkRouteList ( data . NetworkRoutes , context ) ; } if ( data . RouteTableArn !== undefined && data . RouteTableArn !== null ) { contents . RouteTableArn = __expectString ( data . RouteTableArn ) ; } if ( data . RouteTableTimestamp !== undefined && data . RouteTableTimestamp !== null ) { contents . RouteTableTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . RouteTableTimestamp ) ) ) ; } if ( data . RouteTableType !== undefined && data . RouteTableType !== null ) { contents . RouteTableType = __expectString ( data . RouteTableType ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkRoutesCommandError = async ( output , context ) : Promise < GetNetworkRoutesCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetNetworkTelemetryCommand = async ( output , context ) : Promise < GetNetworkTelemetryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkTelemetryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NetworkTelemetry : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NetworkTelemetry !== undefined && data . NetworkTelemetry !== null ) { contents . NetworkTelemetry = deserializeAws_restJson1NetworkTelemetryList ( data . NetworkTelemetry , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkTelemetryCommandError = async ( output , context ) : Promise < GetNetworkTelemetryCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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 ) , PolicyDocument : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . PolicyDocument !== undefined && data . PolicyDocument !== null ) { contents . PolicyDocument = new __LazyJsonString ( data . PolicyDocument ) ; } 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetRouteAnalysisCommand = async ( output , context ) : Promise < GetRouteAnalysisCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRouteAnalysisCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RouteAnalysis : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . RouteAnalysis !== undefined && data . RouteAnalysis !== null ) { contents . RouteAnalysis = deserializeAws_restJson1RouteAnalysis ( data . RouteAnalysis , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRouteAnalysisCommandError = async ( output , context ) : Promise < GetRouteAnalysisCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetSitesCommand = async ( output , context ) : Promise < GetSitesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSitesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Sites : 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 . Sites !== undefined && data . Sites !== null ) { contents . Sites = deserializeAws_restJson1SiteList ( data . Sites , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSitesCommandError = async ( output , context ) : Promise < GetSitesCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetSiteToSiteVpnAttachmentCommand = async ( output , context ) : Promise < GetSiteToSiteVpnAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSiteToSiteVpnAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SiteToSiteVpnAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . SiteToSiteVpnAttachment !== undefined && data . SiteToSiteVpnAttachment !== null ) { contents . SiteToSiteVpnAttachment = deserializeAws_restJson1SiteToSiteVpnAttachment ( data . SiteToSiteVpnAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSiteToSiteVpnAttachmentCommandError = async ( output , context ) : Promise < GetSiteToSiteVpnAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetTransitGatewayConnectPeerAssociationsCommand = async ( output , context ) : Promise < GetTransitGatewayConnectPeerAssociationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTransitGatewayConnectPeerAssociationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , TransitGatewayConnectPeerAssociations : 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 . TransitGatewayConnectPeerAssociations !== undefined && data . TransitGatewayConnectPeerAssociations !== null ) { contents . TransitGatewayConnectPeerAssociations = deserializeAws_restJson1TransitGatewayConnectPeerAssociationList ( data . TransitGatewayConnectPeerAssociations , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTransitGatewayConnectPeerAssociationsCommandError = async ( output , context ) : Promise < GetTransitGatewayConnectPeerAssociationsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetTransitGatewayRegistrationsCommand = async ( output , context ) : Promise < GetTransitGatewayRegistrationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTransitGatewayRegistrationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , TransitGatewayRegistrations : 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 . TransitGatewayRegistrations !== undefined && data . TransitGatewayRegistrations !== null ) { contents . TransitGatewayRegistrations = deserializeAws_restJson1TransitGatewayRegistrationList ( data . TransitGatewayRegistrations , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTransitGatewayRegistrationsCommandError = async ( output , context ) : Promise < GetTransitGatewayRegistrationsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1GetVpcAttachmentCommand = async ( output , context ) : Promise < GetVpcAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetVpcAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VpcAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . VpcAttachment !== undefined && data . VpcAttachment !== null ) { contents . VpcAttachment = deserializeAws_restJson1VpcAttachment ( data . VpcAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetVpcAttachmentCommandError = async ( output , context ) : Promise < GetVpcAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1ListAttachmentsCommand = async ( output , context ) : Promise < ListAttachmentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAttachmentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attachments : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attachments !== undefined && data . Attachments !== null ) { contents . Attachments = deserializeAws_restJson1AttachmentList ( data . Attachments , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAttachmentsCommandError = async ( output , context ) : Promise < ListAttachmentsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1ListConnectPeersCommand = async ( output , context ) : Promise < ListConnectPeersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListConnectPeersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConnectPeers : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectPeers !== undefined && data . ConnectPeers !== null ) { contents . ConnectPeers = deserializeAws_restJson1ConnectPeerSummaryList ( data . ConnectPeers , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListConnectPeersCommandError = async ( output , context ) : Promise < ListConnectPeersCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1ListCoreNetworkPolicyVersionsCommand = async ( output , context ) : Promise < ListCoreNetworkPolicyVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCoreNetworkPolicyVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkPolicyVersions : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkPolicyVersions !== undefined && data . CoreNetworkPolicyVersions !== null ) { contents . CoreNetworkPolicyVersions = deserializeAws_restJson1CoreNetworkPolicyVersionList ( data . CoreNetworkPolicyVersions , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCoreNetworkPolicyVersionsCommandError = async ( output , context ) : Promise < ListCoreNetworkPolicyVersionsCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1ListCoreNetworksCommand = async ( output , context ) : Promise < ListCoreNetworksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCoreNetworksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworks : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworks !== undefined && data . CoreNetworks !== null ) { contents . CoreNetworks = deserializeAws_restJson1CoreNetworkSummaryList ( data . CoreNetworks , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCoreNetworksCommandError = async ( output , context ) : Promise < ListCoreNetworksCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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 ) , TagList : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TagList !== undefined && data . TagList !== null ) { contents . TagList = deserializeAws_restJson1TagList ( data . TagList , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1PutCoreNetworkPolicyCommand = async ( output , context ) : Promise < PutCoreNetworkPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutCoreNetworkPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkPolicy !== undefined && data . CoreNetworkPolicy !== null ) { contents . CoreNetworkPolicy = deserializeAws_restJson1CoreNetworkPolicy ( data . CoreNetworkPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutCoreNetworkPolicyCommandError = async ( output , context ) : Promise < PutCoreNetworkPolicyCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CoreNetworkPolicyException" : case "com.amazonaws.networkmanager#CoreNetworkPolicyException" : response = { ... ( await deserializeAws_restJson1CoreNetworkPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1RegisterTransitGatewayCommand = async ( output , context ) : Promise < RegisterTransitGatewayCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RegisterTransitGatewayCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TransitGatewayRegistration : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TransitGatewayRegistration !== undefined && data . TransitGatewayRegistration !== null ) { contents . TransitGatewayRegistration = deserializeAws_restJson1TransitGatewayRegistration ( data . TransitGatewayRegistration , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RegisterTransitGatewayCommandError = async ( output , context ) : Promise < RegisterTransitGatewayCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1RejectAttachmentCommand = async ( output , context ) : Promise < RejectAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RejectAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attachment !== undefined && data . Attachment !== null ) { contents . Attachment = deserializeAws_restJson1Attachment ( data . Attachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RejectAttachmentCommandError = async ( output , context ) : Promise < RejectAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1RestoreCoreNetworkPolicyVersionCommand = async ( output , context ) : Promise < RestoreCoreNetworkPolicyVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RestoreCoreNetworkPolicyVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetworkPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetworkPolicy !== undefined && data . CoreNetworkPolicy !== null ) { contents . CoreNetworkPolicy = deserializeAws_restJson1CoreNetworkPolicy ( data . CoreNetworkPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RestoreCoreNetworkPolicyVersionCommandError = async ( output , context ) : Promise < RestoreCoreNetworkPolicyVersionCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1StartRouteAnalysisCommand = async ( output , context ) : Promise < StartRouteAnalysisCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartRouteAnalysisCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RouteAnalysis : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . RouteAnalysis !== undefined && data . RouteAnalysis !== null ) { contents . RouteAnalysis = deserializeAws_restJson1RouteAnalysis ( data . RouteAnalysis , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartRouteAnalysisCommandError = async ( output , context ) : Promise < StartRouteAnalysisCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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 "AccessDeniedException" : case "com.amazonaws.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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 "AccessDeniedException" : case "com.amazonaws.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateConnectionCommand = async ( output , context ) : Promise < UpdateConnectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateConnectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Connection : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Connection !== undefined && data . Connection !== null ) { contents . Connection = deserializeAws_restJson1Connection ( data . Connection , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateConnectionCommandError = async ( output , context ) : Promise < UpdateConnectionCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateCoreNetworkCommand = async ( output , context ) : Promise < UpdateCoreNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateCoreNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CoreNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CoreNetwork !== undefined && data . CoreNetwork !== null ) { contents . CoreNetwork = deserializeAws_restJson1CoreNetwork ( data . CoreNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateCoreNetworkCommandError = async ( output , context ) : Promise < UpdateCoreNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateDeviceCommand = async ( output , context ) : Promise < UpdateDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Device : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Device !== undefined && data . Device !== null ) { contents . Device = deserializeAws_restJson1Device ( data . Device , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDeviceCommandError = async ( output , context ) : Promise < UpdateDeviceCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateGlobalNetworkCommand = async ( output , context ) : Promise < UpdateGlobalNetworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGlobalNetworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GlobalNetwork : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . GlobalNetwork !== undefined && data . GlobalNetwork !== null ) { contents . GlobalNetwork = deserializeAws_restJson1GlobalNetwork ( data . GlobalNetwork , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGlobalNetworkCommandError = async ( output , context ) : Promise < UpdateGlobalNetworkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateLinkCommand = async ( output , context ) : Promise < UpdateLinkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateLinkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Link : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Link !== undefined && data . Link !== null ) { contents . Link = deserializeAws_restJson1Link ( data . Link , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateLinkCommandError = async ( output , context ) : Promise < UpdateLinkCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.networkmanager#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateNetworkResourceMetadataCommand = async ( output , context ) : Promise < UpdateNetworkResourceMetadataCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateNetworkResourceMetadataCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Metadata : undefined , ResourceArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Metadata !== undefined && data . Metadata !== null ) { contents . Metadata = deserializeAws_restJson1NetworkResourceMetadataMap ( data . Metadata , context ) ; } if ( data . ResourceArn !== undefined && data . ResourceArn !== null ) { contents . ResourceArn = __expectString ( data . ResourceArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateNetworkResourceMetadataCommandError = async ( output , context ) : Promise < UpdateNetworkResourceMetadataCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateSiteCommand = async ( output , context ) : Promise < UpdateSiteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSiteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Site : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Site !== undefined && data . Site !== null ) { contents . Site = deserializeAws_restJson1Site ( data . Site , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSiteCommandError = async ( output , context ) : Promise < UpdateSiteCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1UpdateVpcAttachmentCommand = async ( output , context ) : Promise < UpdateVpcAttachmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateVpcAttachmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VpcAttachment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . VpcAttachment !== undefined && data . VpcAttachment !== null ) { contents . VpcAttachment = deserializeAws_restJson1VpcAttachment ( data . VpcAttachment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateVpcAttachmentCommandError = async ( output , context ) : Promise < UpdateVpcAttachmentCommandOutput > => { 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.networkmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.networkmanager#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.networkmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.networkmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.networkmanager#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.networkmanager#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_restJson1CoreNetworkPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < CoreNetworkPolicyException > => { const contents = { name : "CoreNetworkPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Errors : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1CoreNetworkPolicyErrorList ( data . Errors , context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RetryAfterSeconds : 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 ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Context : undefined , Message : undefined , ResourceId : undefined , ResourceType : undefined , } ; const data = parsedOutput . body ; if ( data . Context !== undefined && data . Context !== null ) { contents . Context = deserializeAws_restJson1ExceptionContextMap ( data . Context , context ) ; } 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 ) , LimitCode : undefined , Message : undefined , ResourceId : undefined , ResourceType : undefined , ServiceCode : undefined , } ; const data = parsedOutput . body ; if ( data . LimitCode !== undefined && data . LimitCode !== null ) { contents . LimitCode = __expectString ( data . LimitCode ) ; } 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 ) ; } 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 , RetryAfterSeconds : 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 ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Fields : undefined , Message : undefined , Reason : undefined , } ; const data = parsedOutput . body ; if ( data . Fields !== undefined && data . Fields !== null ) { contents . Fields = deserializeAws_restJson1ValidationExceptionFieldList ( data . Fields , context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Reason !== undefined && data . Reason !== null ) { contents . Reason = __expectString ( data . Reason ) ; } return contents ; } ; const serializeAws_restJson1AWSLocation = ( input , context ) : any => { return { ... ( input . SubnetArn !== undefined && input . SubnetArn !== null && { SubnetArn : input . SubnetArn } ) , ... ( input . Zone !== undefined && input . Zone !== null && { Zone : input . Zone } ) , } ; } ; const serializeAws_restJson1Bandwidth = ( input , context ) : any => { return { ... ( input . DownloadSpeed !== undefined && input . DownloadSpeed !== null && { DownloadSpeed : input . DownloadSpeed } ) , ... ( input . UploadSpeed !== undefined && input . UploadSpeed !== null && { UploadSpeed : input . UploadSpeed } ) , } ; } ; const serializeAws_restJson1BgpOptions = ( input , context ) : any => { return { ... ( input . PeerAsn !== undefined && input . PeerAsn !== null && { PeerAsn : input . PeerAsn } ) , } ; } ; const serializeAws_restJson1ConnectAttachmentOptions = ( input , context ) : any => { return { ... ( input . Protocol !== undefined && input . Protocol !== null && { Protocol : input . Protocol } ) , } ; } ; const serializeAws_restJson1ConstrainedStringList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1CoreNetworkSegmentEdgeIdentifier = ( input , context ) : any => { return { ... ( input . CoreNetworkId !== undefined && input . CoreNetworkId !== null && { CoreNetworkId : input . CoreNetworkId } ) , ... ( input . EdgeLocation !== undefined && input . EdgeLocation !== null && { EdgeLocation : input . EdgeLocation } ) , ... ( input . SegmentName !== undefined && input . SegmentName !== null && { SegmentName : input . SegmentName } ) , } ; } ; const serializeAws_restJson1FilterMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1FilterValues ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1FilterValues = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Location = ( input , context ) : any => { return { ... ( input . Address !== undefined && input . Address !== null && { Address : input . Address } ) , ... ( input . Latitude !== undefined && input . Latitude !== null && { Latitude : input . Latitude } ) , ... ( input . Longitude !== undefined && input . Longitude !== null && { Longitude : input . Longitude } ) , } ; } ; const serializeAws_restJson1NetworkResourceMetadataMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1RouteAnalysisEndpointOptionsSpecification = ( input , context ) : any => { return { ... ( input . IpAddress !== undefined && input . IpAddress !== null && { IpAddress : input . IpAddress } ) , ... ( input . TransitGatewayAttachmentArn !== undefined && input . TransitGatewayAttachmentArn !== null && { TransitGatewayAttachmentArn : input . TransitGatewayAttachmentArn } ) , } ; } ; const serializeAws_restJson1RouteStateList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1RouteTableIdentifier = ( input , context ) : any => { return { ... ( input . CoreNetworkSegmentEdge !== undefined && input . CoreNetworkSegmentEdge !== null && { CoreNetworkSegmentEdge : serializeAws_restJson1CoreNetworkSegmentEdgeIdentifier ( input . CoreNetworkSegmentEdge , context ) , } ) , ... ( input . TransitGatewayRouteTableArn !== undefined && input . TransitGatewayRouteTableArn !== null && { TransitGatewayRouteTableArn : input . TransitGatewayRouteTableArn } ) , } ; } ; const serializeAws_restJson1RouteTypeList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SubnetArnList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1TagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const serializeAws_restJson1VpcOptions = ( input , context ) : any => { return { ... ( input . Ipv6Support !== undefined && input . Ipv6Support !== null && { Ipv6Support : input . Ipv6Support } ) , } ; } ; const deserializeAws_restJson1Attachment = ( output , context ) : Attachment => { return { AttachmentId : __expectString ( output . AttachmentId ) , AttachmentPolicyRuleNumber : __expectInt32 ( output . AttachmentPolicyRuleNumber ) , AttachmentType : __expectString ( output . AttachmentType ) , CoreNetworkArn : __expectString ( output . CoreNetworkArn ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , EdgeLocation : __expectString ( output . EdgeLocation ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , ProposedSegmentChange : output . ProposedSegmentChange !== undefined && output . ProposedSegmentChange !== null ? deserializeAws_restJson1ProposedSegmentChange ( output . ProposedSegmentChange , context ) : undefined , ResourceArn : __expectString ( output . ResourceArn ) , SegmentName : __expectString ( output . SegmentName ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedAt ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1AttachmentList = ( output , context ) : Attachment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Attachment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AWSLocation = ( output , context ) : AWSLocation => { return { SubnetArn : __expectString ( output . SubnetArn ) , Zone : __expectString ( output . Zone ) , } as any ; } ; const deserializeAws_restJson1Bandwidth = ( output , context ) : Bandwidth => { return { DownloadSpeed : __expectInt32 ( output . DownloadSpeed ) , UploadSpeed : __expectInt32 ( output . UploadSpeed ) , } as any ; } ; const deserializeAws_restJson1ConnectAttachment = ( output , context ) : ConnectAttachment => { return { Attachment : output . Attachment !== undefined && output . Attachment !== null ? deserializeAws_restJson1Attachment ( output . Attachment , context ) : undefined , Options : output . Options !== undefined && output . Options !== null ? deserializeAws_restJson1ConnectAttachmentOptions ( output . Options , context ) : undefined , TransportAttachmentId : __expectString ( output . TransportAttachmentId ) , } as any ; } ; const deserializeAws_restJson1ConnectAttachmentOptions = ( output , context ) : ConnectAttachmentOptions => { return { Protocol : __expectString ( output . Protocol ) , } as any ; } ; const deserializeAws_restJson1Connection = ( output , context ) : Connection => { return { ConnectedDeviceId : __expectString ( output . ConnectedDeviceId ) , ConnectedLinkId : __expectString ( output . ConnectedLinkId ) , ConnectionArn : __expectString ( output . ConnectionArn ) , ConnectionId : __expectString ( output . ConnectionId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkId : __expectString ( output . LinkId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ConnectionHealth = ( output , context ) : ConnectionHealth => { return { Status : __expectString ( output . Status ) , Timestamp : output . Timestamp !== undefined && output . Timestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . Timestamp ) ) ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1ConnectionList = ( output , context ) : Connection [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Connection ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ConnectPeer = ( output , context ) : ConnectPeer => { return { Configuration : output . Configuration !== undefined && output . Configuration !== null ? deserializeAws_restJson1ConnectPeerConfiguration ( output . Configuration , context ) : undefined , ConnectAttachmentId : __expectString ( output . ConnectAttachmentId ) , ConnectPeerId : __expectString ( output . ConnectPeerId ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , EdgeLocation : __expectString ( output . EdgeLocation ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ConnectPeerAssociation = ( output , context ) : ConnectPeerAssociation => { return { ConnectPeerId : __expectString ( output . ConnectPeerId ) , DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkId : __expectString ( output . LinkId ) , State : __expectString ( output . State ) , } as any ; } ; const deserializeAws_restJson1ConnectPeerAssociationList = ( output , context ) : ConnectPeerAssociation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ConnectPeerAssociation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ConnectPeerBgpConfiguration = ( output , context ) : ConnectPeerBgpConfiguration => { return { CoreNetworkAddress : __expectString ( output . CoreNetworkAddress ) , CoreNetworkAsn : __expectLong ( output . CoreNetworkAsn ) , PeerAddress : __expectString ( output . PeerAddress ) , PeerAsn : __expectLong ( output . PeerAsn ) , } as any ; } ; const deserializeAws_restJson1ConnectPeerBgpConfigurationList = ( output , context ) : ConnectPeerBgpConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ConnectPeerBgpConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ConnectPeerConfiguration = ( output , context ) : ConnectPeerConfiguration => { return { BgpConfigurations : output . BgpConfigurations !== undefined && output . BgpConfigurations !== null ? deserializeAws_restJson1ConnectPeerBgpConfigurationList ( output . BgpConfigurations , context ) : undefined , CoreNetworkAddress : __expectString ( output . CoreNetworkAddress ) , InsideCidrBlocks : output . InsideCidrBlocks !== undefined && output . InsideCidrBlocks !== null ? deserializeAws_restJson1ConstrainedStringList ( output . InsideCidrBlocks , context ) : undefined , PeerAddress : __expectString ( output . PeerAddress ) , Protocol : __expectString ( output . Protocol ) , } as any ; } ; const deserializeAws_restJson1ConnectPeerSummary = ( output , context ) : ConnectPeerSummary => { return { ConnectAttachmentId : __expectString ( output . ConnectAttachmentId ) , ConnectPeerId : __expectString ( output . ConnectPeerId ) , ConnectPeerState : __expectString ( output . ConnectPeerState ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , EdgeLocation : __expectString ( output . EdgeLocation ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ConnectPeerSummaryList = ( output , context ) : ConnectPeerSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ConnectPeerSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ConstrainedStringList = ( 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_restJson1CoreNetwork = ( output , context ) : CoreNetwork => { return { CoreNetworkArn : __expectString ( output . CoreNetworkArn ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , Edges : output . Edges !== undefined && output . Edges !== null ? deserializeAws_restJson1CoreNetworkEdgeList ( output . Edges , context ) : undefined , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , Segments : output . Segments !== undefined && output . Segments !== null ? deserializeAws_restJson1CoreNetworkSegmentList ( output . Segments , context ) : undefined , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CoreNetworkChange = ( output , context ) : CoreNetworkChange => { return { Action : __expectString ( output . Action ) , Identifier : __expectString ( output . Identifier ) , NewValues : output . NewValues !== undefined && output . NewValues !== null ? deserializeAws_restJson1CoreNetworkChangeValues ( output . NewValues , context ) : undefined , PreviousValues : output . PreviousValues !== undefined && output . PreviousValues !== null ? deserializeAws_restJson1CoreNetworkChangeValues ( output . PreviousValues , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1CoreNetworkChangeList = ( output , context ) : CoreNetworkChange [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkChange ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreNetworkChangeValues = ( output , context ) : CoreNetworkChangeValues => { return { Asn : __expectLong ( output . Asn ) , Cidr : __expectString ( output . Cidr ) , DestinationIdentifier : __expectString ( output . DestinationIdentifier ) , EdgeLocations : output . EdgeLocations !== undefined && output . EdgeLocations !== null ? deserializeAws_restJson1ExternalRegionCodeList ( output . EdgeLocations , context ) : undefined , InsideCidrBlocks : output . InsideCidrBlocks !== undefined && output . InsideCidrBlocks !== null ? deserializeAws_restJson1ConstrainedStringList ( output . InsideCidrBlocks , context ) : undefined , SegmentName : __expectString ( output . SegmentName ) , SharedSegments : output . SharedSegments !== undefined && output . SharedSegments !== null ? deserializeAws_restJson1ConstrainedStringList ( output . SharedSegments , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CoreNetworkEdge = ( output , context ) : CoreNetworkEdge => { return { Asn : __expectLong ( output . Asn ) , EdgeLocation : __expectString ( output . EdgeLocation ) , InsideCidrBlocks : output . InsideCidrBlocks !== undefined && output . InsideCidrBlocks !== null ? deserializeAws_restJson1ConstrainedStringList ( output . InsideCidrBlocks , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CoreNetworkEdgeList = ( output , context ) : CoreNetworkEdge [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkEdge ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreNetworkPolicy = ( output , context ) : CoreNetworkPolicy => { return { Alias : __expectString ( output . Alias ) , ChangeSetState : __expectString ( output . ChangeSetState ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , PolicyDocument : output . PolicyDocument !== undefined && output . PolicyDocument !== null ? new __LazyJsonString ( output . PolicyDocument ) : undefined , PolicyErrors : output . PolicyErrors !== undefined && output . PolicyErrors !== null ? deserializeAws_restJson1CoreNetworkPolicyErrorList ( output . PolicyErrors , context ) : undefined , PolicyVersionId : __expectInt32 ( output . PolicyVersionId ) , } as any ; } ; const deserializeAws_restJson1CoreNetworkPolicyError = ( output , context ) : CoreNetworkPolicyError => { return { ErrorCode : __expectString ( output . ErrorCode ) , Message : __expectString ( output . Message ) , Path : __expectString ( output . Path ) , } as any ; } ; const deserializeAws_restJson1CoreNetworkPolicyErrorList = ( output , context ) : CoreNetworkPolicyError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkPolicyError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreNetworkPolicyVersion = ( output , context ) : CoreNetworkPolicyVersion => { return { Alias : __expectString ( output . Alias ) , ChangeSetState : __expectString ( output . ChangeSetState ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , PolicyVersionId : __expectInt32 ( output . PolicyVersionId ) , } as any ; } ; const deserializeAws_restJson1CoreNetworkPolicyVersionList = ( output , context ) : CoreNetworkPolicyVersion [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkPolicyVersion ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreNetworkSegment = ( output , context ) : CoreNetworkSegment => { return { EdgeLocations : output . EdgeLocations !== undefined && output . EdgeLocations !== null ? deserializeAws_restJson1ExternalRegionCodeList ( output . EdgeLocations , context ) : undefined , Name : __expectString ( output . Name ) , SharedSegments : output . SharedSegments !== undefined && output . SharedSegments !== null ? deserializeAws_restJson1ConstrainedStringList ( output . SharedSegments , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CoreNetworkSegmentEdgeIdentifier = ( output , context ) : CoreNetworkSegmentEdgeIdentifier => { return { CoreNetworkId : __expectString ( output . CoreNetworkId ) , EdgeLocation : __expectString ( output . EdgeLocation ) , SegmentName : __expectString ( output . SegmentName ) , } as any ; } ; const deserializeAws_restJson1CoreNetworkSegmentList = ( output , context ) : CoreNetworkSegment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkSegment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreNetworkSummary = ( output , context ) : CoreNetworkSummary => { return { CoreNetworkArn : __expectString ( output . CoreNetworkArn ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , Description : __expectString ( output . Description ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CoreNetworkSummaryList = ( output , context ) : CoreNetworkSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreNetworkSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CustomerGatewayAssociation = ( output , context ) : CustomerGatewayAssociation => { return { CustomerGatewayArn : __expectString ( output . CustomerGatewayArn ) , DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkId : __expectString ( output . LinkId ) , State : __expectString ( output . State ) , } as any ; } ; const deserializeAws_restJson1CustomerGatewayAssociationList = ( output , context ) : CustomerGatewayAssociation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CustomerGatewayAssociation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Device = ( output , context ) : Device => { return { AWSLocation : output . AWSLocation !== undefined && output . AWSLocation !== null ? deserializeAws_restJson1AWSLocation ( output . AWSLocation , context ) : undefined , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , DeviceArn : __expectString ( output . DeviceArn ) , DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , Location : output . Location !== undefined && output . Location !== null ? deserializeAws_restJson1Location ( output . Location , context ) : undefined , Model : __expectString ( output . Model ) , SerialNumber : __expectString ( output . SerialNumber ) , SiteId : __expectString ( output . SiteId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , Type : __expectString ( output . Type ) , Vendor : __expectString ( output . Vendor ) , } as any ; } ; const deserializeAws_restJson1DeviceList = ( output , context ) : Device [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Device ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ExceptionContextMap = ( 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_restJson1ExternalRegionCodeList = ( 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_restJson1GlobalNetwork = ( output , context ) : GlobalNetwork => { return { CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , GlobalNetworkArn : __expectString ( output . GlobalNetworkArn ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1GlobalNetworkList = ( output , context ) : GlobalNetwork [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1GlobalNetwork ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Link = ( output , context ) : Link => { return { Bandwidth : output . Bandwidth !== undefined && output . Bandwidth !== null ? deserializeAws_restJson1Bandwidth ( output . Bandwidth , context ) : undefined , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkArn : __expectString ( output . LinkArn ) , LinkId : __expectString ( output . LinkId ) , Provider : __expectString ( output . Provider ) , SiteId : __expectString ( output . SiteId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1LinkAssociation = ( output , context ) : LinkAssociation => { return { DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkAssociationState : __expectString ( output . LinkAssociationState ) , LinkId : __expectString ( output . LinkId ) , } as any ; } ; const deserializeAws_restJson1LinkAssociationList = ( output , context ) : LinkAssociation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1LinkAssociation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LinkList = ( output , context ) : Link [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Link ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Location = ( output , context ) : Location => { return { Address : __expectString ( output . Address ) , Latitude : __expectString ( output . Latitude ) , Longitude : __expectString ( output . Longitude ) , } as any ; } ; const deserializeAws_restJson1NetworkResource = ( output , context ) : NetworkResource => { return { AccountId : __expectString ( output . AccountId ) , AwsRegion : __expectString ( output . AwsRegion ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , Definition : __expectString ( output . Definition ) , DefinitionTimestamp : output . DefinitionTimestamp !== undefined && output . DefinitionTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . DefinitionTimestamp ) ) ) : undefined , Metadata : output . Metadata !== undefined && output . Metadata !== null ? deserializeAws_restJson1NetworkResourceMetadataMap ( output . Metadata , context ) : undefined , RegisteredGatewayArn : __expectString ( output . RegisteredGatewayArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceId : __expectString ( output . ResourceId ) , ResourceType : __expectString ( output . ResourceType ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1NetworkResourceCount = ( output , context ) : NetworkResourceCount => { return { Count : __expectInt32 ( output . Count ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1NetworkResourceCountList = ( output , context ) : NetworkResourceCount [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkResourceCount ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NetworkResourceList = ( output , context ) : NetworkResource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkResource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NetworkResourceMetadataMap = ( 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_restJson1NetworkResourceSummary = ( output , context ) : NetworkResourceSummary => { return { Definition : __expectString ( output . Definition ) , IsMiddlebox : __expectBoolean ( output . IsMiddlebox ) , NameTag : __expectString ( output . NameTag ) , RegisteredGatewayArn : __expectString ( output . RegisteredGatewayArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1NetworkRoute = ( output , context ) : NetworkRoute => { return { DestinationCidrBlock : __expectString ( output . DestinationCidrBlock ) , Destinations : output . Destinations !== undefined && output . Destinations !== null ? deserializeAws_restJson1NetworkRouteDestinationList ( output . Destinations , context ) : undefined , PrefixListId : __expectString ( output . PrefixListId ) , State : __expectString ( output . State ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1NetworkRouteDestination = ( output , context ) : NetworkRouteDestination => { return { CoreNetworkAttachmentId : __expectString ( output . CoreNetworkAttachmentId ) , EdgeLocation : __expectString ( output . EdgeLocation ) , ResourceId : __expectString ( output . ResourceId ) , ResourceType : __expectString ( output . ResourceType ) , SegmentName : __expectString ( output . SegmentName ) , TransitGatewayAttachmentId : __expectString ( output . TransitGatewayAttachmentId ) , } as any ; } ; const deserializeAws_restJson1NetworkRouteDestinationList = ( output , context ) : NetworkRouteDestination [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkRouteDestination ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NetworkRouteList = ( output , context ) : NetworkRoute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkRoute ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NetworkTelemetry = ( output , context ) : NetworkTelemetry => { return { AccountId : __expectString ( output . AccountId ) , Address : __expectString ( output . Address ) , AwsRegion : __expectString ( output . AwsRegion ) , CoreNetworkId : __expectString ( output . CoreNetworkId ) , Health : output . Health !== undefined && output . Health !== null ? deserializeAws_restJson1ConnectionHealth ( output . Health , context ) : undefined , RegisteredGatewayArn : __expectString ( output . RegisteredGatewayArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceId : __expectString ( output . ResourceId ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1NetworkTelemetryList = ( output , context ) : NetworkTelemetry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkTelemetry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PathComponent = ( output , context ) : PathComponent => { return { DestinationCidrBlock : __expectString ( output . DestinationCidrBlock ) , Resource : output . Resource !== undefined && output . Resource !== null ? deserializeAws_restJson1NetworkResourceSummary ( output . Resource , context ) : undefined , Sequence : __expectInt32 ( output . Sequence ) , } as any ; } ; const deserializeAws_restJson1PathComponentList = ( output , context ) : PathComponent [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PathComponent ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ProposedSegmentChange = ( output , context ) : ProposedSegmentChange => { return { AttachmentPolicyRuleNumber : __expectInt32 ( output . AttachmentPolicyRuleNumber ) , SegmentName : __expectString ( output . SegmentName ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ReasonContextMap = ( 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_restJson1Relationship = ( output , context ) : Relationship => { return { From : __expectString ( output . From ) , To : __expectString ( output . To ) , } as any ; } ; const deserializeAws_restJson1RelationshipList = ( output , context ) : Relationship [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Relationship ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RouteAnalysis = ( output , context ) : RouteAnalysis => { return { Destination : output . Destination !== undefined && output . Destination !== null ? deserializeAws_restJson1RouteAnalysisEndpointOptions ( output . Destination , context ) : undefined , ForwardPath : output . ForwardPath !== undefined && output . ForwardPath !== null ? deserializeAws_restJson1RouteAnalysisPath ( output . ForwardPath , context ) : undefined , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , IncludeReturnPath : __expectBoolean ( output . IncludeReturnPath ) , OwnerAccountId : __expectString ( output . OwnerAccountId ) , ReturnPath : output . ReturnPath !== undefined && output . ReturnPath !== null ? deserializeAws_restJson1RouteAnalysisPath ( output . ReturnPath , context ) : undefined , RouteAnalysisId : __expectString ( output . RouteAnalysisId ) , Source : output . Source !== undefined && output . Source !== null ? deserializeAws_restJson1RouteAnalysisEndpointOptions ( output . Source , context ) : undefined , StartTimestamp : output . StartTimestamp !== undefined && output . StartTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . StartTimestamp ) ) ) : undefined , Status : __expectString ( output . Status ) , UseMiddleboxes : __expectBoolean ( output . UseMiddleboxes ) , } as any ; } ; const deserializeAws_restJson1RouteAnalysisCompletion = ( output , context ) : RouteAnalysisCompletion => { return { ReasonCode : __expectString ( output . ReasonCode ) , ReasonContext : output . ReasonContext !== undefined && output . ReasonContext !== null ? deserializeAws_restJson1ReasonContextMap ( output . ReasonContext , context ) : undefined , ResultCode : __expectString ( output . ResultCode ) , } as any ; } ; const deserializeAws_restJson1RouteAnalysisEndpointOptions = ( output , context ) : RouteAnalysisEndpointOptions => { return { IpAddress : __expectString ( output . IpAddress ) , TransitGatewayArn : __expectString ( output . TransitGatewayArn ) , TransitGatewayAttachmentArn : __expectString ( output . TransitGatewayAttachmentArn ) , } as any ; } ; const deserializeAws_restJson1RouteAnalysisPath = ( output , context ) : RouteAnalysisPath => { return { CompletionStatus : output . CompletionStatus !== undefined && output . CompletionStatus !== null ? deserializeAws_restJson1RouteAnalysisCompletion ( output . CompletionStatus , context ) : undefined , Path : output . Path !== undefined && output . Path !== null ? deserializeAws_restJson1PathComponentList ( output . Path , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Site = ( output , context ) : Site => { return { CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Description : __expectString ( output . Description ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , Location : output . Location !== undefined && output . Location !== null ? deserializeAws_restJson1Location ( output . Location , context ) : undefined , SiteArn : __expectString ( output . SiteArn ) , SiteId : __expectString ( output . SiteId ) , State : __expectString ( output . State ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SiteList = ( output , context ) : Site [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Site ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SiteToSiteVpnAttachment = ( output , context ) : SiteToSiteVpnAttachment => { return { Attachment : output . Attachment !== undefined && output . Attachment !== null ? deserializeAws_restJson1Attachment ( output . Attachment , context ) : undefined , VpnConnectionArn : __expectString ( output . VpnConnectionArn ) , } as any ; } ; const deserializeAws_restJson1SubnetArnList = ( 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_restJson1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_restJson1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TransitGatewayConnectPeerAssociation = ( output , context ) : TransitGatewayConnectPeerAssociation => { return { DeviceId : __expectString ( output . DeviceId ) , GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , LinkId : __expectString ( output . LinkId ) , State : __expectString ( output . State ) , TransitGatewayConnectPeerArn : __expectString ( output . TransitGatewayConnectPeerArn ) , } as any ; } ; const deserializeAws_restJson1TransitGatewayConnectPeerAssociationList = ( output , context ) : TransitGatewayConnectPeerAssociation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TransitGatewayConnectPeerAssociation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TransitGatewayRegistration = ( output , context ) : TransitGatewayRegistration => { return { GlobalNetworkId : __expectString ( output . GlobalNetworkId ) , State : output . State !== undefined && output . State !== null ? deserializeAws_restJson1TransitGatewayRegistrationStateReason ( output . State , context ) : undefined , TransitGatewayArn : __expectString ( output . TransitGatewayArn ) , } as any ; } ; const deserializeAws_restJson1TransitGatewayRegistrationList = ( output , context ) : TransitGatewayRegistration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TransitGatewayRegistration ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TransitGatewayRegistrationStateReason = ( output , context ) : TransitGatewayRegistrationStateReason => { return { Code : __expectString ( output . Code ) , Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionField = ( output , context ) : ValidationExceptionField => { return { Message : __expectString ( output . Message ) , Name : __expectString ( output . Name ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionFieldList = ( output , context ) : ValidationExceptionField [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ValidationExceptionField ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1VpcAttachment = ( output , context ) : VpcAttachment => { return { Attachment : output . Attachment !== undefined && output . Attachment !== null ? deserializeAws_restJson1Attachment ( output . Attachment , context ) : undefined , Options : output . Options !== undefined && output . Options !== null ? deserializeAws_restJson1VpcOptions ( output . Options , context ) : undefined , SubnetArns : output . SubnetArns !== undefined && output . SubnetArns !== null ? deserializeAws_restJson1SubnetArnList ( output . SubnetArns , context ) : undefined , } as any ; } ; const deserializeAws_restJson1VpcOptions = ( output , context ) : VpcOptions => { return { Ipv6Support : __expectBoolean ( output . Ipv6Support ) , } 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 "" ; } ;