import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { CreateBackupPlanCommandInput , CreateBackupPlanCommandOutput } from "../commands/CreateBackupPlanCommand" ; import { CreateBackupSelectionCommandInput , CreateBackupSelectionCommandOutput , } from "../commands/CreateBackupSelectionCommand" ; import { CreateBackupVaultCommandInput , CreateBackupVaultCommandOutput } from "../commands/CreateBackupVaultCommand" ; import { CreateFrameworkCommandInput , CreateFrameworkCommandOutput } from "../commands/CreateFrameworkCommand" ; import { CreateReportPlanCommandInput , CreateReportPlanCommandOutput } from "../commands/CreateReportPlanCommand" ; import { DeleteBackupPlanCommandInput , DeleteBackupPlanCommandOutput } from "../commands/DeleteBackupPlanCommand" ; import { DeleteBackupSelectionCommandInput , DeleteBackupSelectionCommandOutput , } from "../commands/DeleteBackupSelectionCommand" ; import { DeleteBackupVaultAccessPolicyCommandInput , DeleteBackupVaultAccessPolicyCommandOutput , } from "../commands/DeleteBackupVaultAccessPolicyCommand" ; import { DeleteBackupVaultCommandInput , DeleteBackupVaultCommandOutput } from "../commands/DeleteBackupVaultCommand" ; import { DeleteBackupVaultLockConfigurationCommandInput , DeleteBackupVaultLockConfigurationCommandOutput , } from "../commands/DeleteBackupVaultLockConfigurationCommand" ; import { DeleteBackupVaultNotificationsCommandInput , DeleteBackupVaultNotificationsCommandOutput , } from "../commands/DeleteBackupVaultNotificationsCommand" ; import { DeleteFrameworkCommandInput , DeleteFrameworkCommandOutput } from "../commands/DeleteFrameworkCommand" ; import { DeleteRecoveryPointCommandInput , DeleteRecoveryPointCommandOutput , } from "../commands/DeleteRecoveryPointCommand" ; import { DeleteReportPlanCommandInput , DeleteReportPlanCommandOutput } from "../commands/DeleteReportPlanCommand" ; import { DescribeBackupJobCommandInput , DescribeBackupJobCommandOutput } from "../commands/DescribeBackupJobCommand" ; import { DescribeBackupVaultCommandInput , DescribeBackupVaultCommandOutput , } from "../commands/DescribeBackupVaultCommand" ; import { DescribeCopyJobCommandInput , DescribeCopyJobCommandOutput } from "../commands/DescribeCopyJobCommand" ; import { DescribeFrameworkCommandInput , DescribeFrameworkCommandOutput } from "../commands/DescribeFrameworkCommand" ; import { DescribeGlobalSettingsCommandInput , DescribeGlobalSettingsCommandOutput , } from "../commands/DescribeGlobalSettingsCommand" ; import { DescribeProtectedResourceCommandInput , DescribeProtectedResourceCommandOutput , } from "../commands/DescribeProtectedResourceCommand" ; import { DescribeRecoveryPointCommandInput , DescribeRecoveryPointCommandOutput , } from "../commands/DescribeRecoveryPointCommand" ; import { DescribeRegionSettingsCommandInput , DescribeRegionSettingsCommandOutput , } from "../commands/DescribeRegionSettingsCommand" ; import { DescribeReportJobCommandInput , DescribeReportJobCommandOutput } from "../commands/DescribeReportJobCommand" ; import { DescribeReportPlanCommandInput , DescribeReportPlanCommandOutput } from "../commands/DescribeReportPlanCommand" ; import { DescribeRestoreJobCommandInput , DescribeRestoreJobCommandOutput } from "../commands/DescribeRestoreJobCommand" ; import { DisassociateRecoveryPointCommandInput , DisassociateRecoveryPointCommandOutput , } from "../commands/DisassociateRecoveryPointCommand" ; import { ExportBackupPlanTemplateCommandInput , ExportBackupPlanTemplateCommandOutput , } from "../commands/ExportBackupPlanTemplateCommand" ; import { GetBackupPlanCommandInput , GetBackupPlanCommandOutput } from "../commands/GetBackupPlanCommand" ; import { GetBackupPlanFromJSONCommandInput , GetBackupPlanFromJSONCommandOutput , } from "../commands/GetBackupPlanFromJSONCommand" ; import { GetBackupPlanFromTemplateCommandInput , GetBackupPlanFromTemplateCommandOutput , } from "../commands/GetBackupPlanFromTemplateCommand" ; import { GetBackupSelectionCommandInput , GetBackupSelectionCommandOutput } from "../commands/GetBackupSelectionCommand" ; import { GetBackupVaultAccessPolicyCommandInput , GetBackupVaultAccessPolicyCommandOutput , } from "../commands/GetBackupVaultAccessPolicyCommand" ; import { GetBackupVaultNotificationsCommandInput , GetBackupVaultNotificationsCommandOutput , } from "../commands/GetBackupVaultNotificationsCommand" ; import { GetRecoveryPointRestoreMetadataCommandInput , GetRecoveryPointRestoreMetadataCommandOutput , } from "../commands/GetRecoveryPointRestoreMetadataCommand" ; import { GetSupportedResourceTypesCommandInput , GetSupportedResourceTypesCommandOutput , } from "../commands/GetSupportedResourceTypesCommand" ; import { ListBackupJobsCommandInput , ListBackupJobsCommandOutput } from "../commands/ListBackupJobsCommand" ; import { ListBackupPlansCommandInput , ListBackupPlansCommandOutput } from "../commands/ListBackupPlansCommand" ; import { ListBackupPlanTemplatesCommandInput , ListBackupPlanTemplatesCommandOutput , } from "../commands/ListBackupPlanTemplatesCommand" ; import { ListBackupPlanVersionsCommandInput , ListBackupPlanVersionsCommandOutput , } from "../commands/ListBackupPlanVersionsCommand" ; import { ListBackupSelectionsCommandInput , ListBackupSelectionsCommandOutput , } from "../commands/ListBackupSelectionsCommand" ; import { ListBackupVaultsCommandInput , ListBackupVaultsCommandOutput } from "../commands/ListBackupVaultsCommand" ; import { ListCopyJobsCommandInput , ListCopyJobsCommandOutput } from "../commands/ListCopyJobsCommand" ; import { ListFrameworksCommandInput , ListFrameworksCommandOutput } from "../commands/ListFrameworksCommand" ; import { ListProtectedResourcesCommandInput , ListProtectedResourcesCommandOutput , } from "../commands/ListProtectedResourcesCommand" ; import { ListRecoveryPointsByBackupVaultCommandInput , ListRecoveryPointsByBackupVaultCommandOutput , } from "../commands/ListRecoveryPointsByBackupVaultCommand" ; import { ListRecoveryPointsByResourceCommandInput , ListRecoveryPointsByResourceCommandOutput , } from "../commands/ListRecoveryPointsByResourceCommand" ; import { ListReportJobsCommandInput , ListReportJobsCommandOutput } from "../commands/ListReportJobsCommand" ; import { ListReportPlansCommandInput , ListReportPlansCommandOutput } from "../commands/ListReportPlansCommand" ; import { ListRestoreJobsCommandInput , ListRestoreJobsCommandOutput } from "../commands/ListRestoreJobsCommand" ; import { ListTagsCommandInput , ListTagsCommandOutput } from "../commands/ListTagsCommand" ; import { PutBackupVaultAccessPolicyCommandInput , PutBackupVaultAccessPolicyCommandOutput , } from "../commands/PutBackupVaultAccessPolicyCommand" ; import { PutBackupVaultLockConfigurationCommandInput , PutBackupVaultLockConfigurationCommandOutput , } from "../commands/PutBackupVaultLockConfigurationCommand" ; import { PutBackupVaultNotificationsCommandInput , PutBackupVaultNotificationsCommandOutput , } from "../commands/PutBackupVaultNotificationsCommand" ; import { StartBackupJobCommandInput , StartBackupJobCommandOutput } from "../commands/StartBackupJobCommand" ; import { StartCopyJobCommandInput , StartCopyJobCommandOutput } from "../commands/StartCopyJobCommand" ; import { StartReportJobCommandInput , StartReportJobCommandOutput } from "../commands/StartReportJobCommand" ; import { StartRestoreJobCommandInput , StartRestoreJobCommandOutput } from "../commands/StartRestoreJobCommand" ; import { StopBackupJobCommandInput , StopBackupJobCommandOutput } from "../commands/StopBackupJobCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateBackupPlanCommandInput , UpdateBackupPlanCommandOutput } from "../commands/UpdateBackupPlanCommand" ; import { UpdateFrameworkCommandInput , UpdateFrameworkCommandOutput } from "../commands/UpdateFrameworkCommand" ; import { UpdateGlobalSettingsCommandInput , UpdateGlobalSettingsCommandOutput , } from "../commands/UpdateGlobalSettingsCommand" ; import { UpdateRecoveryPointLifecycleCommandInput , UpdateRecoveryPointLifecycleCommandOutput , } from "../commands/UpdateRecoveryPointLifecycleCommand" ; import { UpdateRegionSettingsCommandInput , UpdateRegionSettingsCommandOutput , } from "../commands/UpdateRegionSettingsCommand" ; import { UpdateReportPlanCommandInput , UpdateReportPlanCommandOutput } from "../commands/UpdateReportPlanCommand" ; import { AdvancedBackupSetting , AlreadyExistsException , BackupJob , BackupPlan , BackupPlanInput , BackupPlansListMember , BackupPlanTemplatesListMember , BackupRule , BackupRuleInput , BackupSelection , BackupSelectionsListMember , BackupVaultEvent , BackupVaultListMember , CalculatedLifecycle , Condition , ConditionParameter , Conditions , ConflictException , ControlInputParameter , ControlScope , CopyAction , CopyJob , DependencyFailureException , Framework , FrameworkControl , InvalidParameterValueException , InvalidRequestException , InvalidResourceStateException , Lifecycle , LimitExceededException , MissingParameterValueException , ProtectedResource , RecoveryPointByBackupVault , RecoveryPointByResource , RecoveryPointCreator , ReportDeliveryChannel , ReportDestination , ReportJob , ReportPlan , ReportSetting , ResourceNotFoundException , RestoreJobsListMember , ServiceUnavailableException , } from "../models/models_0" ; export const serializeAws_restJson1CreateBackupPlanCommand = 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 || "" }` + "/backup/plans" ; let body ; body = JSON . stringify ( { ... ( input . BackupPlan !== undefined && input . BackupPlan !== null && { BackupPlan : serializeAws_restJson1BackupPlanInput ( input . BackupPlan , context ) } ) , ... ( input . BackupPlanTags !== undefined && input . BackupPlanTags !== null && { BackupPlanTags : serializeAws_restJson1Tags ( input . BackupPlanTags , context ) } ) , ... ( input . CreatorRequestId !== undefined && input . CreatorRequestId !== null && { CreatorRequestId : input . CreatorRequestId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateBackupSelectionCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/selections" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } let body ; body = JSON . stringify ( { ... ( input . BackupSelection !== undefined && input . BackupSelection !== null && { BackupSelection : serializeAws_restJson1BackupSelection ( input . BackupSelection , context ) , } ) , ... ( input . CreatorRequestId !== undefined && input . CreatorRequestId !== null && { CreatorRequestId : input . CreatorRequestId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateBackupVaultCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; body = JSON . stringify ( { ... ( input . BackupVaultTags !== undefined && input . BackupVaultTags !== null && { BackupVaultTags : serializeAws_restJson1Tags ( input . BackupVaultTags , context ) , } ) , ... ( input . CreatorRequestId !== undefined && input . CreatorRequestId !== null && { CreatorRequestId : input . CreatorRequestId } ) , ... ( input . EncryptionKeyArn !== undefined && input . EncryptionKeyArn !== null && { EncryptionKeyArn : input . EncryptionKeyArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateFrameworkCommand = 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 || "" }` + "/audit/frameworks" ; let body ; body = JSON . stringify ( { ... ( input . FrameworkControls !== undefined && input . FrameworkControls !== null && { FrameworkControls : serializeAws_restJson1FrameworkControls ( input . FrameworkControls , context ) , } ) , ... ( input . FrameworkDescription !== undefined && input . FrameworkDescription !== null && { FrameworkDescription : input . FrameworkDescription } ) , ... ( input . FrameworkName !== undefined && input . FrameworkName !== null && { FrameworkName : input . FrameworkName } ) , ... ( input . FrameworkTags !== undefined && input . FrameworkTags !== null && { FrameworkTags : serializeAws_restJson1stringMap ( input . FrameworkTags , context ) } ) , IdempotencyToken : input . IdempotencyToken ?? generateIdempotencyToken ( ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateReportPlanCommand = 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 || "" }` + "/audit/report-plans" ; let body ; body = JSON . stringify ( { IdempotencyToken : input . IdempotencyToken ?? generateIdempotencyToken ( ) , ... ( input . ReportDeliveryChannel !== undefined && input . ReportDeliveryChannel !== null && { ReportDeliveryChannel : serializeAws_restJson1ReportDeliveryChannel ( input . ReportDeliveryChannel , context ) , } ) , ... ( input . ReportPlanDescription !== undefined && input . ReportPlanDescription !== null && { ReportPlanDescription : input . ReportPlanDescription } ) , ... ( input . ReportPlanName !== undefined && input . ReportPlanName !== null && { ReportPlanName : input . ReportPlanName } ) , ... ( input . ReportPlanTags !== undefined && input . ReportPlanTags !== null && { ReportPlanTags : serializeAws_restJson1stringMap ( input . ReportPlanTags , context ) , } ) , ... ( input . ReportSetting !== undefined && input . ReportSetting !== null && { ReportSetting : serializeAws_restJson1ReportSetting ( input . ReportSetting , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupPlanCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupSelectionCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/selections/{SelectionId}" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } if ( input . SelectionId !== undefined ) { const labelValue = input . SelectionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SelectionId." ) ; } resolvedPath = resolvedPath . replace ( "{SelectionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SelectionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupVaultCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupVaultAccessPolicyCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/access-policy" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupVaultLockConfigurationCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/vault-lock" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBackupVaultNotificationsCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/notification-configuration" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteFrameworkCommand = 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 || "" }` + "/audit/frameworks/{FrameworkName}" ; if ( input . FrameworkName !== undefined ) { const labelValue = input . FrameworkName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FrameworkName." ) ; } resolvedPath = resolvedPath . replace ( "{FrameworkName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FrameworkName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRecoveryPointCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } if ( input . RecoveryPointArn !== undefined ) { const labelValue = input . RecoveryPointArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryPointArn." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryPointArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryPointArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteReportPlanCommand = 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 || "" }` + "/audit/report-plans/{ReportPlanName}" ; if ( input . ReportPlanName !== undefined ) { const labelValue = input . ReportPlanName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportPlanName." ) ; } resolvedPath = resolvedPath . replace ( "{ReportPlanName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportPlanName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeBackupJobCommand = 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 || "" }` + "/backup-jobs/{BackupJobId}" ; if ( input . BackupJobId !== undefined ) { const labelValue = input . BackupJobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupJobId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupJobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupJobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeBackupVaultCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeCopyJobCommand = 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 || "" }` + "/copy-jobs/{CopyJobId}" ; if ( input . CopyJobId !== undefined ) { const labelValue = input . CopyJobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CopyJobId." ) ; } resolvedPath = resolvedPath . replace ( "{CopyJobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CopyJobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeFrameworkCommand = 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 || "" }` + "/audit/frameworks/{FrameworkName}" ; if ( input . FrameworkName !== undefined ) { const labelValue = input . FrameworkName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FrameworkName." ) ; } resolvedPath = resolvedPath . replace ( "{FrameworkName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FrameworkName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeGlobalSettingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/global-settings" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeProtectedResourceCommand = 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 || "" }` + "/resources/{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_restJson1DescribeRecoveryPointCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } if ( input . RecoveryPointArn !== undefined ) { const labelValue = input . RecoveryPointArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryPointArn." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryPointArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryPointArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeRegionSettingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account-settings" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeReportJobCommand = 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 || "" }` + "/audit/report-jobs/{ReportJobId}" ; if ( input . ReportJobId !== undefined ) { const labelValue = input . ReportJobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportJobId." ) ; } resolvedPath = resolvedPath . replace ( "{ReportJobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportJobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeReportPlanCommand = 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 || "" }` + "/audit/report-plans/{ReportPlanName}" ; if ( input . ReportPlanName !== undefined ) { const labelValue = input . ReportPlanName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportPlanName." ) ; } resolvedPath = resolvedPath . replace ( "{ReportPlanName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportPlanName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeRestoreJobCommand = 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 || "" }` + "/restore-jobs/{RestoreJobId}" ; if ( input . RestoreJobId !== undefined ) { const labelValue = input . RestoreJobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RestoreJobId." ) ; } resolvedPath = resolvedPath . replace ( "{RestoreJobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RestoreJobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateRecoveryPointCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/disassociate" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } if ( input . RecoveryPointArn !== undefined ) { const labelValue = input . RecoveryPointArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryPointArn." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryPointArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryPointArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ExportBackupPlanTemplateCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/toTemplate" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBackupPlanCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } const query = { ... ( input . VersionId !== undefined && { versionId : input . VersionId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetBackupPlanFromJSONCommand = 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 || "" }` + "/backup/template/json/toPlan" ; let body ; body = JSON . stringify ( { ... ( input . BackupPlanTemplateJson !== undefined && input . BackupPlanTemplateJson !== null && { BackupPlanTemplateJson : input . BackupPlanTemplateJson } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBackupPlanFromTemplateCommand = 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 || "" }` + "/backup/template/plans/{BackupPlanTemplateId}/toPlan" ; if ( input . BackupPlanTemplateId !== undefined ) { const labelValue = input . BackupPlanTemplateId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanTemplateId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanTemplateId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanTemplateId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBackupSelectionCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/selections/{SelectionId}" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } if ( input . SelectionId !== undefined ) { const labelValue = input . SelectionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SelectionId." ) ; } resolvedPath = resolvedPath . replace ( "{SelectionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SelectionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBackupVaultAccessPolicyCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/access-policy" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBackupVaultNotificationsCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/notification-configuration" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRecoveryPointRestoreMetadataCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/restore-metadata" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } if ( input . RecoveryPointArn !== undefined ) { const labelValue = input . RecoveryPointArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryPointArn." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryPointArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryPointArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSupportedResourceTypesCommand = 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 || "" }` + "/supported-resource-types" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListBackupJobsCommand = 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 || "" }` + "/backup-jobs" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . ByResourceArn !== undefined && { resourceArn : input . ByResourceArn } ) , ... ( input . ByState !== undefined && { state : input . ByState } ) , ... ( input . ByBackupVaultName !== undefined && { backupVaultName : input . ByBackupVaultName } ) , ... ( input . ByCreatedBefore !== undefined && { createdBefore : ( input . ByCreatedBefore . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByCreatedAfter !== undefined && { createdAfter : ( input . ByCreatedAfter . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByResourceType !== undefined && { resourceType : input . ByResourceType } ) , ... ( input . ByAccountId !== undefined && { accountId : input . ByAccountId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListBackupPlansCommand = 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 || "" }` + "/backup/plans" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . IncludeDeleted !== undefined && { includeDeleted : input . IncludeDeleted . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListBackupPlanTemplatesCommand = 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 || "" }` + "/backup/template/plans" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListBackupPlanVersionsCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/versions" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListBackupSelectionsCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}/selections" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListBackupVaultsCommand = 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 || "" }` + "/backup-vaults" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListCopyJobsCommand = 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 || "" }` + "/copy-jobs" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . ByResourceArn !== undefined && { resourceArn : input . ByResourceArn } ) , ... ( input . ByState !== undefined && { state : input . ByState } ) , ... ( input . ByCreatedBefore !== undefined && { createdBefore : ( input . ByCreatedBefore . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByCreatedAfter !== undefined && { createdAfter : ( input . ByCreatedAfter . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByResourceType !== undefined && { resourceType : input . ByResourceType } ) , ... ( input . ByDestinationVaultArn !== undefined && { destinationVaultArn : input . ByDestinationVaultArn } ) , ... ( input . ByAccountId !== undefined && { accountId : input . ByAccountId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListFrameworksCommand = 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 || "" }` + "/audit/frameworks" ; 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_restJson1ListProtectedResourcesCommand = 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 || "" }` + "/resources" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListRecoveryPointsByBackupVaultCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . ByResourceArn !== undefined && { resourceArn : input . ByResourceArn } ) , ... ( input . ByResourceType !== undefined && { resourceType : input . ByResourceType } ) , ... ( input . ByBackupPlanId !== undefined && { backupPlanId : input . ByBackupPlanId } ) , ... ( input . ByCreatedBefore !== undefined && { createdBefore : ( input . ByCreatedBefore . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByCreatedAfter !== undefined && { createdAfter : ( input . ByCreatedAfter . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListRecoveryPointsByResourceCommand = 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 || "" }` + "/resources/{ResourceArn}/recovery-points" ; 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 . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListReportJobsCommand = 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 || "" }` + "/audit/report-jobs" ; const query = { ... ( input . ByReportPlanName !== undefined && { ReportPlanName : input . ByReportPlanName } ) , ... ( input . ByCreationBefore !== undefined && { CreationBefore : ( input . ByCreationBefore . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByCreationAfter !== undefined && { CreationAfter : ( input . ByCreationAfter . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByStatus !== undefined && { Status : input . ByStatus } ) , ... ( 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_restJson1ListReportPlansCommand = 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 || "" }` + "/audit/report-plans" ; 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_restJson1ListRestoreJobsCommand = 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 || "" }` + "/restore-jobs" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . ByAccountId !== undefined && { accountId : input . ByAccountId } ) , ... ( input . ByCreatedBefore !== undefined && { createdBefore : ( input . ByCreatedBefore . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByCreatedAfter !== undefined && { createdAfter : ( input . ByCreatedAfter . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . ByStatus !== undefined && { status : input . ByStatus } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsCommand = 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 . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1PutBackupVaultAccessPolicyCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/access-policy" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Policy !== undefined && input . Policy !== null && { Policy : input . Policy } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutBackupVaultLockConfigurationCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/vault-lock" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; body = JSON . stringify ( { ... ( input . ChangeableForDays !== undefined && input . ChangeableForDays !== null && { ChangeableForDays : input . ChangeableForDays } ) , ... ( input . MaxRetentionDays !== undefined && input . MaxRetentionDays !== null && { MaxRetentionDays : input . MaxRetentionDays } ) , ... ( input . MinRetentionDays !== undefined && input . MinRetentionDays !== null && { MinRetentionDays : input . MinRetentionDays } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutBackupVaultNotificationsCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/notification-configuration" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } let body ; body = JSON . stringify ( { ... ( input . BackupVaultEvents !== undefined && input . BackupVaultEvents !== null && { BackupVaultEvents : serializeAws_restJson1BackupVaultEvents ( input . BackupVaultEvents , context ) , } ) , ... ( input . SNSTopicArn !== undefined && input . SNSTopicArn !== null && { SNSTopicArn : input . SNSTopicArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartBackupJobCommand = 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 || "" }` + "/backup-jobs" ; let body ; body = JSON . stringify ( { ... ( input . BackupOptions !== undefined && input . BackupOptions !== null && { BackupOptions : serializeAws_restJson1BackupOptions ( input . BackupOptions , context ) , } ) , ... ( input . BackupVaultName !== undefined && input . BackupVaultName !== null && { BackupVaultName : input . BackupVaultName } ) , ... ( input . CompleteWindowMinutes !== undefined && input . CompleteWindowMinutes !== null && { CompleteWindowMinutes : input . CompleteWindowMinutes } ) , ... ( input . IamRoleArn !== undefined && input . IamRoleArn !== null && { IamRoleArn : input . IamRoleArn } ) , ... ( input . IdempotencyToken !== undefined && input . IdempotencyToken !== null && { IdempotencyToken : input . IdempotencyToken } ) , ... ( input . Lifecycle !== undefined && input . Lifecycle !== null && { Lifecycle : serializeAws_restJson1Lifecycle ( input . Lifecycle , context ) } ) , ... ( input . RecoveryPointTags !== undefined && input . RecoveryPointTags !== null && { RecoveryPointTags : serializeAws_restJson1Tags ( input . RecoveryPointTags , context ) , } ) , ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . StartWindowMinutes !== undefined && input . StartWindowMinutes !== null && { StartWindowMinutes : input . StartWindowMinutes } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartCopyJobCommand = 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 || "" }` + "/copy-jobs" ; let body ; body = JSON . stringify ( { ... ( input . DestinationBackupVaultArn !== undefined && input . DestinationBackupVaultArn !== null && { DestinationBackupVaultArn : input . DestinationBackupVaultArn } ) , ... ( input . IamRoleArn !== undefined && input . IamRoleArn !== null && { IamRoleArn : input . IamRoleArn } ) , ... ( input . IdempotencyToken !== undefined && input . IdempotencyToken !== null && { IdempotencyToken : input . IdempotencyToken } ) , ... ( input . Lifecycle !== undefined && input . Lifecycle !== null && { Lifecycle : serializeAws_restJson1Lifecycle ( input . Lifecycle , context ) } ) , ... ( input . RecoveryPointArn !== undefined && input . RecoveryPointArn !== null && { RecoveryPointArn : input . RecoveryPointArn } ) , ... ( input . SourceBackupVaultName !== undefined && input . SourceBackupVaultName !== null && { SourceBackupVaultName : input . SourceBackupVaultName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartReportJobCommand = 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 || "" }` + "/audit/report-jobs/{ReportPlanName}" ; if ( input . ReportPlanName !== undefined ) { const labelValue = input . ReportPlanName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportPlanName." ) ; } resolvedPath = resolvedPath . replace ( "{ReportPlanName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportPlanName." ) ; } let body ; body = JSON . stringify ( { IdempotencyToken : input . IdempotencyToken ?? generateIdempotencyToken ( ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartRestoreJobCommand = 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 || "" }` + "/restore-jobs" ; let body ; body = JSON . stringify ( { ... ( input . IamRoleArn !== undefined && input . IamRoleArn !== null && { IamRoleArn : input . IamRoleArn } ) , ... ( input . IdempotencyToken !== undefined && input . IdempotencyToken !== null && { IdempotencyToken : input . IdempotencyToken } ) , ... ( input . Metadata !== undefined && input . Metadata !== null && { Metadata : serializeAws_restJson1Metadata ( input . Metadata , context ) } ) , ... ( input . RecoveryPointArn !== undefined && input . RecoveryPointArn !== null && { RecoveryPointArn : input . RecoveryPointArn } ) , ... ( input . ResourceType !== undefined && input . ResourceType !== null && { ResourceType : input . ResourceType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StopBackupJobCommand = 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 || "" }` + "/backup-jobs/{BackupJobId}" ; if ( input . BackupJobId !== undefined ) { const labelValue = input . BackupJobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupJobId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupJobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupJobId." ) ; } let body ; 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_restJson1Tags ( 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 = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/untag/{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 . TagKeyList !== undefined && input . TagKeyList !== null && { TagKeyList : serializeAws_restJson1TagKeyList ( input . TagKeyList , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateBackupPlanCommand = 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 || "" }` + "/backup/plans/{BackupPlanId}" ; if ( input . BackupPlanId !== undefined ) { const labelValue = input . BackupPlanId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupPlanId." ) ; } resolvedPath = resolvedPath . replace ( "{BackupPlanId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupPlanId." ) ; } let body ; body = JSON . stringify ( { ... ( input . BackupPlan !== undefined && input . BackupPlan !== null && { BackupPlan : serializeAws_restJson1BackupPlanInput ( input . BackupPlan , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateFrameworkCommand = 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 || "" }` + "/audit/frameworks/{FrameworkName}" ; if ( input . FrameworkName !== undefined ) { const labelValue = input . FrameworkName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FrameworkName." ) ; } resolvedPath = resolvedPath . replace ( "{FrameworkName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FrameworkName." ) ; } let body ; body = JSON . stringify ( { ... ( input . FrameworkControls !== undefined && input . FrameworkControls !== null && { FrameworkControls : serializeAws_restJson1FrameworkControls ( input . FrameworkControls , context ) , } ) , ... ( input . FrameworkDescription !== undefined && input . FrameworkDescription !== null && { FrameworkDescription : input . FrameworkDescription } ) , IdempotencyToken : input . IdempotencyToken ?? generateIdempotencyToken ( ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateGlobalSettingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/global-settings" ; let body ; body = JSON . stringify ( { ... ( input . GlobalSettings !== undefined && input . GlobalSettings !== null && { GlobalSettings : serializeAws_restJson1GlobalSettings ( input . GlobalSettings , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRecoveryPointLifecycleCommand = 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 || "" }` + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}" ; if ( input . BackupVaultName !== undefined ) { const labelValue = input . BackupVaultName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: BackupVaultName." ) ; } resolvedPath = resolvedPath . replace ( "{BackupVaultName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: BackupVaultName." ) ; } if ( input . RecoveryPointArn !== undefined ) { const labelValue = input . RecoveryPointArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryPointArn." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryPointArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryPointArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . Lifecycle !== undefined && input . Lifecycle !== null && { Lifecycle : serializeAws_restJson1Lifecycle ( input . Lifecycle , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRegionSettingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account-settings" ; let body ; body = JSON . stringify ( { ... ( input . ResourceTypeManagementPreference !== undefined && input . ResourceTypeManagementPreference !== null && { ResourceTypeManagementPreference : serializeAws_restJson1ResourceTypeManagementPreference ( input . ResourceTypeManagementPreference , context ) , } ) , ... ( input . ResourceTypeOptInPreference !== undefined && input . ResourceTypeOptInPreference !== null && { ResourceTypeOptInPreference : serializeAws_restJson1ResourceTypeOptInPreference ( input . ResourceTypeOptInPreference , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateReportPlanCommand = 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 || "" }` + "/audit/report-plans/{ReportPlanName}" ; if ( input . ReportPlanName !== undefined ) { const labelValue = input . ReportPlanName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportPlanName." ) ; } resolvedPath = resolvedPath . replace ( "{ReportPlanName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportPlanName." ) ; } let body ; body = JSON . stringify ( { IdempotencyToken : input . IdempotencyToken ?? generateIdempotencyToken ( ) , ... ( input . ReportDeliveryChannel !== undefined && input . ReportDeliveryChannel !== null && { ReportDeliveryChannel : serializeAws_restJson1ReportDeliveryChannel ( input . ReportDeliveryChannel , context ) , } ) , ... ( input . ReportPlanDescription !== undefined && input . ReportPlanDescription !== null && { ReportPlanDescription : input . ReportPlanDescription } ) , ... ( input . ReportSetting !== undefined && input . ReportSetting !== null && { ReportSetting : serializeAws_restJson1ReportSetting ( input . ReportSetting , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateBackupPlanCommand = async ( output , context ) : Promise < CreateBackupPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateBackupPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AdvancedBackupSettings : undefined , BackupPlanArn : undefined , BackupPlanId : undefined , CreationDate : undefined , VersionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AdvancedBackupSettings !== undefined && data . AdvancedBackupSettings !== null ) { contents . AdvancedBackupSettings = deserializeAws_restJson1AdvancedBackupSettings ( data . AdvancedBackupSettings , context ) ; } if ( data . BackupPlanArn !== undefined && data . BackupPlanArn !== null ) { contents . BackupPlanArn = __expectString ( data . BackupPlanArn ) ; } if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . VersionId !== undefined && data . VersionId !== null ) { contents . VersionId = __expectString ( data . VersionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateBackupPlanCommandError = async ( output , context ) : Promise < CreateBackupPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateBackupSelectionCommand = async ( output , context ) : Promise < CreateBackupSelectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateBackupSelectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanId : undefined , CreationDate : undefined , SelectionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . SelectionId !== undefined && data . SelectionId !== null ) { contents . SelectionId = __expectString ( data . SelectionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateBackupSelectionCommandError = async ( output , context ) : Promise < CreateBackupSelectionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateBackupVaultCommand = async ( output , context ) : Promise < CreateBackupVaultCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateBackupVaultCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , BackupVaultName : undefined , CreationDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateBackupVaultCommandError = async ( output , context ) : Promise < CreateBackupVaultCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateFrameworkCommand = async ( output , context ) : Promise < CreateFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FrameworkArn : undefined , FrameworkName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . FrameworkArn !== undefined && data . FrameworkArn !== null ) { contents . FrameworkArn = __expectString ( data . FrameworkArn ) ; } if ( data . FrameworkName !== undefined && data . FrameworkName !== null ) { contents . FrameworkName = __expectString ( data . FrameworkName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateFrameworkCommandError = async ( output , context ) : Promise < CreateFrameworkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateReportPlanCommand = async ( output , context ) : Promise < CreateReportPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateReportPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationTime : undefined , ReportPlanArn : undefined , ReportPlanName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . ReportPlanArn !== undefined && data . ReportPlanArn !== null ) { contents . ReportPlanArn = __expectString ( data . ReportPlanArn ) ; } if ( data . ReportPlanName !== undefined && data . ReportPlanName !== null ) { contents . ReportPlanName = __expectString ( data . ReportPlanName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateReportPlanCommandError = async ( output , context ) : Promise < CreateReportPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupPlanCommand = async ( output , context ) : Promise < DeleteBackupPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanArn : undefined , BackupPlanId : undefined , DeletionDate : undefined , VersionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanArn !== undefined && data . BackupPlanArn !== null ) { contents . BackupPlanArn = __expectString ( data . BackupPlanArn ) ; } if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . DeletionDate !== undefined && data . DeletionDate !== null ) { contents . DeletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . DeletionDate ) ) ) ; } if ( data . VersionId !== undefined && data . VersionId !== null ) { contents . VersionId = __expectString ( data . VersionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupPlanCommandError = async ( output , context ) : Promise < DeleteBackupPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupSelectionCommand = async ( output , context ) : Promise < DeleteBackupSelectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupSelectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupSelectionCommandError = async ( output , context ) : Promise < DeleteBackupSelectionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupVaultCommand = async ( output , context ) : Promise < DeleteBackupVaultCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupVaultCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupVaultCommandError = async ( output , context ) : Promise < DeleteBackupVaultCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupVaultAccessPolicyCommand = async ( output , context ) : Promise < DeleteBackupVaultAccessPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupVaultAccessPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupVaultAccessPolicyCommandError = async ( output , context ) : Promise < DeleteBackupVaultAccessPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupVaultLockConfigurationCommand = async ( output , context ) : Promise < DeleteBackupVaultLockConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupVaultLockConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupVaultLockConfigurationCommandError = async ( output , context ) : Promise < DeleteBackupVaultLockConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteBackupVaultNotificationsCommand = async ( output , context ) : Promise < DeleteBackupVaultNotificationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBackupVaultNotificationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBackupVaultNotificationsCommandError = async ( output , context ) : Promise < DeleteBackupVaultNotificationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteFrameworkCommand = async ( output , context ) : Promise < DeleteFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteFrameworkCommandError = async ( output , context ) : Promise < DeleteFrameworkCommandOutput > => { 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.backup#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteRecoveryPointCommand = async ( output , context ) : Promise < DeleteRecoveryPointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRecoveryPointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRecoveryPointCommandError = async ( output , context ) : Promise < DeleteRecoveryPointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidResourceStateException" : case "com.amazonaws.backup#InvalidResourceStateException" : response = { ... ( await deserializeAws_restJson1InvalidResourceStateExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteReportPlanCommand = async ( output , context ) : Promise < DeleteReportPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteReportPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteReportPlanCommandError = async ( output , context ) : Promise < DeleteReportPlanCommandOutput > => { 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.backup#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeBackupJobCommand = async ( output , context ) : Promise < DescribeBackupJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeBackupJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AccountId : undefined , BackupJobId : undefined , BackupOptions : undefined , BackupSizeInBytes : undefined , BackupType : undefined , BackupVaultArn : undefined , BackupVaultName : undefined , BytesTransferred : undefined , CompletionDate : undefined , CreatedBy : undefined , CreationDate : undefined , ExpectedCompletionDate : undefined , IamRoleArn : undefined , PercentDone : undefined , RecoveryPointArn : undefined , ResourceArn : undefined , ResourceType : undefined , StartBy : undefined , State : undefined , StatusMessage : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AccountId !== undefined && data . AccountId !== null ) { contents . AccountId = __expectString ( data . AccountId ) ; } if ( data . BackupJobId !== undefined && data . BackupJobId !== null ) { contents . BackupJobId = __expectString ( data . BackupJobId ) ; } if ( data . BackupOptions !== undefined && data . BackupOptions !== null ) { contents . BackupOptions = deserializeAws_restJson1BackupOptions ( data . BackupOptions , context ) ; } if ( data . BackupSizeInBytes !== undefined && data . BackupSizeInBytes !== null ) { contents . BackupSizeInBytes = __expectLong ( data . BackupSizeInBytes ) ; } if ( data . BackupType !== undefined && data . BackupType !== null ) { contents . BackupType = __expectString ( data . BackupType ) ; } if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . BytesTransferred !== undefined && data . BytesTransferred !== null ) { contents . BytesTransferred = __expectLong ( data . BytesTransferred ) ; } if ( data . CompletionDate !== undefined && data . CompletionDate !== null ) { contents . CompletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CompletionDate ) ) ) ; } if ( data . CreatedBy !== undefined && data . CreatedBy !== null ) { contents . CreatedBy = deserializeAws_restJson1RecoveryPointCreator ( data . CreatedBy , context ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . ExpectedCompletionDate !== undefined && data . ExpectedCompletionDate !== null ) { contents . ExpectedCompletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . ExpectedCompletionDate ) ) ) ; } if ( data . IamRoleArn !== undefined && data . IamRoleArn !== null ) { contents . IamRoleArn = __expectString ( data . IamRoleArn ) ; } if ( data . PercentDone !== undefined && data . PercentDone !== null ) { contents . PercentDone = __expectString ( data . PercentDone ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } if ( data . ResourceArn !== undefined && data . ResourceArn !== null ) { contents . ResourceArn = __expectString ( data . ResourceArn ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } if ( data . StartBy !== undefined && data . StartBy !== null ) { contents . StartBy = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . StartBy ) ) ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . StatusMessage !== undefined && data . StatusMessage !== null ) { contents . StatusMessage = __expectString ( data . StatusMessage ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeBackupJobCommandError = async ( output , context ) : Promise < DescribeBackupJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "DependencyFailureException" : case "com.amazonaws.backup#DependencyFailureException" : response = { ... ( await deserializeAws_restJson1DependencyFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeBackupVaultCommand = async ( output , context ) : Promise < DescribeBackupVaultCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeBackupVaultCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , BackupVaultName : undefined , CreationDate : undefined , CreatorRequestId : undefined , EncryptionKeyArn : undefined , LockDate : undefined , Locked : undefined , MaxRetentionDays : undefined , MinRetentionDays : undefined , NumberOfRecoveryPoints : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . CreatorRequestId !== undefined && data . CreatorRequestId !== null ) { contents . CreatorRequestId = __expectString ( data . CreatorRequestId ) ; } if ( data . EncryptionKeyArn !== undefined && data . EncryptionKeyArn !== null ) { contents . EncryptionKeyArn = __expectString ( data . EncryptionKeyArn ) ; } if ( data . LockDate !== undefined && data . LockDate !== null ) { contents . LockDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LockDate ) ) ) ; } if ( data . Locked !== undefined && data . Locked !== null ) { contents . Locked = __expectBoolean ( data . Locked ) ; } if ( data . MaxRetentionDays !== undefined && data . MaxRetentionDays !== null ) { contents . MaxRetentionDays = __expectLong ( data . MaxRetentionDays ) ; } if ( data . MinRetentionDays !== undefined && data . MinRetentionDays !== null ) { contents . MinRetentionDays = __expectLong ( data . MinRetentionDays ) ; } if ( data . NumberOfRecoveryPoints !== undefined && data . NumberOfRecoveryPoints !== null ) { contents . NumberOfRecoveryPoints = __expectLong ( data . NumberOfRecoveryPoints ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeBackupVaultCommandError = async ( output , context ) : Promise < DescribeBackupVaultCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeCopyJobCommand = async ( output , context ) : Promise < DescribeCopyJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeCopyJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CopyJob : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CopyJob !== undefined && data . CopyJob !== null ) { contents . CopyJob = deserializeAws_restJson1CopyJob ( data . CopyJob , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeCopyJobCommandError = async ( output , context ) : Promise < DescribeCopyJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeFrameworkCommand = async ( output , context ) : Promise < DescribeFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationTime : undefined , DeploymentStatus : undefined , FrameworkArn : undefined , FrameworkControls : undefined , FrameworkDescription : undefined , FrameworkName : undefined , FrameworkStatus : undefined , IdempotencyToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . DeploymentStatus !== undefined && data . DeploymentStatus !== null ) { contents . DeploymentStatus = __expectString ( data . DeploymentStatus ) ; } if ( data . FrameworkArn !== undefined && data . FrameworkArn !== null ) { contents . FrameworkArn = __expectString ( data . FrameworkArn ) ; } if ( data . FrameworkControls !== undefined && data . FrameworkControls !== null ) { contents . FrameworkControls = deserializeAws_restJson1FrameworkControls ( data . FrameworkControls , context ) ; } if ( data . FrameworkDescription !== undefined && data . FrameworkDescription !== null ) { contents . FrameworkDescription = __expectString ( data . FrameworkDescription ) ; } if ( data . FrameworkName !== undefined && data . FrameworkName !== null ) { contents . FrameworkName = __expectString ( data . FrameworkName ) ; } if ( data . FrameworkStatus !== undefined && data . FrameworkStatus !== null ) { contents . FrameworkStatus = __expectString ( data . FrameworkStatus ) ; } if ( data . IdempotencyToken !== undefined && data . IdempotencyToken !== null ) { contents . IdempotencyToken = __expectString ( data . IdempotencyToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeFrameworkCommandError = async ( output , context ) : Promise < DescribeFrameworkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeGlobalSettingsCommand = async ( output , context ) : Promise < DescribeGlobalSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeGlobalSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GlobalSettings : undefined , LastUpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . GlobalSettings !== undefined && data . GlobalSettings !== null ) { contents . GlobalSettings = deserializeAws_restJson1GlobalSettings ( data . GlobalSettings , context ) ; } if ( data . LastUpdateTime !== undefined && data . LastUpdateTime !== null ) { contents . LastUpdateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeGlobalSettingsCommandError = async ( output , context ) : Promise < DescribeGlobalSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeProtectedResourceCommand = async ( output , context ) : Promise < DescribeProtectedResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeProtectedResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LastBackupTime : undefined , ResourceArn : undefined , ResourceType : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LastBackupTime !== undefined && data . LastBackupTime !== null ) { contents . LastBackupTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastBackupTime ) ) ) ; } if ( data . ResourceArn !== undefined && data . ResourceArn !== null ) { contents . ResourceArn = __expectString ( data . ResourceArn ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeProtectedResourceCommandError = async ( output , context ) : Promise < DescribeProtectedResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeRecoveryPointCommand = async ( output , context ) : Promise < DescribeRecoveryPointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeRecoveryPointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupSizeInBytes : undefined , BackupVaultArn : undefined , BackupVaultName : undefined , CalculatedLifecycle : undefined , CompletionDate : undefined , CreatedBy : undefined , CreationDate : undefined , EncryptionKeyArn : undefined , IamRoleArn : undefined , IsEncrypted : undefined , LastRestoreTime : undefined , Lifecycle : undefined , RecoveryPointArn : undefined , ResourceArn : undefined , ResourceType : undefined , SourceBackupVaultArn : undefined , Status : undefined , StatusMessage : undefined , StorageClass : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupSizeInBytes !== undefined && data . BackupSizeInBytes !== null ) { contents . BackupSizeInBytes = __expectLong ( data . BackupSizeInBytes ) ; } if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . CalculatedLifecycle !== undefined && data . CalculatedLifecycle !== null ) { contents . CalculatedLifecycle = deserializeAws_restJson1CalculatedLifecycle ( data . CalculatedLifecycle , context ) ; } if ( data . CompletionDate !== undefined && data . CompletionDate !== null ) { contents . CompletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CompletionDate ) ) ) ; } if ( data . CreatedBy !== undefined && data . CreatedBy !== null ) { contents . CreatedBy = deserializeAws_restJson1RecoveryPointCreator ( data . CreatedBy , context ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . EncryptionKeyArn !== undefined && data . EncryptionKeyArn !== null ) { contents . EncryptionKeyArn = __expectString ( data . EncryptionKeyArn ) ; } if ( data . IamRoleArn !== undefined && data . IamRoleArn !== null ) { contents . IamRoleArn = __expectString ( data . IamRoleArn ) ; } if ( data . IsEncrypted !== undefined && data . IsEncrypted !== null ) { contents . IsEncrypted = __expectBoolean ( data . IsEncrypted ) ; } if ( data . LastRestoreTime !== undefined && data . LastRestoreTime !== null ) { contents . LastRestoreTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastRestoreTime ) ) ) ; } if ( data . Lifecycle !== undefined && data . Lifecycle !== null ) { contents . Lifecycle = deserializeAws_restJson1Lifecycle ( data . Lifecycle , context ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } if ( data . ResourceArn !== undefined && data . ResourceArn !== null ) { contents . ResourceArn = __expectString ( data . ResourceArn ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } if ( data . SourceBackupVaultArn !== undefined && data . SourceBackupVaultArn !== null ) { contents . SourceBackupVaultArn = __expectString ( data . SourceBackupVaultArn ) ; } if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } if ( data . StatusMessage !== undefined && data . StatusMessage !== null ) { contents . StatusMessage = __expectString ( data . StatusMessage ) ; } if ( data . StorageClass !== undefined && data . StorageClass !== null ) { contents . StorageClass = __expectString ( data . StorageClass ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeRecoveryPointCommandError = async ( output , context ) : Promise < DescribeRecoveryPointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeRegionSettingsCommand = async ( output , context ) : Promise < DescribeRegionSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeRegionSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceTypeManagementPreference : undefined , ResourceTypeOptInPreference : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ResourceTypeManagementPreference !== undefined && data . ResourceTypeManagementPreference !== null ) { contents . ResourceTypeManagementPreference = deserializeAws_restJson1ResourceTypeManagementPreference ( data . ResourceTypeManagementPreference , context ) ; } if ( data . ResourceTypeOptInPreference !== undefined && data . ResourceTypeOptInPreference !== null ) { contents . ResourceTypeOptInPreference = deserializeAws_restJson1ResourceTypeOptInPreference ( data . ResourceTypeOptInPreference , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeRegionSettingsCommandError = async ( output , context ) : Promise < DescribeRegionSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeReportJobCommand = async ( output , context ) : Promise < DescribeReportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeReportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReportJob : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ReportJob !== undefined && data . ReportJob !== null ) { contents . ReportJob = deserializeAws_restJson1ReportJob ( data . ReportJob , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeReportJobCommandError = async ( output , context ) : Promise < DescribeReportJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeReportPlanCommand = async ( output , context ) : Promise < DescribeReportPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeReportPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReportPlan : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ReportPlan !== undefined && data . ReportPlan !== null ) { contents . ReportPlan = deserializeAws_restJson1ReportPlan ( data . ReportPlan , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeReportPlanCommandError = async ( output , context ) : Promise < DescribeReportPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeRestoreJobCommand = async ( output , context ) : Promise < DescribeRestoreJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeRestoreJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AccountId : undefined , BackupSizeInBytes : undefined , CompletionDate : undefined , CreatedResourceArn : undefined , CreationDate : undefined , ExpectedCompletionTimeMinutes : undefined , IamRoleArn : undefined , PercentDone : undefined , RecoveryPointArn : undefined , ResourceType : undefined , RestoreJobId : undefined , Status : undefined , StatusMessage : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AccountId !== undefined && data . AccountId !== null ) { contents . AccountId = __expectString ( data . AccountId ) ; } if ( data . BackupSizeInBytes !== undefined && data . BackupSizeInBytes !== null ) { contents . BackupSizeInBytes = __expectLong ( data . BackupSizeInBytes ) ; } if ( data . CompletionDate !== undefined && data . CompletionDate !== null ) { contents . CompletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CompletionDate ) ) ) ; } if ( data . CreatedResourceArn !== undefined && data . CreatedResourceArn !== null ) { contents . CreatedResourceArn = __expectString ( data . CreatedResourceArn ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . ExpectedCompletionTimeMinutes !== undefined && data . ExpectedCompletionTimeMinutes !== null ) { contents . ExpectedCompletionTimeMinutes = __expectLong ( data . ExpectedCompletionTimeMinutes ) ; } if ( data . IamRoleArn !== undefined && data . IamRoleArn !== null ) { contents . IamRoleArn = __expectString ( data . IamRoleArn ) ; } if ( data . PercentDone !== undefined && data . PercentDone !== null ) { contents . PercentDone = __expectString ( data . PercentDone ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } if ( data . RestoreJobId !== undefined && data . RestoreJobId !== null ) { contents . RestoreJobId = __expectString ( data . RestoreJobId ) ; } if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } if ( data . StatusMessage !== undefined && data . StatusMessage !== null ) { contents . StatusMessage = __expectString ( data . StatusMessage ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeRestoreJobCommandError = async ( output , context ) : Promise < DescribeRestoreJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "DependencyFailureException" : case "com.amazonaws.backup#DependencyFailureException" : response = { ... ( await deserializeAws_restJson1DependencyFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DisassociateRecoveryPointCommand = async ( output , context ) : Promise < DisassociateRecoveryPointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateRecoveryPointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateRecoveryPointCommandError = async ( output , context ) : Promise < DisassociateRecoveryPointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidResourceStateException" : case "com.amazonaws.backup#InvalidResourceStateException" : response = { ... ( await deserializeAws_restJson1InvalidResourceStateExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ExportBackupPlanTemplateCommand = async ( output , context ) : Promise < ExportBackupPlanTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ExportBackupPlanTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanTemplateJson : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanTemplateJson !== undefined && data . BackupPlanTemplateJson !== null ) { contents . BackupPlanTemplateJson = __expectString ( data . BackupPlanTemplateJson ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ExportBackupPlanTemplateCommandError = async ( output , context ) : Promise < ExportBackupPlanTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupPlanCommand = async ( output , context ) : Promise < GetBackupPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AdvancedBackupSettings : undefined , BackupPlan : undefined , BackupPlanArn : undefined , BackupPlanId : undefined , CreationDate : undefined , CreatorRequestId : undefined , DeletionDate : undefined , LastExecutionDate : undefined , VersionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AdvancedBackupSettings !== undefined && data . AdvancedBackupSettings !== null ) { contents . AdvancedBackupSettings = deserializeAws_restJson1AdvancedBackupSettings ( data . AdvancedBackupSettings , context ) ; } if ( data . BackupPlan !== undefined && data . BackupPlan !== null ) { contents . BackupPlan = deserializeAws_restJson1BackupPlan ( data . BackupPlan , context ) ; } if ( data . BackupPlanArn !== undefined && data . BackupPlanArn !== null ) { contents . BackupPlanArn = __expectString ( data . BackupPlanArn ) ; } if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . CreatorRequestId !== undefined && data . CreatorRequestId !== null ) { contents . CreatorRequestId = __expectString ( data . CreatorRequestId ) ; } if ( data . DeletionDate !== undefined && data . DeletionDate !== null ) { contents . DeletionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . DeletionDate ) ) ) ; } if ( data . LastExecutionDate !== undefined && data . LastExecutionDate !== null ) { contents . LastExecutionDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastExecutionDate ) ) ) ; } if ( data . VersionId !== undefined && data . VersionId !== null ) { contents . VersionId = __expectString ( data . VersionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupPlanCommandError = async ( output , context ) : Promise < GetBackupPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupPlanFromJSONCommand = async ( output , context ) : Promise < GetBackupPlanFromJSONCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupPlanFromJSONCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlan : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlan !== undefined && data . BackupPlan !== null ) { contents . BackupPlan = deserializeAws_restJson1BackupPlan ( data . BackupPlan , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupPlanFromJSONCommandError = async ( output , context ) : Promise < GetBackupPlanFromJSONCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupPlanFromTemplateCommand = async ( output , context ) : Promise < GetBackupPlanFromTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupPlanFromTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanDocument : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanDocument !== undefined && data . BackupPlanDocument !== null ) { contents . BackupPlanDocument = deserializeAws_restJson1BackupPlan ( data . BackupPlanDocument , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupPlanFromTemplateCommandError = async ( output , context ) : Promise < GetBackupPlanFromTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupSelectionCommand = async ( output , context ) : Promise < GetBackupSelectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupSelectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanId : undefined , BackupSelection : undefined , CreationDate : undefined , CreatorRequestId : undefined , SelectionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . BackupSelection !== undefined && data . BackupSelection !== null ) { contents . BackupSelection = deserializeAws_restJson1BackupSelection ( data . BackupSelection , context ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . CreatorRequestId !== undefined && data . CreatorRequestId !== null ) { contents . CreatorRequestId = __expectString ( data . CreatorRequestId ) ; } if ( data . SelectionId !== undefined && data . SelectionId !== null ) { contents . SelectionId = __expectString ( data . SelectionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupSelectionCommandError = async ( output , context ) : Promise < GetBackupSelectionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupVaultAccessPolicyCommand = async ( output , context ) : Promise < GetBackupVaultAccessPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupVaultAccessPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , BackupVaultName : undefined , Policy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = __expectString ( data . Policy ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupVaultAccessPolicyCommandError = async ( output , context ) : Promise < GetBackupVaultAccessPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetBackupVaultNotificationsCommand = async ( output , context ) : Promise < GetBackupVaultNotificationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBackupVaultNotificationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , BackupVaultEvents : undefined , BackupVaultName : undefined , SNSTopicArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . BackupVaultEvents !== undefined && data . BackupVaultEvents !== null ) { contents . BackupVaultEvents = deserializeAws_restJson1BackupVaultEvents ( data . BackupVaultEvents , context ) ; } if ( data . BackupVaultName !== undefined && data . BackupVaultName !== null ) { contents . BackupVaultName = __expectString ( data . BackupVaultName ) ; } if ( data . SNSTopicArn !== undefined && data . SNSTopicArn !== null ) { contents . SNSTopicArn = __expectString ( data . SNSTopicArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBackupVaultNotificationsCommandError = async ( output , context ) : Promise < GetBackupVaultNotificationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRecoveryPointRestoreMetadataCommand = async ( output , context ) : Promise < GetRecoveryPointRestoreMetadataCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRecoveryPointRestoreMetadataCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , RecoveryPointArn : undefined , RestoreMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } if ( data . RestoreMetadata !== undefined && data . RestoreMetadata !== null ) { contents . RestoreMetadata = deserializeAws_restJson1Metadata ( data . RestoreMetadata , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRecoveryPointRestoreMetadataCommandError = async ( output , context ) : Promise < GetRecoveryPointRestoreMetadataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetSupportedResourceTypesCommand = async ( output , context ) : Promise < GetSupportedResourceTypesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSupportedResourceTypesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceTypes : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ResourceTypes !== undefined && data . ResourceTypes !== null ) { contents . ResourceTypes = deserializeAws_restJson1ResourceTypes ( data . ResourceTypes , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSupportedResourceTypesCommandError = async ( output , context ) : Promise < GetSupportedResourceTypesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupJobsCommand = async ( output , context ) : Promise < ListBackupJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupJobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupJobs !== undefined && data . BackupJobs !== null ) { contents . BackupJobs = deserializeAws_restJson1BackupJobsList ( data . BackupJobs , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupJobsCommandError = async ( output , context ) : Promise < ListBackupJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupPlansCommand = async ( output , context ) : Promise < ListBackupPlansCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupPlansCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlansList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlansList !== undefined && data . BackupPlansList !== null ) { contents . BackupPlansList = deserializeAws_restJson1BackupPlansList ( data . BackupPlansList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupPlansCommandError = async ( output , context ) : Promise < ListBackupPlansCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupPlanTemplatesCommand = async ( output , context ) : Promise < ListBackupPlanTemplatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupPlanTemplatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanTemplatesList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanTemplatesList !== undefined && data . BackupPlanTemplatesList !== null ) { contents . BackupPlanTemplatesList = deserializeAws_restJson1BackupPlanTemplatesList ( data . BackupPlanTemplatesList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupPlanTemplatesCommandError = async ( output , context ) : Promise < ListBackupPlanTemplatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupPlanVersionsCommand = async ( output , context ) : Promise < ListBackupPlanVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupPlanVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPlanVersionsList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPlanVersionsList !== undefined && data . BackupPlanVersionsList !== null ) { contents . BackupPlanVersionsList = deserializeAws_restJson1BackupPlanVersionsList ( data . BackupPlanVersionsList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupPlanVersionsCommandError = async ( output , context ) : Promise < ListBackupPlanVersionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupSelectionsCommand = async ( output , context ) : Promise < ListBackupSelectionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupSelectionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupSelectionsList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupSelectionsList !== undefined && data . BackupSelectionsList !== null ) { contents . BackupSelectionsList = deserializeAws_restJson1BackupSelectionsList ( data . BackupSelectionsList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupSelectionsCommandError = async ( output , context ) : Promise < ListBackupSelectionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListBackupVaultsCommand = async ( output , context ) : Promise < ListBackupVaultsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBackupVaultsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultList : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultList !== undefined && data . BackupVaultList !== null ) { contents . BackupVaultList = deserializeAws_restJson1BackupVaultList ( data . BackupVaultList , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBackupVaultsCommandError = async ( output , context ) : Promise < ListBackupVaultsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListCopyJobsCommand = async ( output , context ) : Promise < ListCopyJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCopyJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CopyJobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CopyJobs !== undefined && data . CopyJobs !== null ) { contents . CopyJobs = deserializeAws_restJson1CopyJobsList ( data . CopyJobs , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCopyJobsCommandError = async ( output , context ) : Promise < ListCopyJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListFrameworksCommand = async ( output , context ) : Promise < ListFrameworksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListFrameworksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Frameworks : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Frameworks !== undefined && data . Frameworks !== null ) { contents . Frameworks = deserializeAws_restJson1FrameworkList ( data . Frameworks , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListFrameworksCommandError = async ( output , context ) : Promise < ListFrameworksCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListProtectedResourcesCommand = async ( output , context ) : Promise < ListProtectedResourcesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListProtectedResourcesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Results : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Results !== undefined && data . Results !== null ) { contents . Results = deserializeAws_restJson1ProtectedResourcesList ( data . Results , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListProtectedResourcesCommandError = async ( output , context ) : Promise < ListProtectedResourcesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListRecoveryPointsByBackupVaultCommand = async ( output , context ) : Promise < ListRecoveryPointsByBackupVaultCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRecoveryPointsByBackupVaultCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , RecoveryPoints : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . RecoveryPoints !== undefined && data . RecoveryPoints !== null ) { contents . RecoveryPoints = deserializeAws_restJson1RecoveryPointByBackupVaultList ( data . RecoveryPoints , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRecoveryPointsByBackupVaultCommandError = async ( output , context ) : Promise < ListRecoveryPointsByBackupVaultCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListRecoveryPointsByResourceCommand = async ( output , context ) : Promise < ListRecoveryPointsByResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRecoveryPointsByResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , RecoveryPoints : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . RecoveryPoints !== undefined && data . RecoveryPoints !== null ) { contents . RecoveryPoints = deserializeAws_restJson1RecoveryPointByResourceList ( data . RecoveryPoints , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRecoveryPointsByResourceCommandError = async ( output , context ) : Promise < ListRecoveryPointsByResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListReportJobsCommand = async ( output , context ) : Promise < ListReportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListReportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ReportJobs : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . ReportJobs !== undefined && data . ReportJobs !== null ) { contents . ReportJobs = deserializeAws_restJson1ReportJobList ( data . ReportJobs , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListReportJobsCommandError = async ( output , context ) : Promise < ListReportJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListReportPlansCommand = async ( output , context ) : Promise < ListReportPlansCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListReportPlansCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ReportPlans : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . ReportPlans !== undefined && data . ReportPlans !== null ) { contents . ReportPlans = deserializeAws_restJson1ReportPlanList ( data . ReportPlans , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListReportPlansCommandError = async ( output , context ) : Promise < ListReportPlansCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListRestoreJobsCommand = async ( output , context ) : Promise < ListRestoreJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRestoreJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , RestoreJobs : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . RestoreJobs !== undefined && data . RestoreJobs !== null ) { contents . RestoreJobs = deserializeAws_restJson1RestoreJobsList ( data . RestoreJobs , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRestoreJobsCommandError = async ( output , context ) : Promise < ListRestoreJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsCommand = async ( output , context ) : Promise < ListTagsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsCommandError = async ( output , context ) : Promise < ListTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutBackupVaultAccessPolicyCommand = async ( output , context ) : Promise < PutBackupVaultAccessPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutBackupVaultAccessPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutBackupVaultAccessPolicyCommandError = async ( output , context ) : Promise < PutBackupVaultAccessPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutBackupVaultLockConfigurationCommand = async ( output , context ) : Promise < PutBackupVaultLockConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutBackupVaultLockConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutBackupVaultLockConfigurationCommandError = async ( output , context ) : Promise < PutBackupVaultLockConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutBackupVaultNotificationsCommand = async ( output , context ) : Promise < PutBackupVaultNotificationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutBackupVaultNotificationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutBackupVaultNotificationsCommandError = async ( output , context ) : Promise < PutBackupVaultNotificationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StartBackupJobCommand = async ( output , context ) : Promise < StartBackupJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartBackupJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupJobId : undefined , CreationDate : undefined , RecoveryPointArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupJobId !== undefined && data . BackupJobId !== null ) { contents . BackupJobId = __expectString ( data . BackupJobId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartBackupJobCommandError = async ( output , context ) : Promise < StartBackupJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StartCopyJobCommand = async ( output , context ) : Promise < StartCopyJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartCopyJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CopyJobId : undefined , CreationDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CopyJobId !== undefined && data . CopyJobId !== null ) { contents . CopyJobId = __expectString ( data . CopyJobId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartCopyJobCommandError = async ( output , context ) : Promise < StartCopyJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StartReportJobCommand = async ( output , context ) : Promise < StartReportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartReportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReportJobId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ReportJobId !== undefined && data . ReportJobId !== null ) { contents . ReportJobId = __expectString ( data . ReportJobId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartReportJobCommandError = async ( output , context ) : Promise < StartReportJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StartRestoreJobCommand = async ( output , context ) : Promise < StartRestoreJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartRestoreJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RestoreJobId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . RestoreJobId !== undefined && data . RestoreJobId !== null ) { contents . RestoreJobId = __expectString ( data . RestoreJobId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartRestoreJobCommandError = async ( output , context ) : Promise < StartRestoreJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StopBackupJobCommand = async ( output , context ) : Promise < StopBackupJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StopBackupJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StopBackupJobCommandError = async ( output , context ) : Promise < StopBackupJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const 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 "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const 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 "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateBackupPlanCommand = async ( output , context ) : Promise < UpdateBackupPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateBackupPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AdvancedBackupSettings : undefined , BackupPlanArn : undefined , BackupPlanId : undefined , CreationDate : undefined , VersionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AdvancedBackupSettings !== undefined && data . AdvancedBackupSettings !== null ) { contents . AdvancedBackupSettings = deserializeAws_restJson1AdvancedBackupSettings ( data . AdvancedBackupSettings , context ) ; } if ( data . BackupPlanArn !== undefined && data . BackupPlanArn !== null ) { contents . BackupPlanArn = __expectString ( data . BackupPlanArn ) ; } if ( data . BackupPlanId !== undefined && data . BackupPlanId !== null ) { contents . BackupPlanId = __expectString ( data . BackupPlanId ) ; } if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationDate ) ) ) ; } if ( data . VersionId !== undefined && data . VersionId !== null ) { contents . VersionId = __expectString ( data . VersionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateBackupPlanCommandError = async ( output , context ) : Promise < UpdateBackupPlanCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateFrameworkCommand = async ( output , context ) : Promise < UpdateFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationTime : undefined , FrameworkArn : undefined , FrameworkName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . FrameworkArn !== undefined && data . FrameworkArn !== null ) { contents . FrameworkArn = __expectString ( data . FrameworkArn ) ; } if ( data . FrameworkName !== undefined && data . FrameworkName !== null ) { contents . FrameworkName = __expectString ( data . FrameworkName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateFrameworkCommandError = async ( output , context ) : Promise < UpdateFrameworkCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.backup#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.backup#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.backup#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateGlobalSettingsCommand = async ( output , context ) : Promise < UpdateGlobalSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGlobalSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGlobalSettingsCommandError = async ( output , context ) : Promise < UpdateGlobalSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateRecoveryPointLifecycleCommand = async ( output , context ) : Promise < UpdateRecoveryPointLifecycleCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRecoveryPointLifecycleCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupVaultArn : undefined , CalculatedLifecycle : undefined , Lifecycle : undefined , RecoveryPointArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupVaultArn !== undefined && data . BackupVaultArn !== null ) { contents . BackupVaultArn = __expectString ( data . BackupVaultArn ) ; } if ( data . CalculatedLifecycle !== undefined && data . CalculatedLifecycle !== null ) { contents . CalculatedLifecycle = deserializeAws_restJson1CalculatedLifecycle ( data . CalculatedLifecycle , context ) ; } if ( data . Lifecycle !== undefined && data . Lifecycle !== null ) { contents . Lifecycle = deserializeAws_restJson1Lifecycle ( data . Lifecycle , context ) ; } if ( data . RecoveryPointArn !== undefined && data . RecoveryPointArn !== null ) { contents . RecoveryPointArn = __expectString ( data . RecoveryPointArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRecoveryPointLifecycleCommandError = async ( output , context ) : Promise < UpdateRecoveryPointLifecycleCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.backup#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateRegionSettingsCommand = async ( output , context ) : Promise < UpdateRegionSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRegionSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRegionSettingsCommandError = async ( output , context ) : Promise < UpdateRegionSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateReportPlanCommand = async ( output , context ) : Promise < UpdateReportPlanCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateReportPlanCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationTime : undefined , ReportPlanArn : undefined , ReportPlanName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . ReportPlanArn !== undefined && data . ReportPlanArn !== null ) { contents . ReportPlanArn = __expectString ( data . ReportPlanArn ) ; } if ( data . ReportPlanName !== undefined && data . ReportPlanName !== null ) { contents . ReportPlanName = __expectString ( data . ReportPlanName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateReportPlanCommandError = async ( output , context ) : Promise < UpdateReportPlanCommandOutput > => { 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.backup#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterValueException" : case "com.amazonaws.backup#InvalidParameterValueException" : response = { ... ( await deserializeAws_restJson1InvalidParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MissingParameterValueException" : case "com.amazonaws.backup#MissingParameterValueException" : response = { ... ( await deserializeAws_restJson1MissingParameterValueExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.backup#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.backup#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } 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_restJson1AlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < AlreadyExistsException > => { const contents = { name : "AlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Arn : undefined , Code : undefined , Context : undefined , CreatorRequestId : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . CreatorRequestId !== undefined && data . CreatorRequestId !== null ) { contents . CreatorRequestId = __expectString ( data . CreatorRequestId ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1DependencyFailureExceptionResponse = async ( parsedOutput , context ) : Promise < DependencyFailureException > => { const contents = { name : "DependencyFailureException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1InvalidParameterValueExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterValueException > => { const contents = { name : "InvalidParameterValueException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1InvalidRequestExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidRequestException > => { const contents = { name : "InvalidRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1InvalidResourceStateExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidResourceStateException > => { const contents = { name : "InvalidResourceStateException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1MissingParameterValueExceptionResponse = async ( parsedOutput , context ) : Promise < MissingParameterValueException > => { const contents = { name : "MissingParameterValueException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Context : undefined , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Context !== undefined && data . Context !== null ) { contents . Context = __expectString ( data . Context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return contents ; } ; const serializeAws_restJson1AdvancedBackupSetting = ( input , context ) : any => { return { ... ( input . BackupOptions !== undefined && input . BackupOptions !== null && { BackupOptions : serializeAws_restJson1BackupOptions ( input . BackupOptions , context ) , } ) , ... ( input . ResourceType !== undefined && input . ResourceType !== null && { ResourceType : input . ResourceType } ) , } ; } ; const serializeAws_restJson1AdvancedBackupSettings = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AdvancedBackupSetting ( entry , context ) ; } ) ; } ; const serializeAws_restJson1BackupOptions = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1BackupPlanInput = ( input , context ) : any => { return { ... ( input . AdvancedBackupSettings !== undefined && input . AdvancedBackupSettings !== null && { AdvancedBackupSettings : serializeAws_restJson1AdvancedBackupSettings ( input . AdvancedBackupSettings , context ) , } ) , ... ( input . BackupPlanName !== undefined && input . BackupPlanName !== null && { BackupPlanName : input . BackupPlanName } ) , ... ( input . Rules !== undefined && input . Rules !== null && { Rules : serializeAws_restJson1BackupRulesInput ( input . Rules , context ) } ) , } ; } ; const serializeAws_restJson1BackupRuleInput = ( input , context ) : any => { return { ... ( input . CompletionWindowMinutes !== undefined && input . CompletionWindowMinutes !== null && { CompletionWindowMinutes : input . CompletionWindowMinutes } ) , ... ( input . CopyActions !== undefined && input . CopyActions !== null && { CopyActions : serializeAws_restJson1CopyActions ( input . CopyActions , context ) } ) , ... ( input . EnableContinuousBackup !== undefined && input . EnableContinuousBackup !== null && { EnableContinuousBackup : input . EnableContinuousBackup } ) , ... ( input . Lifecycle !== undefined && input . Lifecycle !== null && { Lifecycle : serializeAws_restJson1Lifecycle ( input . Lifecycle , context ) } ) , ... ( input . RecoveryPointTags !== undefined && input . RecoveryPointTags !== null && { RecoveryPointTags : serializeAws_restJson1Tags ( input . RecoveryPointTags , context ) , } ) , ... ( input . RuleName !== undefined && input . RuleName !== null && { RuleName : input . RuleName } ) , ... ( input . ScheduleExpression !== undefined && input . ScheduleExpression !== null && { ScheduleExpression : input . ScheduleExpression } ) , ... ( input . StartWindowMinutes !== undefined && input . StartWindowMinutes !== null && { StartWindowMinutes : input . StartWindowMinutes } ) , ... ( input . TargetBackupVaultName !== undefined && input . TargetBackupVaultName !== null && { TargetBackupVaultName : input . TargetBackupVaultName } ) , } ; } ; const serializeAws_restJson1BackupRulesInput = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1BackupRuleInput ( entry , context ) ; } ) ; } ; const serializeAws_restJson1BackupSelection = ( input , context ) : any => { return { ... ( input . Conditions !== undefined && input . Conditions !== null && { Conditions : serializeAws_restJson1Conditions ( input . Conditions , context ) } ) , ... ( input . IamRoleArn !== undefined && input . IamRoleArn !== null && { IamRoleArn : input . IamRoleArn } ) , ... ( input . ListOfTags !== undefined && input . ListOfTags !== null && { ListOfTags : serializeAws_restJson1ListOfTags ( input . ListOfTags , context ) } ) , ... ( input . NotResources !== undefined && input . NotResources !== null && { NotResources : serializeAws_restJson1ResourceArns ( input . NotResources , context ) } ) , ... ( input . Resources !== undefined && input . Resources !== null && { Resources : serializeAws_restJson1ResourceArns ( input . Resources , context ) } ) , ... ( input . SelectionName !== undefined && input . SelectionName !== null && { SelectionName : input . SelectionName } ) , } ; } ; const serializeAws_restJson1BackupVaultEvents = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ComplianceResourceIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Condition = ( input , context ) : any => { return { ... ( input . ConditionKey !== undefined && input . ConditionKey !== null && { ConditionKey : input . ConditionKey } ) , ... ( input . ConditionType !== undefined && input . ConditionType !== null && { ConditionType : input . ConditionType } ) , ... ( input . ConditionValue !== undefined && input . ConditionValue !== null && { ConditionValue : input . ConditionValue } ) , } ; } ; const serializeAws_restJson1ConditionParameter = ( input , context ) : any => { return { ... ( input . ConditionKey !== undefined && input . ConditionKey !== null && { ConditionKey : input . ConditionKey } ) , ... ( input . ConditionValue !== undefined && input . ConditionValue !== null && { ConditionValue : input . ConditionValue } ) , } ; } ; const serializeAws_restJson1ConditionParameters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ConditionParameter ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Conditions = ( input , context ) : any => { return { ... ( input . StringEquals !== undefined && input . StringEquals !== null && { StringEquals : serializeAws_restJson1ConditionParameters ( input . StringEquals , context ) , } ) , ... ( input . StringLike !== undefined && input . StringLike !== null && { StringLike : serializeAws_restJson1ConditionParameters ( input . StringLike , context ) , } ) , ... ( input . StringNotEquals !== undefined && input . StringNotEquals !== null && { StringNotEquals : serializeAws_restJson1ConditionParameters ( input . StringNotEquals , context ) , } ) , ... ( input . StringNotLike !== undefined && input . StringNotLike !== null && { StringNotLike : serializeAws_restJson1ConditionParameters ( input . StringNotLike , context ) , } ) , } ; } ; const serializeAws_restJson1ControlInputParameter = ( input , context ) : any => { return { ... ( input . ParameterName !== undefined && input . ParameterName !== null && { ParameterName : input . ParameterName } ) , ... ( input . ParameterValue !== undefined && input . ParameterValue !== null && { ParameterValue : input . ParameterValue } ) , } ; } ; const serializeAws_restJson1ControlInputParameters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ControlInputParameter ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ControlScope = ( input , context ) : any => { return { ... ( input . ComplianceResourceIds !== undefined && input . ComplianceResourceIds !== null && { ComplianceResourceIds : serializeAws_restJson1ComplianceResourceIdList ( input . ComplianceResourceIds , context ) , } ) , ... ( input . ComplianceResourceTypes !== undefined && input . ComplianceResourceTypes !== null && { ComplianceResourceTypes : serializeAws_restJson1ResourceTypeList ( input . ComplianceResourceTypes , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1stringMap ( input . Tags , context ) } ) , } ; } ; const serializeAws_restJson1CopyAction = ( input , context ) : any => { return { ... ( input . DestinationBackupVaultArn !== undefined && input . DestinationBackupVaultArn !== null && { DestinationBackupVaultArn : input . DestinationBackupVaultArn } ) , ... ( input . Lifecycle !== undefined && input . Lifecycle !== null && { Lifecycle : serializeAws_restJson1Lifecycle ( input . Lifecycle , context ) } ) , } ; } ; const serializeAws_restJson1CopyActions = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CopyAction ( entry , context ) ; } ) ; } ; const serializeAws_restJson1FormatList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1FrameworkControl = ( input , context ) : any => { return { ... ( input . ControlInputParameters !== undefined && input . ControlInputParameters !== null && { ControlInputParameters : serializeAws_restJson1ControlInputParameters ( input . ControlInputParameters , context ) , } ) , ... ( input . ControlName !== undefined && input . ControlName !== null && { ControlName : input . ControlName } ) , ... ( input . ControlScope !== undefined && input . ControlScope !== null && { ControlScope : serializeAws_restJson1ControlScope ( input . ControlScope , context ) } ) , } ; } ; const serializeAws_restJson1FrameworkControls = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1FrameworkControl ( entry , context ) ; } ) ; } ; const serializeAws_restJson1GlobalSettings = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1Lifecycle = ( input , context ) : any => { return { ... ( input . DeleteAfterDays !== undefined && input . DeleteAfterDays !== null && { DeleteAfterDays : input . DeleteAfterDays } ) , ... ( input . MoveToColdStorageAfterDays !== undefined && input . MoveToColdStorageAfterDays !== null && { MoveToColdStorageAfterDays : input . MoveToColdStorageAfterDays } ) , } ; } ; const serializeAws_restJson1ListOfTags = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Condition ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Metadata = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1ReportDeliveryChannel = ( input , context ) : any => { return { ... ( input . Formats !== undefined && input . Formats !== null && { Formats : serializeAws_restJson1FormatList ( input . Formats , context ) } ) , ... ( input . S3BucketName !== undefined && input . S3BucketName !== null && { S3BucketName : input . S3BucketName } ) , ... ( input . S3KeyPrefix !== undefined && input . S3KeyPrefix !== null && { S3KeyPrefix : input . S3KeyPrefix } ) , } ; } ; const serializeAws_restJson1ReportSetting = ( input , context ) : any => { return { ... ( input . FrameworkArns !== undefined && input . FrameworkArns !== null && { FrameworkArns : serializeAws_restJson1stringList ( input . FrameworkArns , context ) , } ) , ... ( input . NumberOfFrameworks !== undefined && input . NumberOfFrameworks !== null && { NumberOfFrameworks : input . NumberOfFrameworks } ) , ... ( input . ReportTemplate !== undefined && input . ReportTemplate !== null && { ReportTemplate : input . ReportTemplate } ) , } ; } ; const serializeAws_restJson1ResourceArns = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ResourceTypeList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ResourceTypeManagementPreference = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1ResourceTypeOptInPreference = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1stringList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1stringMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1TagKeyList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Tags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const deserializeAws_restJson1AdvancedBackupSetting = ( output , context ) : AdvancedBackupSetting => { return { BackupOptions : output . BackupOptions !== undefined && output . BackupOptions !== null ? deserializeAws_restJson1BackupOptions ( output . BackupOptions , context ) : undefined , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1AdvancedBackupSettings = ( output , context ) : AdvancedBackupSetting [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AdvancedBackupSetting ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupJob = ( output , context ) : BackupJob => { return { AccountId : __expectString ( output . AccountId ) , BackupJobId : __expectString ( output . BackupJobId ) , BackupOptions : output . BackupOptions !== undefined && output . BackupOptions !== null ? deserializeAws_restJson1BackupOptions ( output . BackupOptions , context ) : undefined , BackupSizeInBytes : __expectLong ( output . BackupSizeInBytes ) , BackupType : __expectString ( output . BackupType ) , BackupVaultArn : __expectString ( output . BackupVaultArn ) , BackupVaultName : __expectString ( output . BackupVaultName ) , BytesTransferred : __expectLong ( output . BytesTransferred ) , CompletionDate : output . CompletionDate !== undefined && output . CompletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompletionDate ) ) ) : undefined , CreatedBy : output . CreatedBy !== undefined && output . CreatedBy !== null ? deserializeAws_restJson1RecoveryPointCreator ( output . CreatedBy , context ) : undefined , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , ExpectedCompletionDate : output . ExpectedCompletionDate !== undefined && output . ExpectedCompletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ExpectedCompletionDate ) ) ) : undefined , IamRoleArn : __expectString ( output . IamRoleArn ) , PercentDone : __expectString ( output . PercentDone ) , RecoveryPointArn : __expectString ( output . RecoveryPointArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceType : __expectString ( output . ResourceType ) , StartBy : output . StartBy !== undefined && output . StartBy !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . StartBy ) ) ) : undefined , State : __expectString ( output . State ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1BackupJobsList = ( output , context ) : BackupJob [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupJob ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupOptions = ( 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_restJson1BackupPlan = ( output , context ) : BackupPlan => { return { AdvancedBackupSettings : output . AdvancedBackupSettings !== undefined && output . AdvancedBackupSettings !== null ? deserializeAws_restJson1AdvancedBackupSettings ( output . AdvancedBackupSettings , context ) : undefined , BackupPlanName : __expectString ( output . BackupPlanName ) , Rules : output . Rules !== undefined && output . Rules !== null ? deserializeAws_restJson1BackupRules ( output . Rules , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BackupPlansList = ( output , context ) : BackupPlansListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupPlansListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupPlansListMember = ( output , context ) : BackupPlansListMember => { return { AdvancedBackupSettings : output . AdvancedBackupSettings !== undefined && output . AdvancedBackupSettings !== null ? deserializeAws_restJson1AdvancedBackupSettings ( output . AdvancedBackupSettings , context ) : undefined , BackupPlanArn : __expectString ( output . BackupPlanArn ) , BackupPlanId : __expectString ( output . BackupPlanId ) , BackupPlanName : __expectString ( output . BackupPlanName ) , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , CreatorRequestId : __expectString ( output . CreatorRequestId ) , DeletionDate : output . DeletionDate !== undefined && output . DeletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . DeletionDate ) ) ) : undefined , LastExecutionDate : output . LastExecutionDate !== undefined && output . LastExecutionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastExecutionDate ) ) ) : undefined , VersionId : __expectString ( output . VersionId ) , } as any ; } ; const deserializeAws_restJson1BackupPlanTemplatesList = ( output , context ) : BackupPlanTemplatesListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupPlanTemplatesListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupPlanTemplatesListMember = ( output , context ) : BackupPlanTemplatesListMember => { return { BackupPlanTemplateId : __expectString ( output . BackupPlanTemplateId ) , BackupPlanTemplateName : __expectString ( output . BackupPlanTemplateName ) , } as any ; } ; const deserializeAws_restJson1BackupPlanVersionsList = ( output , context ) : BackupPlansListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupPlansListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupRule = ( output , context ) : BackupRule => { return { CompletionWindowMinutes : __expectLong ( output . CompletionWindowMinutes ) , CopyActions : output . CopyActions !== undefined && output . CopyActions !== null ? deserializeAws_restJson1CopyActions ( output . CopyActions , context ) : undefined , EnableContinuousBackup : __expectBoolean ( output . EnableContinuousBackup ) , Lifecycle : output . Lifecycle !== undefined && output . Lifecycle !== null ? deserializeAws_restJson1Lifecycle ( output . Lifecycle , context ) : undefined , RecoveryPointTags : output . RecoveryPointTags !== undefined && output . RecoveryPointTags !== null ? deserializeAws_restJson1Tags ( output . RecoveryPointTags , context ) : undefined , RuleId : __expectString ( output . RuleId ) , RuleName : __expectString ( output . RuleName ) , ScheduleExpression : __expectString ( output . ScheduleExpression ) , StartWindowMinutes : __expectLong ( output . StartWindowMinutes ) , TargetBackupVaultName : __expectString ( output . TargetBackupVaultName ) , } as any ; } ; const deserializeAws_restJson1BackupRules = ( output , context ) : BackupRule [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupRule ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupSelection = ( output , context ) : BackupSelection => { return { Conditions : output . Conditions !== undefined && output . Conditions !== null ? deserializeAws_restJson1Conditions ( output . Conditions , context ) : undefined , IamRoleArn : __expectString ( output . IamRoleArn ) , ListOfTags : output . ListOfTags !== undefined && output . ListOfTags !== null ? deserializeAws_restJson1ListOfTags ( output . ListOfTags , context ) : undefined , NotResources : output . NotResources !== undefined && output . NotResources !== null ? deserializeAws_restJson1ResourceArns ( output . NotResources , context ) : undefined , Resources : output . Resources !== undefined && output . Resources !== null ? deserializeAws_restJson1ResourceArns ( output . Resources , context ) : undefined , SelectionName : __expectString ( output . SelectionName ) , } as any ; } ; const deserializeAws_restJson1BackupSelectionsList = ( output , context ) : BackupSelectionsListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupSelectionsListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupSelectionsListMember = ( output , context ) : BackupSelectionsListMember => { return { BackupPlanId : __expectString ( output . BackupPlanId ) , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , CreatorRequestId : __expectString ( output . CreatorRequestId ) , IamRoleArn : __expectString ( output . IamRoleArn ) , SelectionId : __expectString ( output . SelectionId ) , SelectionName : __expectString ( output . SelectionName ) , } as any ; } ; const deserializeAws_restJson1BackupVaultEvents = ( output , context ) : ( BackupVaultEvent | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1BackupVaultList = ( output , context ) : BackupVaultListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BackupVaultListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupVaultListMember = ( output , context ) : BackupVaultListMember => { return { BackupVaultArn : __expectString ( output . BackupVaultArn ) , BackupVaultName : __expectString ( output . BackupVaultName ) , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , CreatorRequestId : __expectString ( output . CreatorRequestId ) , EncryptionKeyArn : __expectString ( output . EncryptionKeyArn ) , LockDate : output . LockDate !== undefined && output . LockDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LockDate ) ) ) : undefined , Locked : __expectBoolean ( output . Locked ) , MaxRetentionDays : __expectLong ( output . MaxRetentionDays ) , MinRetentionDays : __expectLong ( output . MinRetentionDays ) , NumberOfRecoveryPoints : __expectLong ( output . NumberOfRecoveryPoints ) , } as any ; } ; const deserializeAws_restJson1CalculatedLifecycle = ( output , context ) : CalculatedLifecycle => { return { DeleteAt : output . DeleteAt !== undefined && output . DeleteAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . DeleteAt ) ) ) : undefined , MoveToColdStorageAt : output . MoveToColdStorageAt !== undefined && output . MoveToColdStorageAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . MoveToColdStorageAt ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ComplianceResourceIdList = ( 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_restJson1Condition = ( output , context ) : Condition => { return { ConditionKey : __expectString ( output . ConditionKey ) , ConditionType : __expectString ( output . ConditionType ) , ConditionValue : __expectString ( output . ConditionValue ) , } as any ; } ; const deserializeAws_restJson1ConditionParameter = ( output , context ) : ConditionParameter => { return { ConditionKey : __expectString ( output . ConditionKey ) , ConditionValue : __expectString ( output . ConditionValue ) , } as any ; } ; const deserializeAws_restJson1ConditionParameters = ( output , context ) : ConditionParameter [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ConditionParameter ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Conditions = ( output , context ) : Conditions => { return { StringEquals : output . StringEquals !== undefined && output . StringEquals !== null ? deserializeAws_restJson1ConditionParameters ( output . StringEquals , context ) : undefined , StringLike : output . StringLike !== undefined && output . StringLike !== null ? deserializeAws_restJson1ConditionParameters ( output . StringLike , context ) : undefined , StringNotEquals : output . StringNotEquals !== undefined && output . StringNotEquals !== null ? deserializeAws_restJson1ConditionParameters ( output . StringNotEquals , context ) : undefined , StringNotLike : output . StringNotLike !== undefined && output . StringNotLike !== null ? deserializeAws_restJson1ConditionParameters ( output . StringNotLike , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ControlInputParameter = ( output , context ) : ControlInputParameter => { return { ParameterName : __expectString ( output . ParameterName ) , ParameterValue : __expectString ( output . ParameterValue ) , } as any ; } ; const deserializeAws_restJson1ControlInputParameters = ( output , context ) : ControlInputParameter [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlInputParameter ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlScope = ( output , context ) : ControlScope => { return { ComplianceResourceIds : output . ComplianceResourceIds !== undefined && output . ComplianceResourceIds !== null ? deserializeAws_restJson1ComplianceResourceIdList ( output . ComplianceResourceIds , context ) : undefined , ComplianceResourceTypes : output . ComplianceResourceTypes !== undefined && output . ComplianceResourceTypes !== null ? deserializeAws_restJson1ResourceTypeList ( output . ComplianceResourceTypes , context ) : undefined , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1stringMap ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CopyAction = ( output , context ) : CopyAction => { return { DestinationBackupVaultArn : __expectString ( output . DestinationBackupVaultArn ) , Lifecycle : output . Lifecycle !== undefined && output . Lifecycle !== null ? deserializeAws_restJson1Lifecycle ( output . Lifecycle , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CopyActions = ( output , context ) : CopyAction [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CopyAction ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CopyJob = ( output , context ) : CopyJob => { return { AccountId : __expectString ( output . AccountId ) , BackupSizeInBytes : __expectLong ( output . BackupSizeInBytes ) , CompletionDate : output . CompletionDate !== undefined && output . CompletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompletionDate ) ) ) : undefined , CopyJobId : __expectString ( output . CopyJobId ) , CreatedBy : output . CreatedBy !== undefined && output . CreatedBy !== null ? deserializeAws_restJson1RecoveryPointCreator ( output . CreatedBy , context ) : undefined , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , DestinationBackupVaultArn : __expectString ( output . DestinationBackupVaultArn ) , DestinationRecoveryPointArn : __expectString ( output . DestinationRecoveryPointArn ) , IamRoleArn : __expectString ( output . IamRoleArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceType : __expectString ( output . ResourceType ) , SourceBackupVaultArn : __expectString ( output . SourceBackupVaultArn ) , SourceRecoveryPointArn : __expectString ( output . SourceRecoveryPointArn ) , State : __expectString ( output . State ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1CopyJobsList = ( output , context ) : CopyJob [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CopyJob ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1FormatList = ( 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_restJson1Framework = ( output , context ) : Framework => { return { CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , DeploymentStatus : __expectString ( output . DeploymentStatus ) , FrameworkArn : __expectString ( output . FrameworkArn ) , FrameworkDescription : __expectString ( output . FrameworkDescription ) , FrameworkName : __expectString ( output . FrameworkName ) , NumberOfControls : __expectInt32 ( output . NumberOfControls ) , } as any ; } ; const deserializeAws_restJson1FrameworkControl = ( output , context ) : FrameworkControl => { return { ControlInputParameters : output . ControlInputParameters !== undefined && output . ControlInputParameters !== null ? deserializeAws_restJson1ControlInputParameters ( output . ControlInputParameters , context ) : undefined , ControlName : __expectString ( output . ControlName ) , ControlScope : output . ControlScope !== undefined && output . ControlScope !== null ? deserializeAws_restJson1ControlScope ( output . ControlScope , context ) : undefined , } as any ; } ; const deserializeAws_restJson1FrameworkControls = ( output , context ) : FrameworkControl [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1FrameworkControl ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1FrameworkList = ( output , context ) : Framework [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Framework ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1GlobalSettings = ( 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_restJson1Lifecycle = ( output , context ) : Lifecycle => { return { DeleteAfterDays : __expectLong ( output . DeleteAfterDays ) , MoveToColdStorageAfterDays : __expectLong ( output . MoveToColdStorageAfterDays ) , } as any ; } ; const deserializeAws_restJson1ListOfTags = ( output , context ) : Condition [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Condition ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Metadata = ( 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_restJson1ProtectedResource = ( output , context ) : ProtectedResource => { return { LastBackupTime : output . LastBackupTime !== undefined && output . LastBackupTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastBackupTime ) ) ) : undefined , ResourceArn : __expectString ( output . ResourceArn ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1ProtectedResourcesList = ( output , context ) : ProtectedResource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ProtectedResource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RecoveryPointByBackupVault = ( output , context ) : RecoveryPointByBackupVault => { return { BackupSizeInBytes : __expectLong ( output . BackupSizeInBytes ) , BackupVaultArn : __expectString ( output . BackupVaultArn ) , BackupVaultName : __expectString ( output . BackupVaultName ) , CalculatedLifecycle : output . CalculatedLifecycle !== undefined && output . CalculatedLifecycle !== null ? deserializeAws_restJson1CalculatedLifecycle ( output . CalculatedLifecycle , context ) : undefined , CompletionDate : output . CompletionDate !== undefined && output . CompletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompletionDate ) ) ) : undefined , CreatedBy : output . CreatedBy !== undefined && output . CreatedBy !== null ? deserializeAws_restJson1RecoveryPointCreator ( output . CreatedBy , context ) : undefined , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , EncryptionKeyArn : __expectString ( output . EncryptionKeyArn ) , IamRoleArn : __expectString ( output . IamRoleArn ) , IsEncrypted : __expectBoolean ( output . IsEncrypted ) , LastRestoreTime : output . LastRestoreTime !== undefined && output . LastRestoreTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastRestoreTime ) ) ) : undefined , Lifecycle : output . Lifecycle !== undefined && output . Lifecycle !== null ? deserializeAws_restJson1Lifecycle ( output . Lifecycle , context ) : undefined , RecoveryPointArn : __expectString ( output . RecoveryPointArn ) , ResourceArn : __expectString ( output . ResourceArn ) , ResourceType : __expectString ( output . ResourceType ) , SourceBackupVaultArn : __expectString ( output . SourceBackupVaultArn ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1RecoveryPointByBackupVaultList = ( output , context ) : RecoveryPointByBackupVault [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RecoveryPointByBackupVault ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RecoveryPointByResource = ( output , context ) : RecoveryPointByResource => { return { BackupSizeBytes : __expectLong ( output . BackupSizeBytes ) , BackupVaultName : __expectString ( output . BackupVaultName ) , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , EncryptionKeyArn : __expectString ( output . EncryptionKeyArn ) , RecoveryPointArn : __expectString ( output . RecoveryPointArn ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1RecoveryPointByResourceList = ( output , context ) : RecoveryPointByResource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RecoveryPointByResource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RecoveryPointCreator = ( output , context ) : RecoveryPointCreator => { return { BackupPlanArn : __expectString ( output . BackupPlanArn ) , BackupPlanId : __expectString ( output . BackupPlanId ) , BackupPlanVersion : __expectString ( output . BackupPlanVersion ) , BackupRuleId : __expectString ( output . BackupRuleId ) , } as any ; } ; const deserializeAws_restJson1ReportDeliveryChannel = ( output , context ) : ReportDeliveryChannel => { return { Formats : output . Formats !== undefined && output . Formats !== null ? deserializeAws_restJson1FormatList ( output . Formats , context ) : undefined , S3BucketName : __expectString ( output . S3BucketName ) , S3KeyPrefix : __expectString ( output . S3KeyPrefix ) , } as any ; } ; const deserializeAws_restJson1ReportDestination = ( output , context ) : ReportDestination => { return { S3BucketName : __expectString ( output . S3BucketName ) , S3Keys : output . S3Keys !== undefined && output . S3Keys !== null ? deserializeAws_restJson1stringList ( output . S3Keys , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ReportJob = ( output , context ) : ReportJob => { return { CompletionTime : output . CompletionTime !== undefined && output . CompletionTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompletionTime ) ) ) : undefined , CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , ReportDestination : output . ReportDestination !== undefined && output . ReportDestination !== null ? deserializeAws_restJson1ReportDestination ( output . ReportDestination , context ) : undefined , ReportJobId : __expectString ( output . ReportJobId ) , ReportPlanArn : __expectString ( output . ReportPlanArn ) , ReportTemplate : __expectString ( output . ReportTemplate ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1ReportJobList = ( output , context ) : ReportJob [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReportJob ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ReportPlan = ( output , context ) : ReportPlan => { return { CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , DeploymentStatus : __expectString ( output . DeploymentStatus ) , LastAttemptedExecutionTime : output . LastAttemptedExecutionTime !== undefined && output . LastAttemptedExecutionTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastAttemptedExecutionTime ) ) ) : undefined , LastSuccessfulExecutionTime : output . LastSuccessfulExecutionTime !== undefined && output . LastSuccessfulExecutionTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastSuccessfulExecutionTime ) ) ) : undefined , ReportDeliveryChannel : output . ReportDeliveryChannel !== undefined && output . ReportDeliveryChannel !== null ? deserializeAws_restJson1ReportDeliveryChannel ( output . ReportDeliveryChannel , context ) : undefined , ReportPlanArn : __expectString ( output . ReportPlanArn ) , ReportPlanDescription : __expectString ( output . ReportPlanDescription ) , ReportPlanName : __expectString ( output . ReportPlanName ) , ReportSetting : output . ReportSetting !== undefined && output . ReportSetting !== null ? deserializeAws_restJson1ReportSetting ( output . ReportSetting , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ReportPlanList = ( output , context ) : ReportPlan [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReportPlan ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ReportSetting = ( output , context ) : ReportSetting => { return { FrameworkArns : output . FrameworkArns !== undefined && output . FrameworkArns !== null ? deserializeAws_restJson1stringList ( output . FrameworkArns , context ) : undefined , NumberOfFrameworks : __expectInt32 ( output . NumberOfFrameworks ) , ReportTemplate : __expectString ( output . ReportTemplate ) , } as any ; } ; const deserializeAws_restJson1ResourceArns = ( 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_restJson1ResourceTypeList = ( 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_restJson1ResourceTypeManagementPreference = ( output , context ) : { [ key ] : boolean ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectBoolean ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1ResourceTypeOptInPreference = ( output , context ) : { [ key ] : boolean ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectBoolean ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1ResourceTypes = ( 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_restJson1RestoreJobsList = ( output , context ) : RestoreJobsListMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RestoreJobsListMember ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1RestoreJobsListMember = ( output , context ) : RestoreJobsListMember => { return { AccountId : __expectString ( output . AccountId ) , BackupSizeInBytes : __expectLong ( output . BackupSizeInBytes ) , CompletionDate : output . CompletionDate !== undefined && output . CompletionDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompletionDate ) ) ) : undefined , CreatedResourceArn : __expectString ( output . CreatedResourceArn ) , CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , ExpectedCompletionTimeMinutes : __expectLong ( output . ExpectedCompletionTimeMinutes ) , IamRoleArn : __expectString ( output . IamRoleArn ) , PercentDone : __expectString ( output . PercentDone ) , RecoveryPointArn : __expectString ( output . RecoveryPointArn ) , ResourceType : __expectString ( output . ResourceType ) , RestoreJobId : __expectString ( output . RestoreJobId ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1stringList = ( 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_restJson1stringMap = ( 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_restJson1Tags = ( 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 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 "" ; } ;