import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseRfc3339DateTime as __parseRfc3339DateTime , } 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 { CreateCellCommandInput , CreateCellCommandOutput } from "../commands/CreateCellCommand" ; import { CreateCrossAccountAuthorizationCommandInput , CreateCrossAccountAuthorizationCommandOutput , } from "../commands/CreateCrossAccountAuthorizationCommand" ; import { CreateReadinessCheckCommandInput , CreateReadinessCheckCommandOutput , } from "../commands/CreateReadinessCheckCommand" ; import { CreateRecoveryGroupCommandInput , CreateRecoveryGroupCommandOutput , } from "../commands/CreateRecoveryGroupCommand" ; import { CreateResourceSetCommandInput , CreateResourceSetCommandOutput } from "../commands/CreateResourceSetCommand" ; import { DeleteCellCommandInput , DeleteCellCommandOutput } from "../commands/DeleteCellCommand" ; import { DeleteCrossAccountAuthorizationCommandInput , DeleteCrossAccountAuthorizationCommandOutput , } from "../commands/DeleteCrossAccountAuthorizationCommand" ; import { DeleteReadinessCheckCommandInput , DeleteReadinessCheckCommandOutput , } from "../commands/DeleteReadinessCheckCommand" ; import { DeleteRecoveryGroupCommandInput , DeleteRecoveryGroupCommandOutput , } from "../commands/DeleteRecoveryGroupCommand" ; import { DeleteResourceSetCommandInput , DeleteResourceSetCommandOutput } from "../commands/DeleteResourceSetCommand" ; import { GetArchitectureRecommendationsCommandInput , GetArchitectureRecommendationsCommandOutput , } from "../commands/GetArchitectureRecommendationsCommand" ; import { GetCellCommandInput , GetCellCommandOutput } from "../commands/GetCellCommand" ; import { GetCellReadinessSummaryCommandInput , GetCellReadinessSummaryCommandOutput , } from "../commands/GetCellReadinessSummaryCommand" ; import { GetReadinessCheckCommandInput , GetReadinessCheckCommandOutput } from "../commands/GetReadinessCheckCommand" ; import { GetReadinessCheckResourceStatusCommandInput , GetReadinessCheckResourceStatusCommandOutput , } from "../commands/GetReadinessCheckResourceStatusCommand" ; import { GetReadinessCheckStatusCommandInput , GetReadinessCheckStatusCommandOutput , } from "../commands/GetReadinessCheckStatusCommand" ; import { GetRecoveryGroupCommandInput , GetRecoveryGroupCommandOutput } from "../commands/GetRecoveryGroupCommand" ; import { GetRecoveryGroupReadinessSummaryCommandInput , GetRecoveryGroupReadinessSummaryCommandOutput , } from "../commands/GetRecoveryGroupReadinessSummaryCommand" ; import { GetResourceSetCommandInput , GetResourceSetCommandOutput } from "../commands/GetResourceSetCommand" ; import { ListCellsCommandInput , ListCellsCommandOutput } from "../commands/ListCellsCommand" ; import { ListCrossAccountAuthorizationsCommandInput , ListCrossAccountAuthorizationsCommandOutput , } from "../commands/ListCrossAccountAuthorizationsCommand" ; import { ListReadinessChecksCommandInput , ListReadinessChecksCommandOutput , } from "../commands/ListReadinessChecksCommand" ; import { ListRecoveryGroupsCommandInput , ListRecoveryGroupsCommandOutput } from "../commands/ListRecoveryGroupsCommand" ; import { ListResourceSetsCommandInput , ListResourceSetsCommandOutput } from "../commands/ListResourceSetsCommand" ; import { ListRulesCommandInput , ListRulesCommandOutput } from "../commands/ListRulesCommand" ; import { ListTagsForResourcesCommandInput , ListTagsForResourcesCommandOutput , } from "../commands/ListTagsForResourcesCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateCellCommandInput , UpdateCellCommandOutput } from "../commands/UpdateCellCommand" ; import { UpdateReadinessCheckCommandInput , UpdateReadinessCheckCommandOutput , } from "../commands/UpdateReadinessCheckCommand" ; import { UpdateRecoveryGroupCommandInput , UpdateRecoveryGroupCommandOutput , } from "../commands/UpdateRecoveryGroupCommand" ; import { UpdateResourceSetCommandInput , UpdateResourceSetCommandOutput } from "../commands/UpdateResourceSetCommand" ; import { AccessDeniedException , CellOutput , ConflictException , DNSTargetResource , InternalServerException , ListRulesOutput , Message , NLBResource , R53ResourceRecord , ReadinessCheckOutput , ReadinessCheckSummary , Recommendation , RecoveryGroupOutput , Resource , ResourceNotFoundException , ResourceResult , ResourceSetOutput , RuleResult , TargetResource , ThrottlingException , ValidationException , } from "../models/models_0" ; export const serializeAws_restJson1CreateCellCommand = 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 || "" }` + "/cells" ; let body ; body = JSON . stringify ( { ... ( input . CellName !== undefined && input . CellName !== null && { cellName : input . CellName } ) , ... ( input . Cells !== undefined && input . Cells !== null && { cells : serializeAws_restJson1__listOf__string ( input . Cells , context ) } ) , ... ( 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_restJson1CreateCrossAccountAuthorizationCommand = 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 || "" }` + "/crossaccountauthorizations" ; let body ; body = JSON . stringify ( { ... ( input . CrossAccountAuthorization !== undefined && input . CrossAccountAuthorization !== null && { crossAccountAuthorization : input . CrossAccountAuthorization } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateReadinessCheckCommand = 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 || "" }` + "/readinesschecks" ; let body ; body = JSON . stringify ( { ... ( input . ReadinessCheckName !== undefined && input . ReadinessCheckName !== null && { readinessCheckName : input . ReadinessCheckName } ) , ... ( input . ResourceSetName !== undefined && input . ResourceSetName !== null && { resourceSetName : input . ResourceSetName } ) , ... ( 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_restJson1CreateRecoveryGroupCommand = 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 || "" }` + "/recoverygroups" ; let body ; body = JSON . stringify ( { ... ( input . Cells !== undefined && input . Cells !== null && { cells : serializeAws_restJson1__listOf__string ( input . Cells , context ) } ) , ... ( input . RecoveryGroupName !== undefined && input . RecoveryGroupName !== null && { recoveryGroupName : input . RecoveryGroupName } ) , ... ( 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_restJson1CreateResourceSetCommand = 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 || "" }` + "/resourcesets" ; let body ; body = JSON . stringify ( { ... ( input . ResourceSetName !== undefined && input . ResourceSetName !== null && { resourceSetName : input . ResourceSetName } ) , ... ( input . ResourceSetType !== undefined && input . ResourceSetType !== null && { resourceSetType : input . ResourceSetType } ) , ... ( input . Resources !== undefined && input . Resources !== null && { resources : serializeAws_restJson1__listOfResource ( input . Resources , context ) } ) , ... ( 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_restJson1DeleteCellCommand = 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 || "" }` + "/cells/{CellName}" ; if ( input . CellName !== undefined ) { const labelValue = input . CellName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CellName." ) ; } resolvedPath = resolvedPath . replace ( "{CellName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CellName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCrossAccountAuthorizationCommand = 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 || "" }` + "/crossaccountauthorizations/{CrossAccountAuthorization}" ; if ( input . CrossAccountAuthorization !== undefined ) { const labelValue = input . CrossAccountAuthorization ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CrossAccountAuthorization." ) ; } resolvedPath = resolvedPath . replace ( "{CrossAccountAuthorization}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CrossAccountAuthorization." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteReadinessCheckCommand = 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 || "" }` + "/readinesschecks/{ReadinessCheckName}" ; if ( input . ReadinessCheckName !== undefined ) { const labelValue = input . ReadinessCheckName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReadinessCheckName." ) ; } resolvedPath = resolvedPath . replace ( "{ReadinessCheckName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReadinessCheckName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRecoveryGroupCommand = 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 || "" }` + "/recoverygroups/{RecoveryGroupName}" ; if ( input . RecoveryGroupName !== undefined ) { const labelValue = input . RecoveryGroupName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryGroupName." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryGroupName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryGroupName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteResourceSetCommand = 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 || "" }` + "/resourcesets/{ResourceSetName}" ; if ( input . ResourceSetName !== undefined ) { const labelValue = input . ResourceSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceSetName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetArchitectureRecommendationsCommand = 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 || "" }` + "/recoverygroups/{RecoveryGroupName}/architectureRecommendations" ; if ( input . RecoveryGroupName !== undefined ) { const labelValue = input . RecoveryGroupName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryGroupName." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryGroupName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryGroupName." ) ; } 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_restJson1GetCellCommand = 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 || "" }` + "/cells/{CellName}" ; if ( input . CellName !== undefined ) { const labelValue = input . CellName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CellName." ) ; } resolvedPath = resolvedPath . replace ( "{CellName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CellName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCellReadinessSummaryCommand = 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 || "" }` + "/cellreadiness/{CellName}" ; if ( input . CellName !== undefined ) { const labelValue = input . CellName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CellName." ) ; } resolvedPath = resolvedPath . replace ( "{CellName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CellName." ) ; } 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_restJson1GetReadinessCheckCommand = 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 || "" }` + "/readinesschecks/{ReadinessCheckName}" ; if ( input . ReadinessCheckName !== undefined ) { const labelValue = input . ReadinessCheckName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReadinessCheckName." ) ; } resolvedPath = resolvedPath . replace ( "{ReadinessCheckName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReadinessCheckName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetReadinessCheckResourceStatusCommand = 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 || "" }` + "/readinesschecks/{ReadinessCheckName}/resource/{ResourceIdentifier}/status" ; if ( input . ReadinessCheckName !== undefined ) { const labelValue = input . ReadinessCheckName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReadinessCheckName." ) ; } resolvedPath = resolvedPath . replace ( "{ReadinessCheckName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReadinessCheckName." ) ; } if ( input . ResourceIdentifier !== undefined ) { const labelValue = input . ResourceIdentifier ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceIdentifier." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceIdentifier}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceIdentifier." ) ; } 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_restJson1GetReadinessCheckStatusCommand = 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 || "" }` + "/readinesschecks/{ReadinessCheckName}/status" ; if ( input . ReadinessCheckName !== undefined ) { const labelValue = input . ReadinessCheckName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReadinessCheckName." ) ; } resolvedPath = resolvedPath . replace ( "{ReadinessCheckName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReadinessCheckName." ) ; } 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_restJson1GetRecoveryGroupCommand = 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 || "" }` + "/recoverygroups/{RecoveryGroupName}" ; if ( input . RecoveryGroupName !== undefined ) { const labelValue = input . RecoveryGroupName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryGroupName." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryGroupName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryGroupName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRecoveryGroupReadinessSummaryCommand = 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 || "" }` + "/recoverygroupreadiness/{RecoveryGroupName}" ; if ( input . RecoveryGroupName !== undefined ) { const labelValue = input . RecoveryGroupName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryGroupName." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryGroupName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryGroupName." ) ; } 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_restJson1GetResourceSetCommand = 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 || "" }` + "/resourcesets/{ResourceSetName}" ; if ( input . ResourceSetName !== undefined ) { const labelValue = input . ResourceSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceSetName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListCellsCommand = 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 || "" }` + "/cells" ; 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_restJson1ListCrossAccountAuthorizationsCommand = 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 || "" }` + "/crossaccountauthorizations" ; 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_restJson1ListReadinessChecksCommand = 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 || "" }` + "/readinesschecks" ; 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_restJson1ListRecoveryGroupsCommand = 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 || "" }` + "/recoverygroups" ; 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_restJson1ListResourceSetsCommand = 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 || "" }` + "/resourcesets" ; 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_restJson1ListRulesCommand = 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 || "" }` + "/rules" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . ResourceType !== undefined && { resourceType : input . ResourceType } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourcesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_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 = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateCellCommand = 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 || "" }` + "/cells/{CellName}" ; if ( input . CellName !== undefined ) { const labelValue = input . CellName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CellName." ) ; } resolvedPath = resolvedPath . replace ( "{CellName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CellName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Cells !== undefined && input . Cells !== null && { cells : serializeAws_restJson1__listOf__string ( input . Cells , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateReadinessCheckCommand = 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 || "" }` + "/readinesschecks/{ReadinessCheckName}" ; if ( input . ReadinessCheckName !== undefined ) { const labelValue = input . ReadinessCheckName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReadinessCheckName." ) ; } resolvedPath = resolvedPath . replace ( "{ReadinessCheckName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReadinessCheckName." ) ; } let body ; body = JSON . stringify ( { ... ( input . ResourceSetName !== undefined && input . ResourceSetName !== null && { resourceSetName : input . ResourceSetName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRecoveryGroupCommand = 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 || "" }` + "/recoverygroups/{RecoveryGroupName}" ; if ( input . RecoveryGroupName !== undefined ) { const labelValue = input . RecoveryGroupName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecoveryGroupName." ) ; } resolvedPath = resolvedPath . replace ( "{RecoveryGroupName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecoveryGroupName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Cells !== undefined && input . Cells !== null && { cells : serializeAws_restJson1__listOf__string ( input . Cells , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateResourceSetCommand = 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 || "" }` + "/resourcesets/{ResourceSetName}" ; if ( input . ResourceSetName !== undefined ) { const labelValue = input . ResourceSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . ResourceSetType !== undefined && input . ResourceSetType !== null && { resourceSetType : input . ResourceSetType } ) , ... ( input . Resources !== undefined && input . Resources !== null && { resources : serializeAws_restJson1__listOfResource ( input . Resources , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateCellCommand = async ( output , context ) : Promise < CreateCellCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCellCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CellArn : undefined , CellName : undefined , Cells : undefined , ParentReadinessScopes : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cellArn !== undefined && data . cellArn !== null ) { contents . CellArn = __expectString ( data . cellArn ) ; } if ( data . cellName !== undefined && data . cellName !== null ) { contents . CellName = __expectString ( data . cellName ) ; } if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . parentReadinessScopes !== undefined && data . parentReadinessScopes !== null ) { contents . ParentReadinessScopes = deserializeAws_restJson1__listOf__string ( data . parentReadinessScopes , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCellCommandError = async ( output , context ) : Promise < CreateCellCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.route53recoveryreadiness#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateCrossAccountAuthorizationCommand = async ( output , context ) : Promise < CreateCrossAccountAuthorizationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCrossAccountAuthorizationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CrossAccountAuthorization : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . crossAccountAuthorization !== undefined && data . crossAccountAuthorization !== null ) { contents . CrossAccountAuthorization = __expectString ( data . crossAccountAuthorization ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCrossAccountAuthorizationCommandError = async ( output , context ) : Promise < CreateCrossAccountAuthorizationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.route53recoveryreadiness#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateReadinessCheckCommand = async ( output , context ) : Promise < CreateReadinessCheckCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateReadinessCheckCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReadinessCheckArn : undefined , ReadinessCheckName : undefined , ResourceSet : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . readinessCheckArn !== undefined && data . readinessCheckArn !== null ) { contents . ReadinessCheckArn = __expectString ( data . readinessCheckArn ) ; } if ( data . readinessCheckName !== undefined && data . readinessCheckName !== null ) { contents . ReadinessCheckName = __expectString ( data . readinessCheckName ) ; } if ( data . resourceSet !== undefined && data . resourceSet !== null ) { contents . ResourceSet = __expectString ( data . resourceSet ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateReadinessCheckCommandError = async ( output , context ) : Promise < CreateReadinessCheckCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.route53recoveryreadiness#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateRecoveryGroupCommand = async ( output , context ) : Promise < CreateRecoveryGroupCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRecoveryGroupCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Cells : undefined , RecoveryGroupArn : undefined , RecoveryGroupName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . recoveryGroupArn !== undefined && data . recoveryGroupArn !== null ) { contents . RecoveryGroupArn = __expectString ( data . recoveryGroupArn ) ; } if ( data . recoveryGroupName !== undefined && data . recoveryGroupName !== null ) { contents . RecoveryGroupName = __expectString ( data . recoveryGroupName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRecoveryGroupCommandError = async ( output , context ) : Promise < CreateRecoveryGroupCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.route53recoveryreadiness#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateResourceSetCommand = async ( output , context ) : Promise < CreateResourceSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateResourceSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceSetArn : undefined , ResourceSetName : undefined , ResourceSetType : undefined , Resources : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resourceSetArn !== undefined && data . resourceSetArn !== null ) { contents . ResourceSetArn = __expectString ( data . resourceSetArn ) ; } if ( data . resourceSetName !== undefined && data . resourceSetName !== null ) { contents . ResourceSetName = __expectString ( data . resourceSetName ) ; } if ( data . resourceSetType !== undefined && data . resourceSetType !== null ) { contents . ResourceSetType = __expectString ( data . resourceSetType ) ; } if ( data . resources !== undefined && data . resources !== null ) { contents . Resources = deserializeAws_restJson1__listOfResource ( data . resources , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateResourceSetCommandError = async ( output , context ) : Promise < CreateResourceSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.route53recoveryreadiness#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteCellCommand = async ( output , context ) : Promise < DeleteCellCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCellCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCellCommandError = async ( output , context ) : Promise < DeleteCellCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteCrossAccountAuthorizationCommand = async ( output , context ) : Promise < DeleteCrossAccountAuthorizationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCrossAccountAuthorizationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCrossAccountAuthorizationCommandError = async ( output , context ) : Promise < DeleteCrossAccountAuthorizationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteReadinessCheckCommand = async ( output , context ) : Promise < DeleteReadinessCheckCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteReadinessCheckCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteReadinessCheckCommandError = async ( output , context ) : Promise < DeleteReadinessCheckCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteRecoveryGroupCommand = async ( output , context ) : Promise < DeleteRecoveryGroupCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRecoveryGroupCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRecoveryGroupCommandError = async ( output , context ) : Promise < DeleteRecoveryGroupCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteResourceSetCommand = async ( output , context ) : Promise < DeleteResourceSetCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteResourceSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteResourceSetCommandError = async ( output , context ) : Promise < DeleteResourceSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetArchitectureRecommendationsCommand = async ( output , context ) : Promise < GetArchitectureRecommendationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetArchitectureRecommendationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LastAuditTimestamp : undefined , NextToken : undefined , Recommendations : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . lastAuditTimestamp !== undefined && data . lastAuditTimestamp !== null ) { contents . LastAuditTimestamp = __expectNonNull ( __parseRfc3339DateTime ( data . lastAuditTimestamp ) ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } if ( data . recommendations !== undefined && data . recommendations !== null ) { contents . Recommendations = deserializeAws_restJson1__listOfRecommendation ( data . recommendations , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetArchitectureRecommendationsCommandError = async ( output , context ) : Promise < GetArchitectureRecommendationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetCellCommand = async ( output , context ) : Promise < GetCellCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCellCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CellArn : undefined , CellName : undefined , Cells : undefined , ParentReadinessScopes : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cellArn !== undefined && data . cellArn !== null ) { contents . CellArn = __expectString ( data . cellArn ) ; } if ( data . cellName !== undefined && data . cellName !== null ) { contents . CellName = __expectString ( data . cellName ) ; } if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . parentReadinessScopes !== undefined && data . parentReadinessScopes !== null ) { contents . ParentReadinessScopes = deserializeAws_restJson1__listOf__string ( data . parentReadinessScopes , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCellCommandError = async ( output , context ) : Promise < GetCellCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetCellReadinessSummaryCommand = async ( output , context ) : Promise < GetCellReadinessSummaryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCellReadinessSummaryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Readiness : undefined , ReadinessChecks : 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 . readiness !== undefined && data . readiness !== null ) { contents . Readiness = __expectString ( data . readiness ) ; } if ( data . readinessChecks !== undefined && data . readinessChecks !== null ) { contents . ReadinessChecks = deserializeAws_restJson1__listOfReadinessCheckSummary ( data . readinessChecks , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCellReadinessSummaryCommandError = async ( output , context ) : Promise < GetCellReadinessSummaryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetReadinessCheckCommand = async ( output , context ) : Promise < GetReadinessCheckCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetReadinessCheckCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReadinessCheckArn : undefined , ReadinessCheckName : undefined , ResourceSet : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . readinessCheckArn !== undefined && data . readinessCheckArn !== null ) { contents . ReadinessCheckArn = __expectString ( data . readinessCheckArn ) ; } if ( data . readinessCheckName !== undefined && data . readinessCheckName !== null ) { contents . ReadinessCheckName = __expectString ( data . readinessCheckName ) ; } if ( data . resourceSet !== undefined && data . resourceSet !== null ) { contents . ResourceSet = __expectString ( data . resourceSet ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetReadinessCheckCommandError = async ( output , context ) : Promise < GetReadinessCheckCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetReadinessCheckResourceStatusCommand = async ( output , context ) : Promise < GetReadinessCheckResourceStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetReadinessCheckResourceStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Readiness : undefined , Rules : 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 . readiness !== undefined && data . readiness !== null ) { contents . Readiness = __expectString ( data . readiness ) ; } if ( data . rules !== undefined && data . rules !== null ) { contents . Rules = deserializeAws_restJson1__listOfRuleResult ( data . rules , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetReadinessCheckResourceStatusCommandError = async ( output , context ) : Promise < GetReadinessCheckResourceStatusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetReadinessCheckStatusCommand = async ( output , context ) : Promise < GetReadinessCheckStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetReadinessCheckStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Messages : undefined , NextToken : undefined , Readiness : undefined , Resources : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . messages !== undefined && data . messages !== null ) { contents . Messages = deserializeAws_restJson1__listOfMessage ( data . messages , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } if ( data . readiness !== undefined && data . readiness !== null ) { contents . Readiness = __expectString ( data . readiness ) ; } if ( data . resources !== undefined && data . resources !== null ) { contents . Resources = deserializeAws_restJson1__listOfResourceResult ( data . resources , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetReadinessCheckStatusCommandError = async ( output , context ) : Promise < GetReadinessCheckStatusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRecoveryGroupCommand = async ( output , context ) : Promise < GetRecoveryGroupCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRecoveryGroupCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Cells : undefined , RecoveryGroupArn : undefined , RecoveryGroupName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . recoveryGroupArn !== undefined && data . recoveryGroupArn !== null ) { contents . RecoveryGroupArn = __expectString ( data . recoveryGroupArn ) ; } if ( data . recoveryGroupName !== undefined && data . recoveryGroupName !== null ) { contents . RecoveryGroupName = __expectString ( data . recoveryGroupName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRecoveryGroupCommandError = async ( output , context ) : Promise < GetRecoveryGroupCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetRecoveryGroupReadinessSummaryCommand = async ( output , context ) : Promise < GetRecoveryGroupReadinessSummaryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRecoveryGroupReadinessSummaryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Readiness : undefined , ReadinessChecks : 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 . readiness !== undefined && data . readiness !== null ) { contents . Readiness = __expectString ( data . readiness ) ; } if ( data . readinessChecks !== undefined && data . readinessChecks !== null ) { contents . ReadinessChecks = deserializeAws_restJson1__listOfReadinessCheckSummary ( data . readinessChecks , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRecoveryGroupReadinessSummaryCommandError = async ( output , context ) : Promise < GetRecoveryGroupReadinessSummaryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetResourceSetCommand = async ( output , context ) : Promise < GetResourceSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResourceSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceSetArn : undefined , ResourceSetName : undefined , ResourceSetType : undefined , Resources : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resourceSetArn !== undefined && data . resourceSetArn !== null ) { contents . ResourceSetArn = __expectString ( data . resourceSetArn ) ; } if ( data . resourceSetName !== undefined && data . resourceSetName !== null ) { contents . ResourceSetName = __expectString ( data . resourceSetName ) ; } if ( data . resourceSetType !== undefined && data . resourceSetType !== null ) { contents . ResourceSetType = __expectString ( data . resourceSetType ) ; } if ( data . resources !== undefined && data . resources !== null ) { contents . Resources = deserializeAws_restJson1__listOfResource ( data . resources , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResourceSetCommandError = async ( output , context ) : Promise < GetResourceSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListCellsCommand = async ( output , context ) : Promise < ListCellsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCellsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Cells : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOfCellOutput ( data . cells , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCellsCommandError = async ( output , context ) : Promise < ListCellsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListCrossAccountAuthorizationsCommand = async ( output , context ) : Promise < ListCrossAccountAuthorizationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCrossAccountAuthorizationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CrossAccountAuthorizations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . crossAccountAuthorizations !== undefined && data . crossAccountAuthorizations !== null ) { contents . CrossAccountAuthorizations = deserializeAws_restJson1__listOfCrossAccountAuthorization ( data . crossAccountAuthorizations , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCrossAccountAuthorizationsCommandError = async ( output , context ) : Promise < ListCrossAccountAuthorizationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListReadinessChecksCommand = async ( output , context ) : Promise < ListReadinessChecksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListReadinessChecksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ReadinessChecks : 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 . readinessChecks !== undefined && data . readinessChecks !== null ) { contents . ReadinessChecks = deserializeAws_restJson1__listOfReadinessCheckOutput ( data . readinessChecks , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListReadinessChecksCommandError = async ( output , context ) : Promise < ListReadinessChecksCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListRecoveryGroupsCommand = async ( output , context ) : Promise < ListRecoveryGroupsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRecoveryGroupsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , RecoveryGroups : 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 . recoveryGroups !== undefined && data . recoveryGroups !== null ) { contents . RecoveryGroups = deserializeAws_restJson1__listOfRecoveryGroupOutput ( data . recoveryGroups , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRecoveryGroupsCommandError = async ( output , context ) : Promise < ListRecoveryGroupsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListResourceSetsCommand = async ( output , context ) : Promise < ListResourceSetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListResourceSetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ResourceSets : 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 . resourceSets !== undefined && data . resourceSets !== null ) { contents . ResourceSets = deserializeAws_restJson1__listOfResourceSetOutput ( data . resourceSets , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListResourceSetsCommandError = async ( output , context ) : Promise < ListResourceSetsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListRulesCommand = async ( output , context ) : Promise < ListRulesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRulesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Rules : 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 . rules !== undefined && data . rules !== null ) { contents . Rules = deserializeAws_restJson1__listOfListRulesOutput ( data . rules , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRulesCommandError = async ( output , context ) : Promise < ListRulesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourcesCommand = async ( output , context ) : Promise < ListTagsForResourcesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourcesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourcesCommandError = async ( output , context ) : Promise < ListTagsForResourcesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateCellCommand = async ( output , context ) : Promise < UpdateCellCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateCellCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CellArn : undefined , CellName : undefined , Cells : undefined , ParentReadinessScopes : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cellArn !== undefined && data . cellArn !== null ) { contents . CellArn = __expectString ( data . cellArn ) ; } if ( data . cellName !== undefined && data . cellName !== null ) { contents . CellName = __expectString ( data . cellName ) ; } if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . parentReadinessScopes !== undefined && data . parentReadinessScopes !== null ) { contents . ParentReadinessScopes = deserializeAws_restJson1__listOf__string ( data . parentReadinessScopes , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateCellCommandError = async ( output , context ) : Promise < UpdateCellCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateReadinessCheckCommand = async ( output , context ) : Promise < UpdateReadinessCheckCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateReadinessCheckCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ReadinessCheckArn : undefined , ReadinessCheckName : undefined , ResourceSet : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . readinessCheckArn !== undefined && data . readinessCheckArn !== null ) { contents . ReadinessCheckArn = __expectString ( data . readinessCheckArn ) ; } if ( data . readinessCheckName !== undefined && data . readinessCheckName !== null ) { contents . ReadinessCheckName = __expectString ( data . readinessCheckName ) ; } if ( data . resourceSet !== undefined && data . resourceSet !== null ) { contents . ResourceSet = __expectString ( data . resourceSet ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateReadinessCheckCommandError = async ( output , context ) : Promise < UpdateReadinessCheckCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateRecoveryGroupCommand = async ( output , context ) : Promise < UpdateRecoveryGroupCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRecoveryGroupCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Cells : undefined , RecoveryGroupArn : undefined , RecoveryGroupName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . cells !== undefined && data . cells !== null ) { contents . Cells = deserializeAws_restJson1__listOf__string ( data . cells , context ) ; } if ( data . recoveryGroupArn !== undefined && data . recoveryGroupArn !== null ) { contents . RecoveryGroupArn = __expectString ( data . recoveryGroupArn ) ; } if ( data . recoveryGroupName !== undefined && data . recoveryGroupName !== null ) { contents . RecoveryGroupName = __expectString ( data . recoveryGroupName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRecoveryGroupCommandError = async ( output , context ) : Promise < UpdateRecoveryGroupCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateResourceSetCommand = async ( output , context ) : Promise < UpdateResourceSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateResourceSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceSetArn : undefined , ResourceSetName : undefined , ResourceSetType : undefined , Resources : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resourceSetArn !== undefined && data . resourceSetArn !== null ) { contents . ResourceSetArn = __expectString ( data . resourceSetArn ) ; } if ( data . resourceSetName !== undefined && data . resourceSetName !== null ) { contents . ResourceSetName = __expectString ( data . resourceSetName ) ; } if ( data . resourceSetType !== undefined && data . resourceSetType !== null ) { contents . ResourceSetType = __expectString ( data . resourceSetType ) ; } if ( data . resources !== undefined && data . resources !== null ) { contents . Resources = deserializeAws_restJson1__listOfResource ( data . resources , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateResourceSetCommandError = async ( output , context ) : Promise < UpdateResourceSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.route53recoveryreadiness#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.route53recoveryreadiness#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.route53recoveryreadiness#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.route53recoveryreadiness#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.route53recoveryreadiness#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1__listOf__string = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1__listOfResource = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Resource ( entry , context ) ; } ) ; } ; const serializeAws_restJson1DNSTargetResource = ( input , context ) : any => { return { ... ( input . DomainName !== undefined && input . DomainName !== null && { domainName : input . DomainName } ) , ... ( input . HostedZoneArn !== undefined && input . HostedZoneArn !== null && { hostedZoneArn : input . HostedZoneArn } ) , ... ( input . RecordSetId !== undefined && input . RecordSetId !== null && { recordSetId : input . RecordSetId } ) , ... ( input . RecordType !== undefined && input . RecordType !== null && { recordType : input . RecordType } ) , ... ( input . TargetResource !== undefined && input . TargetResource !== null && { targetResource : serializeAws_restJson1TargetResource ( input . TargetResource , context ) , } ) , } ; } ; const serializeAws_restJson1NLBResource = ( input , context ) : any => { return { ... ( input . Arn !== undefined && input . Arn !== null && { arn : input . Arn } ) , } ; } ; const serializeAws_restJson1R53ResourceRecord = ( input , context ) : any => { return { ... ( input . DomainName !== undefined && input . DomainName !== null && { domainName : input . DomainName } ) , ... ( input . RecordSetId !== undefined && input . RecordSetId !== null && { recordSetId : input . RecordSetId } ) , } ; } ; const serializeAws_restJson1Resource = ( input , context ) : any => { return { ... ( input . ComponentId !== undefined && input . ComponentId !== null && { componentId : input . ComponentId } ) , ... ( input . DnsTargetResource !== undefined && input . DnsTargetResource !== null && { dnsTargetResource : serializeAws_restJson1DNSTargetResource ( input . DnsTargetResource , context ) , } ) , ... ( input . ReadinessScopes !== undefined && input . ReadinessScopes !== null && { readinessScopes : serializeAws_restJson1__listOf__string ( input . ReadinessScopes , context ) , } ) , ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { resourceArn : input . ResourceArn } ) , } ; } ; const serializeAws_restJson1Tags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1TargetResource = ( input , context ) : any => { return { ... ( input . NLBResource !== undefined && input . NLBResource !== null && { nLBResource : serializeAws_restJson1NLBResource ( input . NLBResource , context ) } ) , ... ( input . R53Resource !== undefined && input . R53Resource !== null && { r53Resource : serializeAws_restJson1R53ResourceRecord ( input . R53Resource , context ) , } ) , } ; } ; const deserializeAws_restJson1__listOf__string = ( 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_restJson1__listOfCellOutput = ( output , context ) : CellOutput [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CellOutput ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfCrossAccountAuthorization = ( 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_restJson1__listOfListRulesOutput = ( output , context ) : ListRulesOutput [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListRulesOutput ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfMessage = ( output , context ) : Message [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Message ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfReadinessCheckOutput = ( output , context ) : ReadinessCheckOutput [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReadinessCheckOutput ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfReadinessCheckSummary = ( output , context ) : ReadinessCheckSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ReadinessCheckSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfRecommendation = ( output , context ) : Recommendation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Recommendation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfRecoveryGroupOutput = ( output , context ) : RecoveryGroupOutput [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RecoveryGroupOutput ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfResource = ( output , context ) : Resource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Resource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfResourceResult = ( output , context ) : ResourceResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ResourceResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfResourceSetOutput = ( output , context ) : ResourceSetOutput [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ResourceSetOutput ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfRuleResult = ( output , context ) : RuleResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RuleResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CellOutput = ( output , context ) : CellOutput => { return { CellArn : __expectString ( output . cellArn ) , CellName : __expectString ( output . cellName ) , Cells : output . cells !== undefined && output . cells !== null ? deserializeAws_restJson1__listOf__string ( output . cells , context ) : undefined , ParentReadinessScopes : output . parentReadinessScopes !== undefined && output . parentReadinessScopes !== null ? deserializeAws_restJson1__listOf__string ( output . parentReadinessScopes , context ) : undefined , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DNSTargetResource = ( output , context ) : DNSTargetResource => { return { DomainName : __expectString ( output . domainName ) , HostedZoneArn : __expectString ( output . hostedZoneArn ) , RecordSetId : __expectString ( output . recordSetId ) , RecordType : __expectString ( output . recordType ) , TargetResource : output . targetResource !== undefined && output . targetResource !== null ? deserializeAws_restJson1TargetResource ( output . targetResource , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ListRulesOutput = ( output , context ) : ListRulesOutput => { return { ResourceType : __expectString ( output . resourceType ) , RuleDescription : __expectString ( output . ruleDescription ) , RuleId : __expectString ( output . ruleId ) , } as any ; } ; const deserializeAws_restJson1Message = ( output , context ) : Message => { return { MessageText : __expectString ( output . messageText ) , } as any ; } ; const deserializeAws_restJson1NLBResource = ( output , context ) : NLBResource => { return { Arn : __expectString ( output . arn ) , } as any ; } ; const deserializeAws_restJson1R53ResourceRecord = ( output , context ) : R53ResourceRecord => { return { DomainName : __expectString ( output . domainName ) , RecordSetId : __expectString ( output . recordSetId ) , } as any ; } ; const deserializeAws_restJson1ReadinessCheckOutput = ( output , context ) : ReadinessCheckOutput => { return { ReadinessCheckArn : __expectString ( output . readinessCheckArn ) , ReadinessCheckName : __expectString ( output . readinessCheckName ) , ResourceSet : __expectString ( output . resourceSet ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ReadinessCheckSummary = ( output , context ) : ReadinessCheckSummary => { return { Readiness : __expectString ( output . readiness ) , ReadinessCheckName : __expectString ( output . readinessCheckName ) , } as any ; } ; const deserializeAws_restJson1Recommendation = ( output , context ) : Recommendation => { return { RecommendationText : __expectString ( output . recommendationText ) , } as any ; } ; const deserializeAws_restJson1RecoveryGroupOutput = ( output , context ) : RecoveryGroupOutput => { return { Cells : output . cells !== undefined && output . cells !== null ? deserializeAws_restJson1__listOf__string ( output . cells , context ) : undefined , RecoveryGroupArn : __expectString ( output . recoveryGroupArn ) , RecoveryGroupName : __expectString ( output . recoveryGroupName ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Resource = ( output , context ) : Resource => { return { ComponentId : __expectString ( output . componentId ) , DnsTargetResource : output . dnsTargetResource !== undefined && output . dnsTargetResource !== null ? deserializeAws_restJson1DNSTargetResource ( output . dnsTargetResource , context ) : undefined , ReadinessScopes : output . readinessScopes !== undefined && output . readinessScopes !== null ? deserializeAws_restJson1__listOf__string ( output . readinessScopes , context ) : undefined , ResourceArn : __expectString ( output . resourceArn ) , } as any ; } ; const deserializeAws_restJson1ResourceResult = ( output , context ) : ResourceResult => { return { ComponentId : __expectString ( output . componentId ) , LastCheckedTimestamp : output . lastCheckedTimestamp !== undefined && output . lastCheckedTimestamp !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . lastCheckedTimestamp ) ) : undefined , Readiness : __expectString ( output . readiness ) , ResourceArn : __expectString ( output . resourceArn ) , } as any ; } ; const deserializeAws_restJson1ResourceSetOutput = ( output , context ) : ResourceSetOutput => { return { ResourceSetArn : __expectString ( output . resourceSetArn ) , ResourceSetName : __expectString ( output . resourceSetName ) , ResourceSetType : __expectString ( output . resourceSetType ) , Resources : output . resources !== undefined && output . resources !== null ? deserializeAws_restJson1__listOfResource ( output . resources , context ) : undefined , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RuleResult = ( output , context ) : RuleResult => { return { LastCheckedTimestamp : output . lastCheckedTimestamp !== undefined && output . lastCheckedTimestamp !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . lastCheckedTimestamp ) ) : undefined , Messages : output . messages !== undefined && output . messages !== null ? deserializeAws_restJson1__listOfMessage ( output . messages , context ) : undefined , Readiness : __expectString ( output . readiness ) , RuleId : __expectString ( output . ruleId ) , } 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 deserializeAws_restJson1TargetResource = ( output , context ) : TargetResource => { return { NLBResource : output . nLBResource !== undefined && output . nLBResource !== null ? deserializeAws_restJson1NLBResource ( output . nLBResource , context ) : undefined , R53Resource : output . r53Resource !== undefined && output . r53Resource !== null ? deserializeAws_restJson1R53ResourceRecord ( output . r53Resource , context ) : undefined , } 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 "" ; } ;