import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectLong as __expectLong , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , strictParseLong as __strictParseLong , } 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 { ChangeServerLifeCycleStateCommandInput , ChangeServerLifeCycleStateCommandOutput , } from "../commands/ChangeServerLifeCycleStateCommand" ; import { CreateReplicationConfigurationTemplateCommandInput , CreateReplicationConfigurationTemplateCommandOutput , } from "../commands/CreateReplicationConfigurationTemplateCommand" ; import { DeleteJobCommandInput , DeleteJobCommandOutput } from "../commands/DeleteJobCommand" ; import { DeleteReplicationConfigurationTemplateCommandInput , DeleteReplicationConfigurationTemplateCommandOutput , } from "../commands/DeleteReplicationConfigurationTemplateCommand" ; import { DeleteSourceServerCommandInput , DeleteSourceServerCommandOutput } from "../commands/DeleteSourceServerCommand" ; import { DeleteVcenterClientCommandInput , DeleteVcenterClientCommandOutput , } from "../commands/DeleteVcenterClientCommand" ; import { DescribeJobLogItemsCommandInput , DescribeJobLogItemsCommandOutput , } from "../commands/DescribeJobLogItemsCommand" ; import { DescribeJobsCommandInput , DescribeJobsCommandOutput } from "../commands/DescribeJobsCommand" ; import { DescribeReplicationConfigurationTemplatesCommandInput , DescribeReplicationConfigurationTemplatesCommandOutput , } from "../commands/DescribeReplicationConfigurationTemplatesCommand" ; import { DescribeSourceServersCommandInput , DescribeSourceServersCommandOutput , } from "../commands/DescribeSourceServersCommand" ; import { DescribeVcenterClientsCommandInput , DescribeVcenterClientsCommandOutput , } from "../commands/DescribeVcenterClientsCommand" ; import { DisconnectFromServiceCommandInput , DisconnectFromServiceCommandOutput , } from "../commands/DisconnectFromServiceCommand" ; import { FinalizeCutoverCommandInput , FinalizeCutoverCommandOutput } from "../commands/FinalizeCutoverCommand" ; import { GetLaunchConfigurationCommandInput , GetLaunchConfigurationCommandOutput , } from "../commands/GetLaunchConfigurationCommand" ; import { GetReplicationConfigurationCommandInput , GetReplicationConfigurationCommandOutput , } from "../commands/GetReplicationConfigurationCommand" ; import { InitializeServiceCommandInput , InitializeServiceCommandOutput } from "../commands/InitializeServiceCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { MarkAsArchivedCommandInput , MarkAsArchivedCommandOutput } from "../commands/MarkAsArchivedCommand" ; import { RetryDataReplicationCommandInput , RetryDataReplicationCommandOutput , } from "../commands/RetryDataReplicationCommand" ; import { StartCutoverCommandInput , StartCutoverCommandOutput } from "../commands/StartCutoverCommand" ; import { StartReplicationCommandInput , StartReplicationCommandOutput } from "../commands/StartReplicationCommand" ; import { StartTestCommandInput , StartTestCommandOutput } from "../commands/StartTestCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { TerminateTargetInstancesCommandInput , TerminateTargetInstancesCommandOutput , } from "../commands/TerminateTargetInstancesCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateLaunchConfigurationCommandInput , UpdateLaunchConfigurationCommandOutput , } from "../commands/UpdateLaunchConfigurationCommand" ; import { UpdateReplicationConfigurationCommandInput , UpdateReplicationConfigurationCommandOutput , } from "../commands/UpdateReplicationConfigurationCommand" ; import { UpdateReplicationConfigurationTemplateCommandInput , UpdateReplicationConfigurationTemplateCommandOutput , } from "../commands/UpdateReplicationConfigurationTemplateCommand" ; import { UpdateSourceServerReplicationTypeCommandInput , UpdateSourceServerReplicationTypeCommandOutput , } from "../commands/UpdateSourceServerReplicationTypeCommand" ; import { AccessDeniedException , ChangeServerLifeCycleStateSourceServerLifecycle , ConflictException , CPU , DataReplicationError , DataReplicationInfo , DataReplicationInfoReplicatedDisk , DataReplicationInitiation , DataReplicationInitiationStep , DescribeJobsRequestFilters , DescribeSourceServersRequestFilters , Disk , IdentificationHints , InternalServerException , Job , JobLog , JobLogEventData , LaunchedInstance , Licensing , LifeCycle , LifeCycleLastCutover , LifeCycleLastCutoverFinalized , LifeCycleLastCutoverInitiated , LifeCycleLastCutoverReverted , LifeCycleLastTest , LifeCycleLastTestFinalized , LifeCycleLastTestInitiated , LifeCycleLastTestReverted , LifeCycleState , NetworkInterface , OS , ParticipatingServer , ReplicationConfigurationReplicatedDisk , ReplicationConfigurationTemplate , ReplicationType , ResourceNotFoundException , ServiceQuotaExceededException , SourceProperties , SourceServer , ThrottlingException , UninitializedAccountException , ValidationException , ValidationExceptionField , VcenterClient , } from "../models/models_0" ; export const serializeAws_restJson1ChangeServerLifeCycleStateCommand = 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 || "" }` + "/ChangeServerLifeCycleState" ; let body ; body = JSON . stringify ( { ... ( input . lifeCycle !== undefined && input . lifeCycle !== null && { lifeCycle : serializeAws_restJson1ChangeServerLifeCycleStateSourceServerLifecycle ( input . lifeCycle , context ) , } ) , ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateReplicationConfigurationTemplateCommand = 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 || "" }` + "/CreateReplicationConfigurationTemplate" ; let body ; body = JSON . stringify ( { ... ( input . associateDefaultSecurityGroup !== undefined && input . associateDefaultSecurityGroup !== null && { associateDefaultSecurityGroup : input . associateDefaultSecurityGroup , } ) , ... ( input . bandwidthThrottling !== undefined && input . bandwidthThrottling !== null && { bandwidthThrottling : input . bandwidthThrottling } ) , ... ( input . createPublicIP !== undefined && input . createPublicIP !== null && { createPublicIP : input . createPublicIP } ) , ... ( input . dataPlaneRouting !== undefined && input . dataPlaneRouting !== null && { dataPlaneRouting : input . dataPlaneRouting } ) , ... ( input . defaultLargeStagingDiskType !== undefined && input . defaultLargeStagingDiskType !== null && { defaultLargeStagingDiskType : input . defaultLargeStagingDiskType } ) , ... ( input . ebsEncryption !== undefined && input . ebsEncryption !== null && { ebsEncryption : input . ebsEncryption } ) , ... ( input . ebsEncryptionKeyArn !== undefined && input . ebsEncryptionKeyArn !== null && { ebsEncryptionKeyArn : input . ebsEncryptionKeyArn } ) , ... ( input . replicationServerInstanceType !== undefined && input . replicationServerInstanceType !== null && { replicationServerInstanceType : input . replicationServerInstanceType , } ) , ... ( input . replicationServersSecurityGroupsIDs !== undefined && input . replicationServersSecurityGroupsIDs !== null && { replicationServersSecurityGroupsIDs : serializeAws_restJson1ReplicationServersSecurityGroupsIDs ( input . replicationServersSecurityGroupsIDs , context ) , } ) , ... ( input . stagingAreaSubnetId !== undefined && input . stagingAreaSubnetId !== null && { stagingAreaSubnetId : input . stagingAreaSubnetId } ) , ... ( input . stagingAreaTags !== undefined && input . stagingAreaTags !== null && { stagingAreaTags : serializeAws_restJson1TagsMap ( input . stagingAreaTags , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagsMap ( input . tags , context ) } ) , ... ( input . useDedicatedReplicationServer !== undefined && input . useDedicatedReplicationServer !== null && { useDedicatedReplicationServer : input . useDedicatedReplicationServer , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteJobCommand = 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 || "" }` + "/DeleteJob" ; let body ; body = JSON . stringify ( { ... ( input . jobID !== undefined && input . jobID !== null && { jobID : input . jobID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteReplicationConfigurationTemplateCommand = 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 || "" }` + "/DeleteReplicationConfigurationTemplate" ; let body ; body = JSON . stringify ( { ... ( input . replicationConfigurationTemplateID !== undefined && input . replicationConfigurationTemplateID !== null && { replicationConfigurationTemplateID : input . replicationConfigurationTemplateID , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSourceServerCommand = 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 || "" }` + "/DeleteSourceServer" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteVcenterClientCommand = 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 || "" }` + "/DeleteVcenterClient" ; let body ; body = JSON . stringify ( { ... ( input . vcenterClientID !== undefined && input . vcenterClientID !== null && { vcenterClientID : input . vcenterClientID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeJobLogItemsCommand = 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 || "" }` + "/DescribeJobLogItems" ; let body ; body = JSON . stringify ( { ... ( input . jobID !== undefined && input . jobID !== null && { jobID : input . jobID } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeJobsCommand = 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 || "" }` + "/DescribeJobs" ; let body ; body = JSON . stringify ( { ... ( input . filters !== undefined && input . filters !== null && { filters : serializeAws_restJson1DescribeJobsRequestFilters ( input . filters , context ) } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeReplicationConfigurationTemplatesCommand = 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 || "" }` + "/DescribeReplicationConfigurationTemplates" ; let body ; body = JSON . stringify ( { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . replicationConfigurationTemplateIDs !== undefined && input . replicationConfigurationTemplateIDs !== null && { replicationConfigurationTemplateIDs : serializeAws_restJson1ReplicationConfigurationTemplateIDs ( input . replicationConfigurationTemplateIDs , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeSourceServersCommand = 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 || "" }` + "/DescribeSourceServers" ; let body ; body = JSON . stringify ( { ... ( input . filters !== undefined && input . filters !== null && { filters : serializeAws_restJson1DescribeSourceServersRequestFilters ( input . filters , context ) , } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeVcenterClientsCommand = 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 || "" }` + "/DescribeVcenterClients" ; 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_restJson1DisconnectFromServiceCommand = 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 || "" }` + "/DisconnectFromService" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1FinalizeCutoverCommand = 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 || "" }` + "/FinalizeCutover" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetLaunchConfigurationCommand = 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 || "" }` + "/GetLaunchConfiguration" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetReplicationConfigurationCommand = 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 || "" }` + "/GetReplicationConfiguration" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1InitializeServiceCommand = 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 || "" }` + "/InitializeService" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , 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_restJson1MarkAsArchivedCommand = 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 || "" }` + "/MarkAsArchived" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RetryDataReplicationCommand = 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 || "" }` + "/RetryDataReplication" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartCutoverCommand = 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 || "" }` + "/StartCutover" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerIDs !== undefined && input . sourceServerIDs !== null && { sourceServerIDs : serializeAws_restJson1StartCutoverRequestSourceServerIDs ( input . sourceServerIDs , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagsMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartReplicationCommand = 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 || "" }` + "/StartReplication" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartTestCommand = 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 || "" }` + "/StartTest" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerIDs !== undefined && input . sourceServerIDs !== null && { sourceServerIDs : serializeAws_restJson1StartTestRequestSourceServerIDs ( input . sourceServerIDs , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagsMap ( input . tags , context ) } ) , } ) ; 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_restJson1TagsMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TerminateTargetInstancesCommand = 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 || "" }` + "/TerminateTargetInstances" ; let body ; body = JSON . stringify ( { ... ( input . sourceServerIDs !== undefined && input . sourceServerIDs !== null && { sourceServerIDs : serializeAws_restJson1TerminateTargetInstancesRequestSourceServerIDs ( input . sourceServerIDs , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagsMap ( 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_restJson1UpdateLaunchConfigurationCommand = 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 || "" }` + "/UpdateLaunchConfiguration" ; let body ; body = JSON . stringify ( { ... ( input . copyPrivateIp !== undefined && input . copyPrivateIp !== null && { copyPrivateIp : input . copyPrivateIp } ) , ... ( input . copyTags !== undefined && input . copyTags !== null && { copyTags : input . copyTags } ) , ... ( input . launchDisposition !== undefined && input . launchDisposition !== null && { launchDisposition : input . launchDisposition } ) , ... ( input . licensing !== undefined && input . licensing !== null && { licensing : serializeAws_restJson1Licensing ( input . licensing , context ) } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , ... ( input . targetInstanceTypeRightSizingMethod !== undefined && input . targetInstanceTypeRightSizingMethod !== null && { targetInstanceTypeRightSizingMethod : input . targetInstanceTypeRightSizingMethod , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateReplicationConfigurationCommand = 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 || "" }` + "/UpdateReplicationConfiguration" ; let body ; body = JSON . stringify ( { ... ( input . associateDefaultSecurityGroup !== undefined && input . associateDefaultSecurityGroup !== null && { associateDefaultSecurityGroup : input . associateDefaultSecurityGroup , } ) , ... ( input . bandwidthThrottling !== undefined && input . bandwidthThrottling !== null && { bandwidthThrottling : input . bandwidthThrottling } ) , ... ( input . createPublicIP !== undefined && input . createPublicIP !== null && { createPublicIP : input . createPublicIP } ) , ... ( input . dataPlaneRouting !== undefined && input . dataPlaneRouting !== null && { dataPlaneRouting : input . dataPlaneRouting } ) , ... ( input . defaultLargeStagingDiskType !== undefined && input . defaultLargeStagingDiskType !== null && { defaultLargeStagingDiskType : input . defaultLargeStagingDiskType } ) , ... ( input . ebsEncryption !== undefined && input . ebsEncryption !== null && { ebsEncryption : input . ebsEncryption } ) , ... ( input . ebsEncryptionKeyArn !== undefined && input . ebsEncryptionKeyArn !== null && { ebsEncryptionKeyArn : input . ebsEncryptionKeyArn } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . replicatedDisks !== undefined && input . replicatedDisks !== null && { replicatedDisks : serializeAws_restJson1ReplicationConfigurationReplicatedDisks ( input . replicatedDisks , context ) , } ) , ... ( input . replicationServerInstanceType !== undefined && input . replicationServerInstanceType !== null && { replicationServerInstanceType : input . replicationServerInstanceType , } ) , ... ( input . replicationServersSecurityGroupsIDs !== undefined && input . replicationServersSecurityGroupsIDs !== null && { replicationServersSecurityGroupsIDs : serializeAws_restJson1ReplicationServersSecurityGroupsIDs ( input . replicationServersSecurityGroupsIDs , context ) , } ) , ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , ... ( input . stagingAreaSubnetId !== undefined && input . stagingAreaSubnetId !== null && { stagingAreaSubnetId : input . stagingAreaSubnetId } ) , ... ( input . stagingAreaTags !== undefined && input . stagingAreaTags !== null && { stagingAreaTags : serializeAws_restJson1TagsMap ( input . stagingAreaTags , context ) , } ) , ... ( input . useDedicatedReplicationServer !== undefined && input . useDedicatedReplicationServer !== null && { useDedicatedReplicationServer : input . useDedicatedReplicationServer , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateReplicationConfigurationTemplateCommand = 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 || "" }` + "/UpdateReplicationConfigurationTemplate" ; let body ; body = JSON . stringify ( { ... ( input . arn !== undefined && input . arn !== null && { arn : input . arn } ) , ... ( input . associateDefaultSecurityGroup !== undefined && input . associateDefaultSecurityGroup !== null && { associateDefaultSecurityGroup : input . associateDefaultSecurityGroup , } ) , ... ( input . bandwidthThrottling !== undefined && input . bandwidthThrottling !== null && { bandwidthThrottling : input . bandwidthThrottling } ) , ... ( input . createPublicIP !== undefined && input . createPublicIP !== null && { createPublicIP : input . createPublicIP } ) , ... ( input . dataPlaneRouting !== undefined && input . dataPlaneRouting !== null && { dataPlaneRouting : input . dataPlaneRouting } ) , ... ( input . defaultLargeStagingDiskType !== undefined && input . defaultLargeStagingDiskType !== null && { defaultLargeStagingDiskType : input . defaultLargeStagingDiskType } ) , ... ( input . ebsEncryption !== undefined && input . ebsEncryption !== null && { ebsEncryption : input . ebsEncryption } ) , ... ( input . ebsEncryptionKeyArn !== undefined && input . ebsEncryptionKeyArn !== null && { ebsEncryptionKeyArn : input . ebsEncryptionKeyArn } ) , ... ( input . replicationConfigurationTemplateID !== undefined && input . replicationConfigurationTemplateID !== null && { replicationConfigurationTemplateID : input . replicationConfigurationTemplateID , } ) , ... ( input . replicationServerInstanceType !== undefined && input . replicationServerInstanceType !== null && { replicationServerInstanceType : input . replicationServerInstanceType , } ) , ... ( input . replicationServersSecurityGroupsIDs !== undefined && input . replicationServersSecurityGroupsIDs !== null && { replicationServersSecurityGroupsIDs : serializeAws_restJson1ReplicationServersSecurityGroupsIDs ( input . replicationServersSecurityGroupsIDs , context ) , } ) , ... ( input . stagingAreaSubnetId !== undefined && input . stagingAreaSubnetId !== null && { stagingAreaSubnetId : input . stagingAreaSubnetId } ) , ... ( input . stagingAreaTags !== undefined && input . stagingAreaTags !== null && { stagingAreaTags : serializeAws_restJson1TagsMap ( input . stagingAreaTags , context ) , } ) , ... ( input . useDedicatedReplicationServer !== undefined && input . useDedicatedReplicationServer !== null && { useDedicatedReplicationServer : input . useDedicatedReplicationServer , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSourceServerReplicationTypeCommand = 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 || "" }` + "/UpdateSourceServerReplicationType" ; let body ; body = JSON . stringify ( { ... ( input . replicationType !== undefined && input . replicationType !== null && { replicationType : input . replicationType } ) , ... ( input . sourceServerID !== undefined && input . sourceServerID !== null && { sourceServerID : input . sourceServerID } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1ChangeServerLifeCycleStateCommand = async ( output , context ) : Promise < ChangeServerLifeCycleStateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ChangeServerLifeCycleStateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ChangeServerLifeCycleStateCommandError = async ( output , context ) : Promise < ChangeServerLifeCycleStateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1CreateReplicationConfigurationTemplateCommand = async ( output , context ) : Promise < CreateReplicationConfigurationTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , associateDefaultSecurityGroup : undefined , bandwidthThrottling : undefined , createPublicIP : undefined , dataPlaneRouting : undefined , defaultLargeStagingDiskType : undefined , ebsEncryption : undefined , ebsEncryptionKeyArn : undefined , replicationConfigurationTemplateID : undefined , replicationServerInstanceType : undefined , replicationServersSecurityGroupsIDs : undefined , stagingAreaSubnetId : undefined , stagingAreaTags : undefined , tags : undefined , useDedicatedReplicationServer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . associateDefaultSecurityGroup !== undefined && data . associateDefaultSecurityGroup !== null ) { contents . associateDefaultSecurityGroup = __expectBoolean ( data . associateDefaultSecurityGroup ) ; } if ( data . bandwidthThrottling !== undefined && data . bandwidthThrottling !== null ) { contents . bandwidthThrottling = __expectLong ( data . bandwidthThrottling ) ; } if ( data . createPublicIP !== undefined && data . createPublicIP !== null ) { contents . createPublicIP = __expectBoolean ( data . createPublicIP ) ; } if ( data . dataPlaneRouting !== undefined && data . dataPlaneRouting !== null ) { contents . dataPlaneRouting = __expectString ( data . dataPlaneRouting ) ; } if ( data . defaultLargeStagingDiskType !== undefined && data . defaultLargeStagingDiskType !== null ) { contents . defaultLargeStagingDiskType = __expectString ( data . defaultLargeStagingDiskType ) ; } if ( data . ebsEncryption !== undefined && data . ebsEncryption !== null ) { contents . ebsEncryption = __expectString ( data . ebsEncryption ) ; } if ( data . ebsEncryptionKeyArn !== undefined && data . ebsEncryptionKeyArn !== null ) { contents . ebsEncryptionKeyArn = __expectString ( data . ebsEncryptionKeyArn ) ; } if ( data . replicationConfigurationTemplateID !== undefined && data . replicationConfigurationTemplateID !== null ) { contents . replicationConfigurationTemplateID = __expectString ( data . replicationConfigurationTemplateID ) ; } if ( data . replicationServerInstanceType !== undefined && data . replicationServerInstanceType !== null ) { contents . replicationServerInstanceType = __expectString ( data . replicationServerInstanceType ) ; } if ( data . replicationServersSecurityGroupsIDs !== undefined && data . replicationServersSecurityGroupsIDs !== null ) { contents . replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs ( data . replicationServersSecurityGroupsIDs , context ) ; } if ( data . stagingAreaSubnetId !== undefined && data . stagingAreaSubnetId !== null ) { contents . stagingAreaSubnetId = __expectString ( data . stagingAreaSubnetId ) ; } if ( data . stagingAreaTags !== undefined && data . stagingAreaTags !== null ) { contents . stagingAreaTags = deserializeAws_restJson1TagsMap ( data . stagingAreaTags , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . useDedicatedReplicationServer !== undefined && data . useDedicatedReplicationServer !== null ) { contents . useDedicatedReplicationServer = __expectBoolean ( data . useDedicatedReplicationServer ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError = async ( output , context ) : Promise < CreateReplicationConfigurationTemplateCommandOutput > => { 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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DeleteJobCommand = async ( output , context ) : Promise < DeleteJobCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteJobCommandError = async ( output , context ) : Promise < DeleteJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommand = async ( output , context ) : Promise < DeleteReplicationConfigurationTemplateCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError = async ( output , context ) : Promise < DeleteReplicationConfigurationTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteSourceServerCommand = async ( output , context ) : Promise < DeleteSourceServerCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSourceServerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSourceServerCommandError = async ( output , context ) : Promise < DeleteSourceServerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteVcenterClientCommand = async ( output , context ) : Promise < DeleteVcenterClientCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteVcenterClientCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteVcenterClientCommandError = async ( output , context ) : Promise < DeleteVcenterClientCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DescribeJobLogItemsCommand = async ( output , context ) : Promise < DescribeJobLogItemsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeJobLogItemsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . items !== undefined && data . items !== null ) { contents . items = deserializeAws_restJson1JobLogs ( data . items , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeJobLogItemsCommandError = async ( output , context ) : Promise < DescribeJobLogItemsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DescribeJobsCommand = async ( output , context ) : Promise < DescribeJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . items !== undefined && data . items !== null ) { contents . items = deserializeAws_restJson1JobsList ( data . items , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeJobsCommandError = async ( output , context ) : Promise < DescribeJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DescribeReplicationConfigurationTemplatesCommand = async ( output , context ) : Promise < DescribeReplicationConfigurationTemplatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . items !== undefined && data . items !== null ) { contents . items = deserializeAws_restJson1ReplicationConfigurationTemplates ( data . items , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandError = async ( output , context ) : Promise < DescribeReplicationConfigurationTemplatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DescribeSourceServersCommand = async ( output , context ) : Promise < DescribeSourceServersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeSourceServersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . items !== undefined && data . items !== null ) { contents . items = deserializeAws_restJson1SourceServersList ( data . items , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeSourceServersCommandError = async ( output , context ) : Promise < DescribeSourceServersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DescribeVcenterClientsCommand = async ( output , context ) : Promise < DescribeVcenterClientsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeVcenterClientsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , items : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . items !== undefined && data . items !== null ) { contents . items = deserializeAws_restJson1VcenterClientList ( data . items , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeVcenterClientsCommandError = async ( output , context ) : Promise < DescribeVcenterClientsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1DisconnectFromServiceCommand = async ( output , context ) : Promise < DisconnectFromServiceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisconnectFromServiceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisconnectFromServiceCommandError = async ( output , context ) : Promise < DisconnectFromServiceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1FinalizeCutoverCommand = async ( output , context ) : Promise < FinalizeCutoverCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1FinalizeCutoverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1FinalizeCutoverCommandError = async ( output , context ) : Promise < FinalizeCutoverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1GetLaunchConfigurationCommand = async ( output , context ) : Promise < GetLaunchConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetLaunchConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , copyPrivateIp : undefined , copyTags : undefined , ec2LaunchTemplateID : undefined , launchDisposition : undefined , licensing : undefined , name : undefined , sourceServerID : undefined , targetInstanceTypeRightSizingMethod : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . copyPrivateIp !== undefined && data . copyPrivateIp !== null ) { contents . copyPrivateIp = __expectBoolean ( data . copyPrivateIp ) ; } if ( data . copyTags !== undefined && data . copyTags !== null ) { contents . copyTags = __expectBoolean ( data . copyTags ) ; } if ( data . ec2LaunchTemplateID !== undefined && data . ec2LaunchTemplateID !== null ) { contents . ec2LaunchTemplateID = __expectString ( data . ec2LaunchTemplateID ) ; } if ( data . launchDisposition !== undefined && data . launchDisposition !== null ) { contents . launchDisposition = __expectString ( data . launchDisposition ) ; } if ( data . licensing !== undefined && data . licensing !== null ) { contents . licensing = deserializeAws_restJson1Licensing ( data . licensing , context ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . targetInstanceTypeRightSizingMethod !== undefined && data . targetInstanceTypeRightSizingMethod !== null ) { contents . targetInstanceTypeRightSizingMethod = __expectString ( data . targetInstanceTypeRightSizingMethod ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetLaunchConfigurationCommandError = async ( output , context ) : Promise < GetLaunchConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetReplicationConfigurationCommand = async ( output , context ) : Promise < GetReplicationConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetReplicationConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , associateDefaultSecurityGroup : undefined , bandwidthThrottling : undefined , createPublicIP : undefined , dataPlaneRouting : undefined , defaultLargeStagingDiskType : undefined , ebsEncryption : undefined , ebsEncryptionKeyArn : undefined , name : undefined , replicatedDisks : undefined , replicationServerInstanceType : undefined , replicationServersSecurityGroupsIDs : undefined , sourceServerID : undefined , stagingAreaSubnetId : undefined , stagingAreaTags : undefined , useDedicatedReplicationServer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . associateDefaultSecurityGroup !== undefined && data . associateDefaultSecurityGroup !== null ) { contents . associateDefaultSecurityGroup = __expectBoolean ( data . associateDefaultSecurityGroup ) ; } if ( data . bandwidthThrottling !== undefined && data . bandwidthThrottling !== null ) { contents . bandwidthThrottling = __expectLong ( data . bandwidthThrottling ) ; } if ( data . createPublicIP !== undefined && data . createPublicIP !== null ) { contents . createPublicIP = __expectBoolean ( data . createPublicIP ) ; } if ( data . dataPlaneRouting !== undefined && data . dataPlaneRouting !== null ) { contents . dataPlaneRouting = __expectString ( data . dataPlaneRouting ) ; } if ( data . defaultLargeStagingDiskType !== undefined && data . defaultLargeStagingDiskType !== null ) { contents . defaultLargeStagingDiskType = __expectString ( data . defaultLargeStagingDiskType ) ; } if ( data . ebsEncryption !== undefined && data . ebsEncryption !== null ) { contents . ebsEncryption = __expectString ( data . ebsEncryption ) ; } if ( data . ebsEncryptionKeyArn !== undefined && data . ebsEncryptionKeyArn !== null ) { contents . ebsEncryptionKeyArn = __expectString ( data . ebsEncryptionKeyArn ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . replicatedDisks !== undefined && data . replicatedDisks !== null ) { contents . replicatedDisks = deserializeAws_restJson1ReplicationConfigurationReplicatedDisks ( data . replicatedDisks , context ) ; } if ( data . replicationServerInstanceType !== undefined && data . replicationServerInstanceType !== null ) { contents . replicationServerInstanceType = __expectString ( data . replicationServerInstanceType ) ; } if ( data . replicationServersSecurityGroupsIDs !== undefined && data . replicationServersSecurityGroupsIDs !== null ) { contents . replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs ( data . replicationServersSecurityGroupsIDs , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . stagingAreaSubnetId !== undefined && data . stagingAreaSubnetId !== null ) { contents . stagingAreaSubnetId = __expectString ( data . stagingAreaSubnetId ) ; } if ( data . stagingAreaTags !== undefined && data . stagingAreaTags !== null ) { contents . stagingAreaTags = deserializeAws_restJson1TagsMap ( data . stagingAreaTags , context ) ; } if ( data . useDedicatedReplicationServer !== undefined && data . useDedicatedReplicationServer !== null ) { contents . useDedicatedReplicationServer = __expectBoolean ( data . useDedicatedReplicationServer ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetReplicationConfigurationCommandError = async ( output , context ) : Promise < GetReplicationConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1InitializeServiceCommand = async ( output , context ) : Promise < InitializeServiceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1InitializeServiceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1InitializeServiceCommandError = async ( output , context ) : Promise < InitializeServiceCommandOutput > => { 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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.mgn#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.mgn#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1MarkAsArchivedCommand = async ( output , context ) : Promise < MarkAsArchivedCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1MarkAsArchivedCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1MarkAsArchivedCommandError = async ( output , context ) : Promise < MarkAsArchivedCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1RetryDataReplicationCommand = async ( output , context ) : Promise < RetryDataReplicationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RetryDataReplicationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RetryDataReplicationCommandError = async ( output , context ) : Promise < RetryDataReplicationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1StartCutoverCommand = async ( output , context ) : Promise < StartCutoverCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartCutoverCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , job : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . job !== undefined && data . job !== null ) { contents . job = deserializeAws_restJson1Job ( data . job , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartCutoverCommandError = async ( output , context ) : Promise < StartCutoverCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1StartReplicationCommand = async ( output , context ) : Promise < StartReplicationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartReplicationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartReplicationCommandError = async ( output , context ) : Promise < StartReplicationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.mgn#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1StartTestCommand = async ( output , context ) : Promise < StartTestCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartTestCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , job : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . job !== undefined && data . job !== null ) { contents . job = deserializeAws_restJson1Job ( data . job , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartTestCommandError = async ( output , context ) : Promise < StartTestCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.mgn#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.mgn#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1TerminateTargetInstancesCommand = async ( output , context ) : Promise < TerminateTargetInstancesCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1TerminateTargetInstancesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , job : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . job !== undefined && data . job !== null ) { contents . job = deserializeAws_restJson1Job ( data . job , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TerminateTargetInstancesCommandError = async ( output , context ) : Promise < TerminateTargetInstancesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.mgn#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.mgn#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1UpdateLaunchConfigurationCommand = async ( output , context ) : Promise < UpdateLaunchConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateLaunchConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , copyPrivateIp : undefined , copyTags : undefined , ec2LaunchTemplateID : undefined , launchDisposition : undefined , licensing : undefined , name : undefined , sourceServerID : undefined , targetInstanceTypeRightSizingMethod : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . copyPrivateIp !== undefined && data . copyPrivateIp !== null ) { contents . copyPrivateIp = __expectBoolean ( data . copyPrivateIp ) ; } if ( data . copyTags !== undefined && data . copyTags !== null ) { contents . copyTags = __expectBoolean ( data . copyTags ) ; } if ( data . ec2LaunchTemplateID !== undefined && data . ec2LaunchTemplateID !== null ) { contents . ec2LaunchTemplateID = __expectString ( data . ec2LaunchTemplateID ) ; } if ( data . launchDisposition !== undefined && data . launchDisposition !== null ) { contents . launchDisposition = __expectString ( data . launchDisposition ) ; } if ( data . licensing !== undefined && data . licensing !== null ) { contents . licensing = deserializeAws_restJson1Licensing ( data . licensing , context ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . targetInstanceTypeRightSizingMethod !== undefined && data . targetInstanceTypeRightSizingMethod !== null ) { contents . targetInstanceTypeRightSizingMethod = __expectString ( data . targetInstanceTypeRightSizingMethod ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateLaunchConfigurationCommandError = async ( output , context ) : Promise < UpdateLaunchConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1UpdateReplicationConfigurationCommand = async ( output , context ) : Promise < UpdateReplicationConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateReplicationConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , associateDefaultSecurityGroup : undefined , bandwidthThrottling : undefined , createPublicIP : undefined , dataPlaneRouting : undefined , defaultLargeStagingDiskType : undefined , ebsEncryption : undefined , ebsEncryptionKeyArn : undefined , name : undefined , replicatedDisks : undefined , replicationServerInstanceType : undefined , replicationServersSecurityGroupsIDs : undefined , sourceServerID : undefined , stagingAreaSubnetId : undefined , stagingAreaTags : undefined , useDedicatedReplicationServer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . associateDefaultSecurityGroup !== undefined && data . associateDefaultSecurityGroup !== null ) { contents . associateDefaultSecurityGroup = __expectBoolean ( data . associateDefaultSecurityGroup ) ; } if ( data . bandwidthThrottling !== undefined && data . bandwidthThrottling !== null ) { contents . bandwidthThrottling = __expectLong ( data . bandwidthThrottling ) ; } if ( data . createPublicIP !== undefined && data . createPublicIP !== null ) { contents . createPublicIP = __expectBoolean ( data . createPublicIP ) ; } if ( data . dataPlaneRouting !== undefined && data . dataPlaneRouting !== null ) { contents . dataPlaneRouting = __expectString ( data . dataPlaneRouting ) ; } if ( data . defaultLargeStagingDiskType !== undefined && data . defaultLargeStagingDiskType !== null ) { contents . defaultLargeStagingDiskType = __expectString ( data . defaultLargeStagingDiskType ) ; } if ( data . ebsEncryption !== undefined && data . ebsEncryption !== null ) { contents . ebsEncryption = __expectString ( data . ebsEncryption ) ; } if ( data . ebsEncryptionKeyArn !== undefined && data . ebsEncryptionKeyArn !== null ) { contents . ebsEncryptionKeyArn = __expectString ( data . ebsEncryptionKeyArn ) ; } if ( data . name !== undefined && data . name !== null ) { contents . name = __expectString ( data . name ) ; } if ( data . replicatedDisks !== undefined && data . replicatedDisks !== null ) { contents . replicatedDisks = deserializeAws_restJson1ReplicationConfigurationReplicatedDisks ( data . replicatedDisks , context ) ; } if ( data . replicationServerInstanceType !== undefined && data . replicationServerInstanceType !== null ) { contents . replicationServerInstanceType = __expectString ( data . replicationServerInstanceType ) ; } if ( data . replicationServersSecurityGroupsIDs !== undefined && data . replicationServersSecurityGroupsIDs !== null ) { contents . replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs ( data . replicationServersSecurityGroupsIDs , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . stagingAreaSubnetId !== undefined && data . stagingAreaSubnetId !== null ) { contents . stagingAreaSubnetId = __expectString ( data . stagingAreaSubnetId ) ; } if ( data . stagingAreaTags !== undefined && data . stagingAreaTags !== null ) { contents . stagingAreaTags = deserializeAws_restJson1TagsMap ( data . stagingAreaTags , context ) ; } if ( data . useDedicatedReplicationServer !== undefined && data . useDedicatedReplicationServer !== null ) { contents . useDedicatedReplicationServer = __expectBoolean ( data . useDedicatedReplicationServer ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateReplicationConfigurationCommandError = async ( output , context ) : Promise < UpdateReplicationConfigurationCommandOutput > => { 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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1UpdateReplicationConfigurationTemplateCommand = async ( output , context ) : Promise < UpdateReplicationConfigurationTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , associateDefaultSecurityGroup : undefined , bandwidthThrottling : undefined , createPublicIP : undefined , dataPlaneRouting : undefined , defaultLargeStagingDiskType : undefined , ebsEncryption : undefined , ebsEncryptionKeyArn : undefined , replicationConfigurationTemplateID : undefined , replicationServerInstanceType : undefined , replicationServersSecurityGroupsIDs : undefined , stagingAreaSubnetId : undefined , stagingAreaTags : undefined , tags : undefined , useDedicatedReplicationServer : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . associateDefaultSecurityGroup !== undefined && data . associateDefaultSecurityGroup !== null ) { contents . associateDefaultSecurityGroup = __expectBoolean ( data . associateDefaultSecurityGroup ) ; } if ( data . bandwidthThrottling !== undefined && data . bandwidthThrottling !== null ) { contents . bandwidthThrottling = __expectLong ( data . bandwidthThrottling ) ; } if ( data . createPublicIP !== undefined && data . createPublicIP !== null ) { contents . createPublicIP = __expectBoolean ( data . createPublicIP ) ; } if ( data . dataPlaneRouting !== undefined && data . dataPlaneRouting !== null ) { contents . dataPlaneRouting = __expectString ( data . dataPlaneRouting ) ; } if ( data . defaultLargeStagingDiskType !== undefined && data . defaultLargeStagingDiskType !== null ) { contents . defaultLargeStagingDiskType = __expectString ( data . defaultLargeStagingDiskType ) ; } if ( data . ebsEncryption !== undefined && data . ebsEncryption !== null ) { contents . ebsEncryption = __expectString ( data . ebsEncryption ) ; } if ( data . ebsEncryptionKeyArn !== undefined && data . ebsEncryptionKeyArn !== null ) { contents . ebsEncryptionKeyArn = __expectString ( data . ebsEncryptionKeyArn ) ; } if ( data . replicationConfigurationTemplateID !== undefined && data . replicationConfigurationTemplateID !== null ) { contents . replicationConfigurationTemplateID = __expectString ( data . replicationConfigurationTemplateID ) ; } if ( data . replicationServerInstanceType !== undefined && data . replicationServerInstanceType !== null ) { contents . replicationServerInstanceType = __expectString ( data . replicationServerInstanceType ) ; } if ( data . replicationServersSecurityGroupsIDs !== undefined && data . replicationServersSecurityGroupsIDs !== null ) { contents . replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs ( data . replicationServersSecurityGroupsIDs , context ) ; } if ( data . stagingAreaSubnetId !== undefined && data . stagingAreaSubnetId !== null ) { contents . stagingAreaSubnetId = __expectString ( data . stagingAreaSubnetId ) ; } if ( data . stagingAreaTags !== undefined && data . stagingAreaTags !== null ) { contents . stagingAreaTags = deserializeAws_restJson1TagsMap ( data . stagingAreaTags , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . useDedicatedReplicationServer !== undefined && data . useDedicatedReplicationServer !== null ) { contents . useDedicatedReplicationServer = __expectBoolean ( data . useDedicatedReplicationServer ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError = async ( output , context ) : Promise < UpdateReplicationConfigurationTemplateCommandOutput > => { 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.mgn#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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_restJson1UpdateSourceServerReplicationTypeCommand = async ( output , context ) : Promise < UpdateSourceServerReplicationTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSourceServerReplicationTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , dataReplicationInfo : undefined , isArchived : undefined , launchedInstance : undefined , lifeCycle : undefined , replicationType : undefined , sourceProperties : undefined , sourceServerID : undefined , tags : undefined , vcenterClientID : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . dataReplicationInfo !== undefined && data . dataReplicationInfo !== null ) { contents . dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo ( data . dataReplicationInfo , context ) ; } if ( data . isArchived !== undefined && data . isArchived !== null ) { contents . isArchived = __expectBoolean ( data . isArchived ) ; } if ( data . launchedInstance !== undefined && data . launchedInstance !== null ) { contents . launchedInstance = deserializeAws_restJson1LaunchedInstance ( data . launchedInstance , context ) ; } if ( data . lifeCycle !== undefined && data . lifeCycle !== null ) { contents . lifeCycle = deserializeAws_restJson1LifeCycle ( data . lifeCycle , context ) ; } if ( data . replicationType !== undefined && data . replicationType !== null ) { contents . replicationType = __expectString ( data . replicationType ) ; } if ( data . sourceProperties !== undefined && data . sourceProperties !== null ) { contents . sourceProperties = deserializeAws_restJson1SourceProperties ( data . sourceProperties , context ) ; } if ( data . sourceServerID !== undefined && data . sourceServerID !== null ) { contents . sourceServerID = __expectString ( data . sourceServerID ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagsMap ( data . tags , context ) ; } if ( data . vcenterClientID !== undefined && data . vcenterClientID !== null ) { contents . vcenterClientID = __expectString ( data . vcenterClientID ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSourceServerReplicationTypeCommandError = async ( output , context ) : Promise < UpdateSourceServerReplicationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.mgn#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mgn#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UninitializedAccountException" : case "com.amazonaws.mgn#UninitializedAccountException" : response = { ... ( await deserializeAws_restJson1UninitializedAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mgn#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 ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } 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 ) , code : undefined , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = __strictParseLong ( 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 ) , code : undefined , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } 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 ) , code : undefined , message : undefined , quotaCode : undefined , resourceId : undefined , resourceType : undefined , serviceCode : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , quotaCode : undefined , retryAfterSeconds : undefined , serviceCode : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = parsedOutput . headers [ "retry-after" ] ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1UninitializedAccountExceptionResponse = async ( parsedOutput , context ) : Promise < UninitializedAccountException > => { const contents = { name : "UninitializedAccountException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } 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 ) , code : undefined , fieldList : undefined , message : undefined , reason : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . fieldList !== undefined && data . fieldList !== null ) { contents . fieldList = deserializeAws_restJson1ValidationExceptionFieldList ( data . fieldList , 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_restJson1ChangeServerLifeCycleStateSourceServerLifecycle = ( input , context ) : any => { return { ... ( input . state !== undefined && input . state !== null && { state : input . state } ) , } ; } ; const serializeAws_restJson1DescribeJobsRequestFilters = ( input , context ) : any => { return { ... ( input . fromDate !== undefined && input . fromDate !== null && { fromDate : input . fromDate } ) , ... ( input . jobIDs !== undefined && input . jobIDs !== null && { jobIDs : serializeAws_restJson1DescribeJobsRequestFiltersJobIDs ( input . jobIDs , context ) , } ) , ... ( input . toDate !== undefined && input . toDate !== null && { toDate : input . toDate } ) , } ; } ; const serializeAws_restJson1DescribeJobsRequestFiltersJobIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1DescribeSourceServersRequestFilters = ( input , context ) : any => { return { ... ( input . isArchived !== undefined && input . isArchived !== null && { isArchived : input . isArchived } ) , ... ( input . lifeCycleStates !== undefined && input . lifeCycleStates !== null && { lifeCycleStates : serializeAws_restJson1LifeCycleStates ( input . lifeCycleStates , context ) , } ) , ... ( input . replicationTypes !== undefined && input . replicationTypes !== null && { replicationTypes : serializeAws_restJson1ReplicationTypes ( input . replicationTypes , context ) , } ) , ... ( input . sourceServerIDs !== undefined && input . sourceServerIDs !== null && { sourceServerIDs : serializeAws_restJson1DescribeSourceServersRequestFiltersIDs ( input . sourceServerIDs , context ) , } ) , } ; } ; const serializeAws_restJson1DescribeSourceServersRequestFiltersIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Licensing = ( input , context ) : any => { return { ... ( input . osByol !== undefined && input . osByol !== null && { osByol : input . osByol } ) , } ; } ; const serializeAws_restJson1LifeCycleStates = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ReplicationConfigurationReplicatedDisk = ( input , context ) : any => { return { ... ( input . deviceName !== undefined && input . deviceName !== null && { deviceName : input . deviceName } ) , ... ( input . iops !== undefined && input . iops !== null && { iops : input . iops } ) , ... ( input . isBootDisk !== undefined && input . isBootDisk !== null && { isBootDisk : input . isBootDisk } ) , ... ( input . stagingDiskType !== undefined && input . stagingDiskType !== null && { stagingDiskType : input . stagingDiskType } ) , } ; } ; const serializeAws_restJson1ReplicationConfigurationReplicatedDisks = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ReplicationConfigurationReplicatedDisk ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ReplicationConfigurationTemplateIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ReplicationServersSecurityGroupsIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ReplicationTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1StartCutoverRequestSourceServerIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1StartTestRequestSourceServerIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1TagsMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1TerminateTargetInstancesRequestSourceServerIDs = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const deserializeAws_restJson1CPU = ( output , context ) : CPU => { return { cores : __expectLong ( output . cores ) , modelName : __expectString ( output . modelName ) , } as any ; } ; const deserializeAws_restJson1Cpus = ( output , context ) : CPU [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CPU ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DataReplicationError = ( output , context ) : DataReplicationError => { return { error : __expectString ( output . error ) , rawError : __expectString ( output . rawError ) , } as any ; } ; const deserializeAws_restJson1DataReplicationInfo = ( output , context ) : DataReplicationInfo => { return { dataReplicationError : output . dataReplicationError !== undefined && output . dataReplicationError !== null ? deserializeAws_restJson1DataReplicationError ( output . dataReplicationError , context ) : undefined , dataReplicationInitiation : output . dataReplicationInitiation !== undefined && output . dataReplicationInitiation !== null ? deserializeAws_restJson1DataReplicationInitiation ( output . dataReplicationInitiation , context ) : undefined , dataReplicationState : __expectString ( output . dataReplicationState ) , etaDateTime : __expectString ( output . etaDateTime ) , lagDuration : __expectString ( output . lagDuration ) , lastSnapshotDateTime : __expectString ( output . lastSnapshotDateTime ) , replicatedDisks : output . replicatedDisks !== undefined && output . replicatedDisks !== null ? deserializeAws_restJson1DataReplicationInfoReplicatedDisks ( output . replicatedDisks , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DataReplicationInfoReplicatedDisk = ( output , context ) : DataReplicationInfoReplicatedDisk => { return { backloggedStorageBytes : __expectLong ( output . backloggedStorageBytes ) , deviceName : __expectString ( output . deviceName ) , replicatedStorageBytes : __expectLong ( output . replicatedStorageBytes ) , rescannedStorageBytes : __expectLong ( output . rescannedStorageBytes ) , totalStorageBytes : __expectLong ( output . totalStorageBytes ) , } as any ; } ; const deserializeAws_restJson1DataReplicationInfoReplicatedDisks = ( output , context ) : DataReplicationInfoReplicatedDisk [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DataReplicationInfoReplicatedDisk ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DataReplicationInitiation = ( output , context ) : DataReplicationInitiation => { return { nextAttemptDateTime : __expectString ( output . nextAttemptDateTime ) , startDateTime : __expectString ( output . startDateTime ) , steps : output . steps !== undefined && output . steps !== null ? deserializeAws_restJson1DataReplicationInitiationSteps ( output . steps , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DataReplicationInitiationStep = ( output , context ) : DataReplicationInitiationStep => { return { name : __expectString ( output . name ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1DataReplicationInitiationSteps = ( output , context ) : DataReplicationInitiationStep [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DataReplicationInitiationStep ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Disk = ( output , context ) : Disk => { return { bytes : __expectLong ( output . bytes ) , deviceName : __expectString ( output . deviceName ) , } as any ; } ; const deserializeAws_restJson1Disks = ( output , context ) : Disk [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Disk ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IdentificationHints = ( output , context ) : IdentificationHints => { return { awsInstanceID : __expectString ( output . awsInstanceID ) , fqdn : __expectString ( output . fqdn ) , hostname : __expectString ( output . hostname ) , vmPath : __expectString ( output . vmPath ) , vmWareUuid : __expectString ( output . vmWareUuid ) , } as any ; } ; const deserializeAws_restJson1IPsList = ( 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_restJson1Job = ( output , context ) : Job => { return { arn : __expectString ( output . arn ) , creationDateTime : __expectString ( output . creationDateTime ) , endDateTime : __expectString ( output . endDateTime ) , initiatedBy : __expectString ( output . initiatedBy ) , jobID : __expectString ( output . jobID ) , participatingServers : output . participatingServers !== undefined && output . participatingServers !== null ? deserializeAws_restJson1ParticipatingServers ( output . participatingServers , context ) : undefined , status : __expectString ( output . status ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagsMap ( output . tags , context ) : undefined , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1JobLog = ( output , context ) : JobLog => { return { event : __expectString ( output . event ) , eventData : output . eventData !== undefined && output . eventData !== null ? deserializeAws_restJson1JobLogEventData ( output . eventData , context ) : undefined , logDateTime : __expectString ( output . logDateTime ) , } as any ; } ; const deserializeAws_restJson1JobLogEventData = ( output , context ) : JobLogEventData => { return { conversionServerID : __expectString ( output . conversionServerID ) , rawError : __expectString ( output . rawError ) , sourceServerID : __expectString ( output . sourceServerID ) , targetInstanceID : __expectString ( output . targetInstanceID ) , } as any ; } ; const deserializeAws_restJson1JobLogs = ( output , context ) : JobLog [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1JobLog ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1JobsList = ( output , context ) : Job [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Job ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LaunchedInstance = ( output , context ) : LaunchedInstance => { return { ec2InstanceID : __expectString ( output . ec2InstanceID ) , firstBoot : __expectString ( output . firstBoot ) , jobID : __expectString ( output . jobID ) , } as any ; } ; const deserializeAws_restJson1Licensing = ( output , context ) : Licensing => { return { osByol : __expectBoolean ( output . osByol ) , } as any ; } ; const deserializeAws_restJson1LifeCycle = ( output , context ) : LifeCycle => { return { addedToServiceDateTime : __expectString ( output . addedToServiceDateTime ) , elapsedReplicationDuration : __expectString ( output . elapsedReplicationDuration ) , firstByteDateTime : __expectString ( output . firstByteDateTime ) , lastCutover : output . lastCutover !== undefined && output . lastCutover !== null ? deserializeAws_restJson1LifeCycleLastCutover ( output . lastCutover , context ) : undefined , lastSeenByServiceDateTime : __expectString ( output . lastSeenByServiceDateTime ) , lastTest : output . lastTest !== undefined && output . lastTest !== null ? deserializeAws_restJson1LifeCycleLastTest ( output . lastTest , context ) : undefined , state : __expectString ( output . state ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastCutover = ( output , context ) : LifeCycleLastCutover => { return { finalized : output . finalized !== undefined && output . finalized !== null ? deserializeAws_restJson1LifeCycleLastCutoverFinalized ( output . finalized , context ) : undefined , initiated : output . initiated !== undefined && output . initiated !== null ? deserializeAws_restJson1LifeCycleLastCutoverInitiated ( output . initiated , context ) : undefined , reverted : output . reverted !== undefined && output . reverted !== null ? deserializeAws_restJson1LifeCycleLastCutoverReverted ( output . reverted , context ) : undefined , } as any ; } ; const deserializeAws_restJson1LifeCycleLastCutoverFinalized = ( output , context ) : LifeCycleLastCutoverFinalized => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastCutoverInitiated = ( output , context ) : LifeCycleLastCutoverInitiated => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , jobID : __expectString ( output . jobID ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastCutoverReverted = ( output , context ) : LifeCycleLastCutoverReverted => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastTest = ( output , context ) : LifeCycleLastTest => { return { finalized : output . finalized !== undefined && output . finalized !== null ? deserializeAws_restJson1LifeCycleLastTestFinalized ( output . finalized , context ) : undefined , initiated : output . initiated !== undefined && output . initiated !== null ? deserializeAws_restJson1LifeCycleLastTestInitiated ( output . initiated , context ) : undefined , reverted : output . reverted !== undefined && output . reverted !== null ? deserializeAws_restJson1LifeCycleLastTestReverted ( output . reverted , context ) : undefined , } as any ; } ; const deserializeAws_restJson1LifeCycleLastTestFinalized = ( output , context ) : LifeCycleLastTestFinalized => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastTestInitiated = ( output , context ) : LifeCycleLastTestInitiated => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , jobID : __expectString ( output . jobID ) , } as any ; } ; const deserializeAws_restJson1LifeCycleLastTestReverted = ( output , context ) : LifeCycleLastTestReverted => { return { apiCallDateTime : __expectString ( output . apiCallDateTime ) , } as any ; } ; const deserializeAws_restJson1NetworkInterface = ( output , context ) : NetworkInterface => { return { ips : output . ips !== undefined && output . ips !== null ? deserializeAws_restJson1IPsList ( output . ips , context ) : undefined , isPrimary : __expectBoolean ( output . isPrimary ) , macAddress : __expectString ( output . macAddress ) , } as any ; } ; const deserializeAws_restJson1NetworkInterfaces = ( output , context ) : NetworkInterface [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkInterface ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1OS = ( output , context ) : OS => { return { fullString : __expectString ( output . fullString ) , } as any ; } ; const deserializeAws_restJson1ParticipatingServer = ( output , context ) : ParticipatingServer => { return { launchStatus : __expectString ( output . launchStatus ) , sourceServerID : __expectString ( output . sourceServerID ) , } as any ; } ; const deserializeAws_restJson1ParticipatingServers = ( output , context ) : ParticipatingServer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ParticipatingServer ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ReplicationConfigurationReplicatedDisk = ( output , context ) : ReplicationConfigurationReplicatedDisk => { return { deviceName : __expectString ( output . deviceName ) , iops : __expectLong ( output . iops ) , isBootDisk : __expectBoolean ( output . isBootDisk ) , stagingDiskType : __expectString ( output . stagingDiskType ) , } as any ; } ; const deserializeAws_restJson1ReplicationConfigurationReplicatedDisks = ( output , context ) : ReplicationConfigurationReplicatedDisk [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReplicationConfigurationReplicatedDisk ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ReplicationConfigurationTemplate = ( output , context ) : ReplicationConfigurationTemplate => { return { arn : __expectString ( output . arn ) , associateDefaultSecurityGroup : __expectBoolean ( output . associateDefaultSecurityGroup ) , bandwidthThrottling : __expectLong ( output . bandwidthThrottling ) , createPublicIP : __expectBoolean ( output . createPublicIP ) , dataPlaneRouting : __expectString ( output . dataPlaneRouting ) , defaultLargeStagingDiskType : __expectString ( output . defaultLargeStagingDiskType ) , ebsEncryption : __expectString ( output . ebsEncryption ) , ebsEncryptionKeyArn : __expectString ( output . ebsEncryptionKeyArn ) , replicationConfigurationTemplateID : __expectString ( output . replicationConfigurationTemplateID ) , replicationServerInstanceType : __expectString ( output . replicationServerInstanceType ) , replicationServersSecurityGroupsIDs : output . replicationServersSecurityGroupsIDs !== undefined && output . replicationServersSecurityGroupsIDs !== null ? deserializeAws_restJson1ReplicationServersSecurityGroupsIDs ( output . replicationServersSecurityGroupsIDs , context ) : undefined , stagingAreaSubnetId : __expectString ( output . stagingAreaSubnetId ) , stagingAreaTags : output . stagingAreaTags !== undefined && output . stagingAreaTags !== null ? deserializeAws_restJson1TagsMap ( output . stagingAreaTags , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagsMap ( output . tags , context ) : undefined , useDedicatedReplicationServer : __expectBoolean ( output . useDedicatedReplicationServer ) , } as any ; } ; const deserializeAws_restJson1ReplicationConfigurationTemplates = ( output , context ) : ReplicationConfigurationTemplate [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReplicationConfigurationTemplate ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ReplicationServersSecurityGroupsIDs = ( 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_restJson1SourceProperties = ( output , context ) : SourceProperties => { return { cpus : output . cpus !== undefined && output . cpus !== null ? deserializeAws_restJson1Cpus ( output . cpus , context ) : undefined , disks : output . disks !== undefined && output . disks !== null ? deserializeAws_restJson1Disks ( output . disks , context ) : undefined , identificationHints : output . identificationHints !== undefined && output . identificationHints !== null ? deserializeAws_restJson1IdentificationHints ( output . identificationHints , context ) : undefined , lastUpdatedDateTime : __expectString ( output . lastUpdatedDateTime ) , networkInterfaces : output . networkInterfaces !== undefined && output . networkInterfaces !== null ? deserializeAws_restJson1NetworkInterfaces ( output . networkInterfaces , context ) : undefined , os : output . os !== undefined && output . os !== null ? deserializeAws_restJson1OS ( output . os , context ) : undefined , ramBytes : __expectLong ( output . ramBytes ) , recommendedInstanceType : __expectString ( output . recommendedInstanceType ) , } as any ; } ; const deserializeAws_restJson1SourceServer = ( output , context ) : SourceServer => { return { arn : __expectString ( output . arn ) , dataReplicationInfo : output . dataReplicationInfo !== undefined && output . dataReplicationInfo !== null ? deserializeAws_restJson1DataReplicationInfo ( output . dataReplicationInfo , context ) : undefined , isArchived : __expectBoolean ( output . isArchived ) , launchedInstance : output . launchedInstance !== undefined && output . launchedInstance !== null ? deserializeAws_restJson1LaunchedInstance ( output . launchedInstance , context ) : undefined , lifeCycle : output . lifeCycle !== undefined && output . lifeCycle !== null ? deserializeAws_restJson1LifeCycle ( output . lifeCycle , context ) : undefined , replicationType : __expectString ( output . replicationType ) , sourceProperties : output . sourceProperties !== undefined && output . sourceProperties !== null ? deserializeAws_restJson1SourceProperties ( output . sourceProperties , context ) : undefined , sourceServerID : __expectString ( output . sourceServerID ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagsMap ( output . tags , context ) : undefined , vcenterClientID : __expectString ( output . vcenterClientID ) , } as any ; } ; const deserializeAws_restJson1SourceServersList = ( output , context ) : SourceServer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SourceServer ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TagsMap = ( 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_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_restJson1VcenterClient = ( output , context ) : VcenterClient => { return { arn : __expectString ( output . arn ) , datacenterName : __expectString ( output . datacenterName ) , hostname : __expectString ( output . hostname ) , lastSeenDatetime : __expectString ( output . lastSeenDatetime ) , sourceServerTags : output . sourceServerTags !== undefined && output . sourceServerTags !== null ? deserializeAws_restJson1TagsMap ( output . sourceServerTags , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagsMap ( output . tags , context ) : undefined , vcenterClientID : __expectString ( output . vcenterClientID ) , vcenterUUID : __expectString ( output . vcenterUUID ) , } as any ; } ; const deserializeAws_restJson1VcenterClientList = ( output , context ) : VcenterClient [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1VcenterClient ( entry , context ) ; } ) ; } ; 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 "" ; } ;