import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AssociateAssessmentReportEvidenceFolderCommandInput , AssociateAssessmentReportEvidenceFolderCommandOutput , } from "../commands/AssociateAssessmentReportEvidenceFolderCommand" ; import { BatchAssociateAssessmentReportEvidenceCommandInput , BatchAssociateAssessmentReportEvidenceCommandOutput , } from "../commands/BatchAssociateAssessmentReportEvidenceCommand" ; import { BatchCreateDelegationByAssessmentCommandInput , BatchCreateDelegationByAssessmentCommandOutput , } from "../commands/BatchCreateDelegationByAssessmentCommand" ; import { BatchDeleteDelegationByAssessmentCommandInput , BatchDeleteDelegationByAssessmentCommandOutput , } from "../commands/BatchDeleteDelegationByAssessmentCommand" ; import { BatchDisassociateAssessmentReportEvidenceCommandInput , BatchDisassociateAssessmentReportEvidenceCommandOutput , } from "../commands/BatchDisassociateAssessmentReportEvidenceCommand" ; import { BatchImportEvidenceToAssessmentControlCommandInput , BatchImportEvidenceToAssessmentControlCommandOutput , } from "../commands/BatchImportEvidenceToAssessmentControlCommand" ; import { CreateAssessmentCommandInput , CreateAssessmentCommandOutput } from "../commands/CreateAssessmentCommand" ; import { CreateAssessmentFrameworkCommandInput , CreateAssessmentFrameworkCommandOutput , } from "../commands/CreateAssessmentFrameworkCommand" ; import { CreateAssessmentReportCommandInput , CreateAssessmentReportCommandOutput , } from "../commands/CreateAssessmentReportCommand" ; import { CreateControlCommandInput , CreateControlCommandOutput } from "../commands/CreateControlCommand" ; import { DeleteAssessmentCommandInput , DeleteAssessmentCommandOutput } from "../commands/DeleteAssessmentCommand" ; import { DeleteAssessmentFrameworkCommandInput , DeleteAssessmentFrameworkCommandOutput , } from "../commands/DeleteAssessmentFrameworkCommand" ; import { DeleteAssessmentFrameworkShareCommandInput , DeleteAssessmentFrameworkShareCommandOutput , } from "../commands/DeleteAssessmentFrameworkShareCommand" ; import { DeleteAssessmentReportCommandInput , DeleteAssessmentReportCommandOutput , } from "../commands/DeleteAssessmentReportCommand" ; import { DeleteControlCommandInput , DeleteControlCommandOutput } from "../commands/DeleteControlCommand" ; import { DeregisterAccountCommandInput , DeregisterAccountCommandOutput } from "../commands/DeregisterAccountCommand" ; import { DeregisterOrganizationAdminAccountCommandInput , DeregisterOrganizationAdminAccountCommandOutput , } from "../commands/DeregisterOrganizationAdminAccountCommand" ; import { DisassociateAssessmentReportEvidenceFolderCommandInput , DisassociateAssessmentReportEvidenceFolderCommandOutput , } from "../commands/DisassociateAssessmentReportEvidenceFolderCommand" ; import { GetAccountStatusCommandInput , GetAccountStatusCommandOutput } from "../commands/GetAccountStatusCommand" ; import { GetAssessmentCommandInput , GetAssessmentCommandOutput } from "../commands/GetAssessmentCommand" ; import { GetAssessmentFrameworkCommandInput , GetAssessmentFrameworkCommandOutput , } from "../commands/GetAssessmentFrameworkCommand" ; import { GetAssessmentReportUrlCommandInput , GetAssessmentReportUrlCommandOutput , } from "../commands/GetAssessmentReportUrlCommand" ; import { GetChangeLogsCommandInput , GetChangeLogsCommandOutput } from "../commands/GetChangeLogsCommand" ; import { GetControlCommandInput , GetControlCommandOutput } from "../commands/GetControlCommand" ; import { GetDelegationsCommandInput , GetDelegationsCommandOutput } from "../commands/GetDelegationsCommand" ; import { GetEvidenceByEvidenceFolderCommandInput , GetEvidenceByEvidenceFolderCommandOutput , } from "../commands/GetEvidenceByEvidenceFolderCommand" ; import { GetEvidenceCommandInput , GetEvidenceCommandOutput } from "../commands/GetEvidenceCommand" ; import { GetEvidenceFolderCommandInput , GetEvidenceFolderCommandOutput } from "../commands/GetEvidenceFolderCommand" ; import { GetEvidenceFoldersByAssessmentCommandInput , GetEvidenceFoldersByAssessmentCommandOutput , } from "../commands/GetEvidenceFoldersByAssessmentCommand" ; import { GetEvidenceFoldersByAssessmentControlCommandInput , GetEvidenceFoldersByAssessmentControlCommandOutput , } from "../commands/GetEvidenceFoldersByAssessmentControlCommand" ; import { GetInsightsByAssessmentCommandInput , GetInsightsByAssessmentCommandOutput , } from "../commands/GetInsightsByAssessmentCommand" ; import { GetInsightsCommandInput , GetInsightsCommandOutput } from "../commands/GetInsightsCommand" ; import { GetOrganizationAdminAccountCommandInput , GetOrganizationAdminAccountCommandOutput , } from "../commands/GetOrganizationAdminAccountCommand" ; import { GetServicesInScopeCommandInput , GetServicesInScopeCommandOutput } from "../commands/GetServicesInScopeCommand" ; import { GetSettingsCommandInput , GetSettingsCommandOutput } from "../commands/GetSettingsCommand" ; import { ListAssessmentControlInsightsByControlDomainCommandInput , ListAssessmentControlInsightsByControlDomainCommandOutput , } from "../commands/ListAssessmentControlInsightsByControlDomainCommand" ; import { ListAssessmentFrameworksCommandInput , ListAssessmentFrameworksCommandOutput , } from "../commands/ListAssessmentFrameworksCommand" ; import { ListAssessmentFrameworkShareRequestsCommandInput , ListAssessmentFrameworkShareRequestsCommandOutput , } from "../commands/ListAssessmentFrameworkShareRequestsCommand" ; import { ListAssessmentReportsCommandInput , ListAssessmentReportsCommandOutput , } from "../commands/ListAssessmentReportsCommand" ; import { ListAssessmentsCommandInput , ListAssessmentsCommandOutput } from "../commands/ListAssessmentsCommand" ; import { ListControlDomainInsightsByAssessmentCommandInput , ListControlDomainInsightsByAssessmentCommandOutput , } from "../commands/ListControlDomainInsightsByAssessmentCommand" ; import { ListControlDomainInsightsCommandInput , ListControlDomainInsightsCommandOutput , } from "../commands/ListControlDomainInsightsCommand" ; import { ListControlInsightsByControlDomainCommandInput , ListControlInsightsByControlDomainCommandOutput , } from "../commands/ListControlInsightsByControlDomainCommand" ; import { ListControlsCommandInput , ListControlsCommandOutput } from "../commands/ListControlsCommand" ; import { ListKeywordsForDataSourceCommandInput , ListKeywordsForDataSourceCommandOutput , } from "../commands/ListKeywordsForDataSourceCommand" ; import { ListNotificationsCommandInput , ListNotificationsCommandOutput } from "../commands/ListNotificationsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { RegisterAccountCommandInput , RegisterAccountCommandOutput } from "../commands/RegisterAccountCommand" ; import { RegisterOrganizationAdminAccountCommandInput , RegisterOrganizationAdminAccountCommandOutput , } from "../commands/RegisterOrganizationAdminAccountCommand" ; import { StartAssessmentFrameworkShareCommandInput , StartAssessmentFrameworkShareCommandOutput , } from "../commands/StartAssessmentFrameworkShareCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateAssessmentCommandInput , UpdateAssessmentCommandOutput } from "../commands/UpdateAssessmentCommand" ; import { UpdateAssessmentControlCommandInput , UpdateAssessmentControlCommandOutput , } from "../commands/UpdateAssessmentControlCommand" ; import { UpdateAssessmentControlSetStatusCommandInput , UpdateAssessmentControlSetStatusCommandOutput , } from "../commands/UpdateAssessmentControlSetStatusCommand" ; import { UpdateAssessmentFrameworkCommandInput , UpdateAssessmentFrameworkCommandOutput , } from "../commands/UpdateAssessmentFrameworkCommand" ; import { UpdateAssessmentFrameworkShareCommandInput , UpdateAssessmentFrameworkShareCommandOutput , } from "../commands/UpdateAssessmentFrameworkShareCommand" ; import { UpdateAssessmentStatusCommandInput , UpdateAssessmentStatusCommandOutput , } from "../commands/UpdateAssessmentStatusCommand" ; import { UpdateControlCommandInput , UpdateControlCommandOutput } from "../commands/UpdateControlCommand" ; import { UpdateSettingsCommandInput , UpdateSettingsCommandOutput } from "../commands/UpdateSettingsCommand" ; import { ValidateAssessmentReportIntegrityCommandInput , ValidateAssessmentReportIntegrityCommandOutput , } from "../commands/ValidateAssessmentReportIntegrityCommand" ; import { AccessDeniedException , Assessment , AssessmentControl , AssessmentControlSet , AssessmentEvidenceFolder , AssessmentFramework , AssessmentFrameworkMetadata , AssessmentFrameworkShareRequest , AssessmentMetadata , AssessmentMetadataItem , AssessmentReport , AssessmentReportEvidenceError , AssessmentReportMetadata , AssessmentReportsDestination , AWSAccount , AWSService , BatchCreateDelegationByAssessmentError , BatchDeleteDelegationByAssessmentError , BatchImportEvidenceToAssessmentControlError , ChangeLog , Control , ControlComment , ControlDomainInsights , ControlInsightsMetadataByAssessmentItem , ControlInsightsMetadataItem , ControlMappingSource , ControlMetadata , ControlSet , CreateAssessmentFrameworkControl , CreateAssessmentFrameworkControlSet , CreateControlMappingSource , CreateDelegationRequest , Delegation , DelegationMetadata , Evidence , EvidenceInsights , Framework , FrameworkMetadata , Insights , InsightsByAssessment , InternalServerException , ManualEvidence , Notification , Resource , ResourceNotFoundException , Role , Scope , ServiceMetadata , Settings , SourceKeyword , UpdateAssessmentFrameworkControlSet , URL , ValidationException , ValidationExceptionField , } from "../models/models_0" ; export const serializeAws_restJson1AssociateAssessmentReportEvidenceFolderCommand = 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 || "" }` + "/assessments/{assessmentId}/associateToAssessmentReport" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . evidenceFolderId !== undefined && input . evidenceFolderId !== null && { evidenceFolderId : input . evidenceFolderId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchAssociateAssessmentReportEvidenceCommand = 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 || "" }` + "/assessments/{assessmentId}/batchAssociateToAssessmentReport" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . evidenceFolderId !== undefined && input . evidenceFolderId !== null && { evidenceFolderId : input . evidenceFolderId } ) , ... ( input . evidenceIds !== undefined && input . evidenceIds !== null && { evidenceIds : serializeAws_restJson1EvidenceIds ( input . evidenceIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchCreateDelegationByAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}/delegations" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . createDelegationRequests !== undefined && input . createDelegationRequests !== null && { createDelegationRequests : serializeAws_restJson1CreateDelegationRequests ( input . createDelegationRequests , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchDeleteDelegationByAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}/delegations" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . delegationIds !== undefined && input . delegationIds !== null && { delegationIds : serializeAws_restJson1DelegationIds ( input . delegationIds , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchDisassociateAssessmentReportEvidenceCommand = 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 || "" }` + "/assessments/{assessmentId}/batchDisassociateFromAssessmentReport" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . evidenceFolderId !== undefined && input . evidenceFolderId !== null && { evidenceFolderId : input . evidenceFolderId } ) , ... ( input . evidenceIds !== undefined && input . evidenceIds !== null && { evidenceIds : serializeAws_restJson1EvidenceIds ( input . evidenceIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchImportEvidenceToAssessmentControlCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}/evidence" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } let body ; body = JSON . stringify ( { ... ( input . manualEvidence !== undefined && input . manualEvidence !== null && { manualEvidence : serializeAws_restJson1ManualEvidenceList ( input . manualEvidence , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateAssessmentCommand = 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 || "" }` + "/assessments" ; let body ; body = JSON . stringify ( { ... ( input . assessmentReportsDestination !== undefined && input . assessmentReportsDestination !== null && { assessmentReportsDestination : serializeAws_restJson1AssessmentReportsDestination ( input . assessmentReportsDestination , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . frameworkId !== undefined && input . frameworkId !== null && { frameworkId : input . frameworkId } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . roles !== undefined && input . roles !== null && { roles : serializeAws_restJson1Roles ( input . roles , context ) } ) , ... ( input . scope !== undefined && input . scope !== null && { scope : serializeAws_restJson1Scope ( input . scope , context ) } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateAssessmentFrameworkCommand = 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 || "" }` + "/assessmentFrameworks" ; let body ; body = JSON . stringify ( { ... ( input . complianceType !== undefined && input . complianceType !== null && { complianceType : input . complianceType } ) , ... ( input . controlSets !== undefined && input . controlSets !== null && { controlSets : serializeAws_restJson1CreateAssessmentFrameworkControlSets ( input . controlSets , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateAssessmentReportCommand = 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 || "" }` + "/assessments/{assessmentId}/reports" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateControlCommand = 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 || "" }` + "/controls" ; let body ; body = JSON . stringify ( { ... ( input . actionPlanInstructions !== undefined && input . actionPlanInstructions !== null && { actionPlanInstructions : input . actionPlanInstructions } ) , ... ( input . actionPlanTitle !== undefined && input . actionPlanTitle !== null && { actionPlanTitle : input . actionPlanTitle } ) , ... ( input . controlMappingSources !== undefined && input . controlMappingSources !== null && { controlMappingSources : serializeAws_restJson1CreateControlMappingSources ( input . controlMappingSources , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , ... ( input . testingInformation !== undefined && input . testingInformation !== null && { testingInformation : input . testingInformation } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAssessmentFrameworkCommand = 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 || "" }` + "/assessmentFrameworks/{frameworkId}" ; if ( input . frameworkId !== undefined ) { const labelValue = input . frameworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: frameworkId." ) ; } resolvedPath = resolvedPath . replace ( "{frameworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: frameworkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAssessmentFrameworkShareCommand = 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 || "" }` + "/assessmentFrameworkShareRequests/{requestId}" ; if ( input . requestId !== undefined ) { const labelValue = input . requestId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: requestId." ) ; } resolvedPath = resolvedPath . replace ( "{requestId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: requestId." ) ; } const query = { ... ( input . requestType !== undefined && { requestType : input . requestType } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteAssessmentReportCommand = 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 || "" }` + "/assessments/{assessmentId}/reports/{assessmentReportId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . assessmentReportId !== undefined ) { const labelValue = input . assessmentReportId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentReportId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentReportId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentReportId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteControlCommand = 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 || "" }` + "/controls/{controlId}" ; if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeregisterAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/deregisterAccount" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeregisterOrganizationAdminAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/deregisterOrganizationAdminAccount" ; let body ; body = JSON . stringify ( { ... ( input . adminAccountId !== undefined && input . adminAccountId !== null && { adminAccountId : input . adminAccountId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateAssessmentReportEvidenceFolderCommand = 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 || "" }` + "/assessments/{assessmentId}/disassociateFromAssessmentReport" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . evidenceFolderId !== undefined && input . evidenceFolderId !== null && { evidenceFolderId : input . evidenceFolderId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAccountStatusCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/status" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAssessmentFrameworkCommand = 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 || "" }` + "/assessmentFrameworks/{frameworkId}" ; if ( input . frameworkId !== undefined ) { const labelValue = input . frameworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: frameworkId." ) ; } resolvedPath = resolvedPath . replace ( "{frameworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: frameworkId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAssessmentReportUrlCommand = 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 || "" }` + "/assessments/{assessmentId}/reports/{assessmentReportId}/url" ; if ( input . assessmentReportId !== undefined ) { const labelValue = input . assessmentReportId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentReportId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentReportId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentReportId." ) ; } if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetChangeLogsCommand = 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 || "" }` + "/assessments/{assessmentId}/changelogs" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } const query = { ... ( input . controlSetId !== undefined && { controlSetId : input . controlSetId } ) , ... ( input . controlId !== undefined && { controlId : input . controlId } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetControlCommand = 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 || "" }` + "/controls/{controlId}" ; if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDelegationsCommand = 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 || "" }` + "/delegations" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetEvidenceCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}/evidence/{evidenceId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . evidenceFolderId !== undefined ) { const labelValue = input . evidenceFolderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: evidenceFolderId." ) ; } resolvedPath = resolvedPath . replace ( "{evidenceFolderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: evidenceFolderId." ) ; } if ( input . evidenceId !== undefined ) { const labelValue = input . evidenceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: evidenceId." ) ; } resolvedPath = resolvedPath . replace ( "{evidenceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: evidenceId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEvidenceByEvidenceFolderCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}/evidence" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . evidenceFolderId !== undefined ) { const labelValue = input . evidenceFolderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: evidenceFolderId." ) ; } resolvedPath = resolvedPath . replace ( "{evidenceFolderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: evidenceFolderId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetEvidenceFolderCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . evidenceFolderId !== undefined ) { const labelValue = input . evidenceFolderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: evidenceFolderId." ) ; } resolvedPath = resolvedPath . replace ( "{evidenceFolderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: evidenceFolderId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEvidenceFoldersByAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}/evidenceFolders" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetEvidenceFoldersByAssessmentControlCommand = 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 || "" }` + "/assessments/{assessmentId}/evidenceFolders-by-assessment-control/{controlSetId}/{controlId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetInsightsCommand = 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 || "" }` + "/insights" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetInsightsByAssessmentCommand = 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 || "" }` + "/insights/assessments/{assessmentId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetOrganizationAdminAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/organizationAdminAccount" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetServicesInScopeCommand = 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 || "" }` + "/services" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSettingsCommand = 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 || "" }` + "/settings/{attribute}" ; if ( input . attribute !== undefined ) { const labelValue = input . attribute ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: attribute." ) ; } resolvedPath = resolvedPath . replace ( "{attribute}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: attribute." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListAssessmentControlInsightsByControlDomainCommand = 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 || "" }` + "/insights/controls-by-assessment" ; const query = { ... ( input . controlDomainId !== undefined && { controlDomainId : input . controlDomainId } ) , ... ( input . assessmentId !== undefined && { assessmentId : input . assessmentId } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListAssessmentFrameworksCommand = 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 || "" }` + "/assessmentFrameworks" ; const query = { ... ( input . frameworkType !== undefined && { frameworkType : input . frameworkType } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListAssessmentFrameworkShareRequestsCommand = 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 || "" }` + "/assessmentFrameworkShareRequests" ; const query = { ... ( input . requestType !== undefined && { requestType : input . requestType } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListAssessmentReportsCommand = 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 || "" }` + "/assessmentReports" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListAssessmentsCommand = 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 || "" }` + "/assessments" ; const query = { ... ( input . status !== undefined && { status : input . status } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListControlDomainInsightsCommand = 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 || "" }` + "/insights/control-domains" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListControlDomainInsightsByAssessmentCommand = 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 || "" }` + "/insights/control-domains-by-assessment" ; const query = { ... ( input . assessmentId !== undefined && { assessmentId : input . assessmentId } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListControlInsightsByControlDomainCommand = 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 || "" }` + "/insights/controls" ; const query = { ... ( input . controlDomainId !== undefined && { controlDomainId : input . controlDomainId } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListControlsCommand = 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 || "" }` + "/controls" ; const query = { ... ( input . controlType !== undefined && { controlType : input . controlType } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListKeywordsForDataSourceCommand = 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 || "" }` + "/dataSourceKeywords" ; const query = { ... ( input . source !== undefined && { source : input . source } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListNotificationsCommand = 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 || "" }` + "/notifications" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RegisterAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/registerAccount" ; let body ; body = JSON . stringify ( { ... ( input . delegatedAdminAccount !== undefined && input . delegatedAdminAccount !== null && { delegatedAdminAccount : input . delegatedAdminAccount } ) , ... ( input . kmsKey !== undefined && input . kmsKey !== null && { kmsKey : input . kmsKey } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RegisterOrganizationAdminAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/account/registerOrganizationAdminAccount" ; let body ; body = JSON . stringify ( { ... ( input . adminAccountId !== undefined && input . adminAccountId !== null && { adminAccountId : input . adminAccountId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartAssessmentFrameworkShareCommand = 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 || "" }` + "/assessmentFrameworks/{frameworkId}/shareRequests" ; if ( input . frameworkId !== undefined ) { const labelValue = input . frameworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: frameworkId." ) ; } resolvedPath = resolvedPath . replace ( "{frameworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: frameworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . comment !== undefined && input . comment !== null && { comment : input . comment } ) , ... ( input . destinationAccount !== undefined && input . destinationAccount !== null && { destinationAccount : input . destinationAccount } ) , ... ( input . destinationRegion !== undefined && input . destinationRegion !== null && { destinationRegion : input . destinationRegion } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } const query = { ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentCommand = 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 || "" }` + "/assessments/{assessmentId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . assessmentDescription !== undefined && input . assessmentDescription !== null && { assessmentDescription : input . assessmentDescription } ) , ... ( input . assessmentName !== undefined && input . assessmentName !== null && { assessmentName : input . assessmentName } ) , ... ( input . assessmentReportsDestination !== undefined && input . assessmentReportsDestination !== null && { assessmentReportsDestination : serializeAws_restJson1AssessmentReportsDestination ( input . assessmentReportsDestination , context ) , } ) , ... ( input . roles !== undefined && input . roles !== null && { roles : serializeAws_restJson1Roles ( input . roles , context ) } ) , ... ( input . scope !== undefined && input . scope !== null && { scope : serializeAws_restJson1Scope ( input . scope , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentControlCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } let body ; body = JSON . stringify ( { ... ( input . commentBody !== undefined && input . commentBody !== null && { commentBody : input . commentBody } ) , ... ( input . controlStatus !== undefined && input . controlStatus !== null && { controlStatus : input . controlStatus } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentControlSetStatusCommand = 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 || "" }` + "/assessments/{assessmentId}/controlSets/{controlSetId}/status" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } if ( input . controlSetId !== undefined ) { const labelValue = input . controlSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlSetId." ) ; } resolvedPath = resolvedPath . replace ( "{controlSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlSetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . comment !== undefined && input . comment !== null && { comment : input . comment } ) , ... ( input . status !== undefined && input . status !== null && { status : input . status } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentFrameworkCommand = 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 || "" }` + "/assessmentFrameworks/{frameworkId}" ; if ( input . frameworkId !== undefined ) { const labelValue = input . frameworkId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: frameworkId." ) ; } resolvedPath = resolvedPath . replace ( "{frameworkId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: frameworkId." ) ; } let body ; body = JSON . stringify ( { ... ( input . complianceType !== undefined && input . complianceType !== null && { complianceType : input . complianceType } ) , ... ( input . controlSets !== undefined && input . controlSets !== null && { controlSets : serializeAws_restJson1UpdateAssessmentFrameworkControlSets ( input . controlSets , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentFrameworkShareCommand = 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 || "" }` + "/assessmentFrameworkShareRequests/{requestId}" ; if ( input . requestId !== undefined ) { const labelValue = input . requestId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: requestId." ) ; } resolvedPath = resolvedPath . replace ( "{requestId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: requestId." ) ; } let body ; body = JSON . stringify ( { ... ( input . action !== undefined && input . action !== null && { action : input . action } ) , ... ( input . requestType !== undefined && input . requestType !== null && { requestType : input . requestType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateAssessmentStatusCommand = 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 || "" }` + "/assessments/{assessmentId}/status" ; if ( input . assessmentId !== undefined ) { const labelValue = input . assessmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: assessmentId." ) ; } resolvedPath = resolvedPath . replace ( "{assessmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: assessmentId." ) ; } let body ; body = JSON . stringify ( { ... ( input . status !== undefined && input . status !== null && { status : input . status } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateControlCommand = 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 || "" }` + "/controls/{controlId}" ; if ( input . controlId !== undefined ) { const labelValue = input . controlId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: controlId." ) ; } resolvedPath = resolvedPath . replace ( "{controlId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: controlId." ) ; } let body ; body = JSON . stringify ( { ... ( input . actionPlanInstructions !== undefined && input . actionPlanInstructions !== null && { actionPlanInstructions : input . actionPlanInstructions } ) , ... ( input . actionPlanTitle !== undefined && input . actionPlanTitle !== null && { actionPlanTitle : input . actionPlanTitle } ) , ... ( input . controlMappingSources !== undefined && input . controlMappingSources !== null && { controlMappingSources : serializeAws_restJson1ControlMappingSources ( input . controlMappingSources , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . testingInformation !== undefined && input . testingInformation !== null && { testingInformation : input . testingInformation } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSettingsCommand = 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 || "" }` + "/settings" ; let body ; body = JSON . stringify ( { ... ( input . defaultAssessmentReportsDestination !== undefined && input . defaultAssessmentReportsDestination !== null && { defaultAssessmentReportsDestination : serializeAws_restJson1AssessmentReportsDestination ( input . defaultAssessmentReportsDestination , context ) , } ) , ... ( input . defaultProcessOwners !== undefined && input . defaultProcessOwners !== null && { defaultProcessOwners : serializeAws_restJson1Roles ( input . defaultProcessOwners , context ) , } ) , ... ( input . kmsKey !== undefined && input . kmsKey !== null && { kmsKey : input . kmsKey } ) , ... ( input . snsTopic !== undefined && input . snsTopic !== null && { snsTopic : input . snsTopic } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ValidateAssessmentReportIntegrityCommand = 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 || "" }` + "/assessmentReports/integrity" ; let body ; body = JSON . stringify ( { ... ( input . s3RelativePath !== undefined && input . s3RelativePath !== null && { s3RelativePath : input . s3RelativePath } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateAssessmentReportEvidenceFolderCommand = async ( output , context ) : Promise < AssociateAssessmentReportEvidenceFolderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateAssessmentReportEvidenceFolderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateAssessmentReportEvidenceFolderCommandError = async ( output , context ) : Promise < AssociateAssessmentReportEvidenceFolderCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1BatchAssociateAssessmentReportEvidenceCommand = async ( output , context ) : Promise < BatchAssociateAssessmentReportEvidenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchAssociateAssessmentReportEvidenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , errors : undefined , evidenceIds : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . errors !== undefined && data . errors !== null ) { contents . errors = deserializeAws_restJson1AssessmentReportEvidenceErrors ( data . errors , context ) ; } if ( data . evidenceIds !== undefined && data . evidenceIds !== null ) { contents . evidenceIds = deserializeAws_restJson1EvidenceIds ( data . evidenceIds , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchAssociateAssessmentReportEvidenceCommandError = async ( output , context ) : Promise < BatchAssociateAssessmentReportEvidenceCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1BatchCreateDelegationByAssessmentCommand = async ( output , context ) : Promise < BatchCreateDelegationByAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchCreateDelegationByAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , delegations : undefined , errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . delegations !== undefined && data . delegations !== null ) { contents . delegations = deserializeAws_restJson1Delegations ( data . delegations , context ) ; } if ( data . errors !== undefined && data . errors !== null ) { contents . errors = deserializeAws_restJson1BatchCreateDelegationByAssessmentErrors ( data . errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchCreateDelegationByAssessmentCommandError = async ( output , context ) : Promise < BatchCreateDelegationByAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1BatchDeleteDelegationByAssessmentCommand = async ( output , context ) : Promise < BatchDeleteDelegationByAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchDeleteDelegationByAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . errors !== undefined && data . errors !== null ) { contents . errors = deserializeAws_restJson1BatchDeleteDelegationByAssessmentErrors ( data . errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchDeleteDelegationByAssessmentCommandError = async ( output , context ) : Promise < BatchDeleteDelegationByAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1BatchDisassociateAssessmentReportEvidenceCommand = async ( output , context ) : Promise < BatchDisassociateAssessmentReportEvidenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchDisassociateAssessmentReportEvidenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , errors : undefined , evidenceIds : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . errors !== undefined && data . errors !== null ) { contents . errors = deserializeAws_restJson1AssessmentReportEvidenceErrors ( data . errors , context ) ; } if ( data . evidenceIds !== undefined && data . evidenceIds !== null ) { contents . evidenceIds = deserializeAws_restJson1EvidenceIds ( data . evidenceIds , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchDisassociateAssessmentReportEvidenceCommandError = async ( output , context ) : Promise < BatchDisassociateAssessmentReportEvidenceCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1BatchImportEvidenceToAssessmentControlCommand = async ( output , context ) : Promise < BatchImportEvidenceToAssessmentControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchImportEvidenceToAssessmentControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . errors !== undefined && data . errors !== null ) { contents . errors = deserializeAws_restJson1BatchImportEvidenceToAssessmentControlErrors ( data . errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchImportEvidenceToAssessmentControlCommandError = async ( output , context ) : Promise < BatchImportEvidenceToAssessmentControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1CreateAssessmentCommand = async ( output , context ) : Promise < CreateAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessment !== undefined && data . assessment !== null ) { contents . assessment = deserializeAws_restJson1Assessment ( data . assessment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAssessmentCommandError = async ( output , context ) : Promise < CreateAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1CreateAssessmentFrameworkCommand = async ( output , context ) : Promise < CreateAssessmentFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAssessmentFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , framework : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . framework !== undefined && data . framework !== null ) { contents . framework = deserializeAws_restJson1Framework ( data . framework , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAssessmentFrameworkCommandError = async ( output , context ) : Promise < CreateAssessmentFrameworkCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1CreateAssessmentReportCommand = async ( output , context ) : Promise < CreateAssessmentReportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAssessmentReportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentReport : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentReport !== undefined && data . assessmentReport !== null ) { contents . assessmentReport = deserializeAws_restJson1AssessmentReport ( data . assessmentReport , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAssessmentReportCommandError = async ( output , context ) : Promise < CreateAssessmentReportCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1CreateControlCommand = async ( output , context ) : Promise < CreateControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , control : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . control !== undefined && data . control !== null ) { contents . control = deserializeAws_restJson1Control ( data . control , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateControlCommandError = async ( output , context ) : Promise < CreateControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeleteAssessmentCommand = async ( output , context ) : Promise < DeleteAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAssessmentCommandError = async ( output , context ) : Promise < DeleteAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeleteAssessmentFrameworkCommand = async ( output , context ) : Promise < DeleteAssessmentFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAssessmentFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAssessmentFrameworkCommandError = async ( output , context ) : Promise < DeleteAssessmentFrameworkCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeleteAssessmentFrameworkShareCommand = async ( output , context ) : Promise < DeleteAssessmentFrameworkShareCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAssessmentFrameworkShareCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAssessmentFrameworkShareCommandError = async ( output , context ) : Promise < DeleteAssessmentFrameworkShareCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeleteAssessmentReportCommand = async ( output , context ) : Promise < DeleteAssessmentReportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAssessmentReportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAssessmentReportCommandError = async ( output , context ) : Promise < DeleteAssessmentReportCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeleteControlCommand = async ( output , context ) : Promise < DeleteControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteControlCommandError = async ( output , context ) : Promise < DeleteControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeregisterAccountCommand = async ( output , context ) : Promise < DeregisterAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeregisterAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeregisterAccountCommandError = async ( output , context ) : Promise < DeregisterAccountCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DeregisterOrganizationAdminAccountCommand = async ( output , context ) : Promise < DeregisterOrganizationAdminAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeregisterOrganizationAdminAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeregisterOrganizationAdminAccountCommandError = async ( output , context ) : Promise < DeregisterOrganizationAdminAccountCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1DisassociateAssessmentReportEvidenceFolderCommand = async ( output , context ) : Promise < DisassociateAssessmentReportEvidenceFolderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateAssessmentReportEvidenceFolderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateAssessmentReportEvidenceFolderCommandError = async ( output , context ) : Promise < DisassociateAssessmentReportEvidenceFolderCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetAccountStatusCommand = async ( output , context ) : Promise < GetAccountStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAccountStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAccountStatusCommandError = async ( output , context ) : Promise < GetAccountStatusCommandOutput > => { 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.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( 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_restJson1GetAssessmentCommand = async ( output , context ) : Promise < GetAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessment : undefined , userRole : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessment !== undefined && data . assessment !== null ) { contents . assessment = deserializeAws_restJson1Assessment ( data . assessment , context ) ; } if ( data . userRole !== undefined && data . userRole !== null ) { contents . userRole = deserializeAws_restJson1Role ( data . userRole , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAssessmentCommandError = async ( output , context ) : Promise < GetAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetAssessmentFrameworkCommand = async ( output , context ) : Promise < GetAssessmentFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAssessmentFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , framework : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . framework !== undefined && data . framework !== null ) { contents . framework = deserializeAws_restJson1Framework ( data . framework , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAssessmentFrameworkCommandError = async ( output , context ) : Promise < GetAssessmentFrameworkCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetAssessmentReportUrlCommand = async ( output , context ) : Promise < GetAssessmentReportUrlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAssessmentReportUrlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , preSignedUrl : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . preSignedUrl !== undefined && data . preSignedUrl !== null ) { contents . preSignedUrl = deserializeAws_restJson1URL ( data . preSignedUrl , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAssessmentReportUrlCommandError = async ( output , context ) : Promise < GetAssessmentReportUrlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetChangeLogsCommand = async ( output , context ) : Promise < GetChangeLogsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetChangeLogsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , changeLogs : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . changeLogs !== undefined && data . changeLogs !== null ) { contents . changeLogs = deserializeAws_restJson1ChangeLogs ( data . changeLogs , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetChangeLogsCommandError = async ( output , context ) : Promise < GetChangeLogsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetControlCommand = async ( output , context ) : Promise < GetControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , control : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . control !== undefined && data . control !== null ) { contents . control = deserializeAws_restJson1Control ( data . control , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetControlCommandError = async ( output , context ) : Promise < GetControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetDelegationsCommand = async ( output , context ) : Promise < GetDelegationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDelegationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , delegations : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . delegations !== undefined && data . delegations !== null ) { contents . delegations = deserializeAws_restJson1DelegationMetadataList ( data . delegations , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDelegationsCommandError = async ( output , context ) : Promise < GetDelegationsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetEvidenceCommand = async ( output , context ) : Promise < GetEvidenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEvidenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , evidence : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . evidence !== undefined && data . evidence !== null ) { contents . evidence = deserializeAws_restJson1Evidence ( data . evidence , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEvidenceCommandError = async ( output , context ) : Promise < GetEvidenceCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetEvidenceByEvidenceFolderCommand = async ( output , context ) : Promise < GetEvidenceByEvidenceFolderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEvidenceByEvidenceFolderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , evidence : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . evidence !== undefined && data . evidence !== null ) { contents . evidence = deserializeAws_restJson1EvidenceList ( data . evidence , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEvidenceByEvidenceFolderCommandError = async ( output , context ) : Promise < GetEvidenceByEvidenceFolderCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetEvidenceFolderCommand = async ( output , context ) : Promise < GetEvidenceFolderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEvidenceFolderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , evidenceFolder : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . evidenceFolder !== undefined && data . evidenceFolder !== null ) { contents . evidenceFolder = deserializeAws_restJson1AssessmentEvidenceFolder ( data . evidenceFolder , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEvidenceFolderCommandError = async ( output , context ) : Promise < GetEvidenceFolderCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetEvidenceFoldersByAssessmentCommand = async ( output , context ) : Promise < GetEvidenceFoldersByAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEvidenceFoldersByAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , evidenceFolders : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . evidenceFolders !== undefined && data . evidenceFolders !== null ) { contents . evidenceFolders = deserializeAws_restJson1AssessmentEvidenceFolders ( data . evidenceFolders , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEvidenceFoldersByAssessmentCommandError = async ( output , context ) : Promise < GetEvidenceFoldersByAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetEvidenceFoldersByAssessmentControlCommand = async ( output , context ) : Promise < GetEvidenceFoldersByAssessmentControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEvidenceFoldersByAssessmentControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , evidenceFolders : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . evidenceFolders !== undefined && data . evidenceFolders !== null ) { contents . evidenceFolders = deserializeAws_restJson1AssessmentEvidenceFolders ( data . evidenceFolders , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEvidenceFoldersByAssessmentControlCommandError = async ( output , context ) : Promise < GetEvidenceFoldersByAssessmentControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetInsightsCommand = async ( output , context ) : Promise < GetInsightsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetInsightsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , insights : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . insights !== undefined && data . insights !== null ) { contents . insights = deserializeAws_restJson1Insights ( data . insights , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetInsightsCommandError = async ( output , context ) : Promise < GetInsightsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( 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_restJson1GetInsightsByAssessmentCommand = async ( output , context ) : Promise < GetInsightsByAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetInsightsByAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , insights : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . insights !== undefined && data . insights !== null ) { contents . insights = deserializeAws_restJson1InsightsByAssessment ( data . insights , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetInsightsByAssessmentCommandError = async ( output , context ) : Promise < GetInsightsByAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetOrganizationAdminAccountCommand = async ( output , context ) : Promise < GetOrganizationAdminAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetOrganizationAdminAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , adminAccountId : undefined , organizationId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . adminAccountId !== undefined && data . adminAccountId !== null ) { contents . adminAccountId = __expectString ( data . adminAccountId ) ; } if ( data . organizationId !== undefined && data . organizationId !== null ) { contents . organizationId = __expectString ( data . organizationId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetOrganizationAdminAccountCommandError = async ( output , context ) : Promise < GetOrganizationAdminAccountCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetServicesInScopeCommand = async ( output , context ) : Promise < GetServicesInScopeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetServicesInScopeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , serviceMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . serviceMetadata !== undefined && data . serviceMetadata !== null ) { contents . serviceMetadata = deserializeAws_restJson1ServiceMetadataList ( data . serviceMetadata , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetServicesInScopeCommandError = async ( output , context ) : Promise < GetServicesInScopeCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1GetSettingsCommand = async ( output , context ) : Promise < GetSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , settings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . settings !== undefined && data . settings !== null ) { contents . settings = deserializeAws_restJson1Settings ( data . settings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSettingsCommandError = async ( output , context ) : Promise < GetSettingsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( 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_restJson1ListAssessmentControlInsightsByControlDomainCommand = async ( output , context ) : Promise < ListAssessmentControlInsightsByControlDomainCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAssessmentControlInsightsByControlDomainCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlInsightsByAssessment : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlInsightsByAssessment !== undefined && data . controlInsightsByAssessment !== null ) { contents . controlInsightsByAssessment = deserializeAws_restJson1ControlInsightsMetadataByAssessment ( data . controlInsightsByAssessment , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAssessmentControlInsightsByControlDomainCommandError = async ( output , context ) : Promise < ListAssessmentControlInsightsByControlDomainCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListAssessmentFrameworksCommand = async ( output , context ) : Promise < ListAssessmentFrameworksCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAssessmentFrameworksCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , frameworkMetadataList : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . frameworkMetadataList !== undefined && data . frameworkMetadataList !== null ) { contents . frameworkMetadataList = deserializeAws_restJson1FrameworkMetadataList ( data . frameworkMetadataList , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAssessmentFrameworksCommandError = async ( output , context ) : Promise < ListAssessmentFrameworksCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListAssessmentFrameworkShareRequestsCommand = async ( output , context ) : Promise < ListAssessmentFrameworkShareRequestsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAssessmentFrameworkShareRequestsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentFrameworkShareRequests : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentFrameworkShareRequests !== undefined && data . assessmentFrameworkShareRequests !== null ) { contents . assessmentFrameworkShareRequests = deserializeAws_restJson1AssessmentFrameworkShareRequestList ( data . assessmentFrameworkShareRequests , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAssessmentFrameworkShareRequestsCommandError = async ( output , context ) : Promise < ListAssessmentFrameworkShareRequestsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListAssessmentReportsCommand = async ( output , context ) : Promise < ListAssessmentReportsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAssessmentReportsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentReports : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentReports !== undefined && data . assessmentReports !== null ) { contents . assessmentReports = deserializeAws_restJson1AssessmentReportsMetadata ( data . assessmentReports , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAssessmentReportsCommandError = async ( output , context ) : Promise < ListAssessmentReportsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListAssessmentsCommand = async ( output , context ) : Promise < ListAssessmentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAssessmentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentMetadata : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentMetadata !== undefined && data . assessmentMetadata !== null ) { contents . assessmentMetadata = deserializeAws_restJson1ListAssessmentMetadata ( data . assessmentMetadata , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAssessmentsCommandError = async ( output , context ) : Promise < ListAssessmentsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListControlDomainInsightsCommand = async ( output , context ) : Promise < ListControlDomainInsightsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListControlDomainInsightsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlDomainInsights : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlDomainInsights !== undefined && data . controlDomainInsights !== null ) { contents . controlDomainInsights = deserializeAws_restJson1ControlDomainInsightsList ( data . controlDomainInsights , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListControlDomainInsightsCommandError = async ( output , context ) : Promise < ListControlDomainInsightsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListControlDomainInsightsByAssessmentCommand = async ( output , context ) : Promise < ListControlDomainInsightsByAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListControlDomainInsightsByAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlDomainInsights : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlDomainInsights !== undefined && data . controlDomainInsights !== null ) { contents . controlDomainInsights = deserializeAws_restJson1ControlDomainInsightsList ( data . controlDomainInsights , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListControlDomainInsightsByAssessmentCommandError = async ( output , context ) : Promise < ListControlDomainInsightsByAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListControlInsightsByControlDomainCommand = async ( output , context ) : Promise < ListControlInsightsByControlDomainCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListControlInsightsByControlDomainCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlInsightsMetadata : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlInsightsMetadata !== undefined && data . controlInsightsMetadata !== null ) { contents . controlInsightsMetadata = deserializeAws_restJson1ControlInsightsMetadata ( data . controlInsightsMetadata , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListControlInsightsByControlDomainCommandError = async ( output , context ) : Promise < ListControlInsightsByControlDomainCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListControlsCommand = async ( output , context ) : Promise < ListControlsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListControlsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlMetadataList : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlMetadataList !== undefined && data . controlMetadataList !== null ) { contents . controlMetadataList = deserializeAws_restJson1ControlMetadataList ( data . controlMetadataList , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListControlsCommandError = async ( output , context ) : Promise < ListControlsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListKeywordsForDataSourceCommand = async ( output , context ) : Promise < ListKeywordsForDataSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListKeywordsForDataSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , keywords : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . keywords !== undefined && data . keywords !== null ) { contents . keywords = deserializeAws_restJson1Keywords ( data . keywords , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListKeywordsForDataSourceCommandError = async ( output , context ) : Promise < ListKeywordsForDataSourceCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ListNotificationsCommand = async ( output , context ) : Promise < ListNotificationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListNotificationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , notifications : 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 . notifications !== undefined && data . notifications !== null ) { contents . notifications = deserializeAws_restJson1Notifications ( data . notifications , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListNotificationsCommandError = async ( output , context ) : Promise < ListNotificationsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1RegisterAccountCommand = async ( output , context ) : Promise < RegisterAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RegisterAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RegisterAccountCommandError = async ( output , context ) : Promise < RegisterAccountCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1RegisterOrganizationAdminAccountCommand = async ( output , context ) : Promise < RegisterOrganizationAdminAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RegisterOrganizationAdminAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , adminAccountId : undefined , organizationId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . adminAccountId !== undefined && data . adminAccountId !== null ) { contents . adminAccountId = __expectString ( data . adminAccountId ) ; } if ( data . organizationId !== undefined && data . organizationId !== null ) { contents . organizationId = __expectString ( data . organizationId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RegisterOrganizationAdminAccountCommandError = async ( output , context ) : Promise < RegisterOrganizationAdminAccountCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1StartAssessmentFrameworkShareCommand = async ( output , context ) : Promise < StartAssessmentFrameworkShareCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartAssessmentFrameworkShareCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentFrameworkShareRequest : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentFrameworkShareRequest !== undefined && data . assessmentFrameworkShareRequest !== null ) { contents . assessmentFrameworkShareRequest = deserializeAws_restJson1AssessmentFrameworkShareRequest ( data . assessmentFrameworkShareRequest , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartAssessmentFrameworkShareCommandError = async ( output , context ) : Promise < StartAssessmentFrameworkShareCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentCommand = async ( output , context ) : Promise < UpdateAssessmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessment !== undefined && data . assessment !== null ) { contents . assessment = deserializeAws_restJson1Assessment ( data . assessment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentCommandError = async ( output , context ) : Promise < UpdateAssessmentCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentControlCommand = async ( output , context ) : Promise < UpdateAssessmentControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , control : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . control !== undefined && data . control !== null ) { contents . control = deserializeAws_restJson1AssessmentControl ( data . control , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentControlCommandError = async ( output , context ) : Promise < UpdateAssessmentControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentControlSetStatusCommand = async ( output , context ) : Promise < UpdateAssessmentControlSetStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentControlSetStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , controlSet : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . controlSet !== undefined && data . controlSet !== null ) { contents . controlSet = deserializeAws_restJson1AssessmentControlSet ( data . controlSet , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentControlSetStatusCommandError = async ( output , context ) : Promise < UpdateAssessmentControlSetStatusCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentFrameworkCommand = async ( output , context ) : Promise < UpdateAssessmentFrameworkCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentFrameworkCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , framework : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . framework !== undefined && data . framework !== null ) { contents . framework = deserializeAws_restJson1Framework ( data . framework , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentFrameworkCommandError = async ( output , context ) : Promise < UpdateAssessmentFrameworkCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentFrameworkShareCommand = async ( output , context ) : Promise < UpdateAssessmentFrameworkShareCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentFrameworkShareCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessmentFrameworkShareRequest : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessmentFrameworkShareRequest !== undefined && data . assessmentFrameworkShareRequest !== null ) { contents . assessmentFrameworkShareRequest = deserializeAws_restJson1AssessmentFrameworkShareRequest ( data . assessmentFrameworkShareRequest , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentFrameworkShareCommandError = async ( output , context ) : Promise < UpdateAssessmentFrameworkShareCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateAssessmentStatusCommand = async ( output , context ) : Promise < UpdateAssessmentStatusCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssessmentStatusCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , assessment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . assessment !== undefined && data . assessment !== null ) { contents . assessment = deserializeAws_restJson1Assessment ( data . assessment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssessmentStatusCommandError = async ( output , context ) : Promise < UpdateAssessmentStatusCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateControlCommand = async ( output , context ) : Promise < UpdateControlCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateControlCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , control : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . control !== undefined && data . control !== null ) { contents . control = deserializeAws_restJson1Control ( data . control , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateControlCommandError = async ( output , context ) : Promise < UpdateControlCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1UpdateSettingsCommand = async ( output , context ) : Promise < UpdateSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , settings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . settings !== undefined && data . settings !== null ) { contents . settings = deserializeAws_restJson1Settings ( data . settings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSettingsCommandError = async ( output , context ) : Promise < UpdateSettingsCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_restJson1ValidateAssessmentReportIntegrityCommand = async ( output , context ) : Promise < ValidateAssessmentReportIntegrityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ValidateAssessmentReportIntegrityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , signatureAlgorithm : undefined , signatureDateTime : undefined , signatureKeyId : undefined , signatureValid : undefined , validationErrors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . signatureAlgorithm !== undefined && data . signatureAlgorithm !== null ) { contents . signatureAlgorithm = __expectString ( data . signatureAlgorithm ) ; } if ( data . signatureDateTime !== undefined && data . signatureDateTime !== null ) { contents . signatureDateTime = __expectString ( data . signatureDateTime ) ; } if ( data . signatureKeyId !== undefined && data . signatureKeyId !== null ) { contents . signatureKeyId = __expectString ( data . signatureKeyId ) ; } if ( data . signatureValid !== undefined && data . signatureValid !== null ) { contents . signatureValid = __expectBoolean ( data . signatureValid ) ; } if ( data . validationErrors !== undefined && data . validationErrors !== null ) { contents . validationErrors = deserializeAws_restJson1ValidationErrors ( data . validationErrors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ValidateAssessmentReportIntegrityCommandError = async ( output , context ) : Promise < ValidateAssessmentReportIntegrityCommandOutput > => { 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.auditmanager#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.auditmanager#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.auditmanager#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.auditmanager#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_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 , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , fields : undefined , message : undefined , reason : undefined , } ; const data = parsedOutput . body ; if ( data . fields !== undefined && data . fields !== null ) { contents . fields = deserializeAws_restJson1ValidationExceptionFieldList ( data . fields , context ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . reason !== undefined && data . reason !== null ) { contents . reason = __expectString ( data . reason ) ; } return contents ; } ; const serializeAws_restJson1AssessmentReportsDestination = ( input , context ) : any => { return { ... ( input . destination !== undefined && input . destination !== null && { destination : input . destination } ) , ... ( input . destinationType !== undefined && input . destinationType !== null && { destinationType : input . destinationType } ) , } ; } ; const serializeAws_restJson1AWSAccount = ( input , context ) : any => { return { ... ( input . emailAddress !== undefined && input . emailAddress !== null && { emailAddress : input . emailAddress } ) , ... ( input . id !== undefined && input . id !== null && { id : input . id } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ; } ; const serializeAws_restJson1AWSAccounts = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AWSAccount ( entry , context ) ; } ) ; } ; const serializeAws_restJson1AWSService = ( input , context ) : any => { return { ... ( input . serviceName !== undefined && input . serviceName !== null && { serviceName : input . serviceName } ) , } ; } ; const serializeAws_restJson1AWSServices = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AWSService ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ControlMappingSource = ( input , context ) : any => { return { ... ( input . sourceDescription !== undefined && input . sourceDescription !== null && { sourceDescription : input . sourceDescription } ) , ... ( input . sourceFrequency !== undefined && input . sourceFrequency !== null && { sourceFrequency : input . sourceFrequency } ) , ... ( input . sourceId !== undefined && input . sourceId !== null && { sourceId : input . sourceId } ) , ... ( input . sourceKeyword !== undefined && input . sourceKeyword !== null && { sourceKeyword : serializeAws_restJson1SourceKeyword ( input . sourceKeyword , context ) , } ) , ... ( input . sourceName !== undefined && input . sourceName !== null && { sourceName : input . sourceName } ) , ... ( input . sourceSetUpOption !== undefined && input . sourceSetUpOption !== null && { sourceSetUpOption : input . sourceSetUpOption } ) , ... ( input . sourceType !== undefined && input . sourceType !== null && { sourceType : input . sourceType } ) , ... ( input . troubleshootingText !== undefined && input . troubleshootingText !== null && { troubleshootingText : input . troubleshootingText } ) , } ; } ; const serializeAws_restJson1ControlMappingSources = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ControlMappingSource ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CreateAssessmentFrameworkControl = ( input , context ) : any => { return { ... ( input . id !== undefined && input . id !== null && { id : input . id } ) , } ; } ; const serializeAws_restJson1CreateAssessmentFrameworkControls = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateAssessmentFrameworkControl ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CreateAssessmentFrameworkControlSet = ( input , context ) : any => { return { ... ( input . controls !== undefined && input . controls !== null && { controls : serializeAws_restJson1CreateAssessmentFrameworkControls ( input . controls , context ) , } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ; } ; const serializeAws_restJson1CreateAssessmentFrameworkControlSets = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateAssessmentFrameworkControlSet ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CreateControlMappingSource = ( input , context ) : any => { return { ... ( input . sourceDescription !== undefined && input . sourceDescription !== null && { sourceDescription : input . sourceDescription } ) , ... ( input . sourceFrequency !== undefined && input . sourceFrequency !== null && { sourceFrequency : input . sourceFrequency } ) , ... ( input . sourceKeyword !== undefined && input . sourceKeyword !== null && { sourceKeyword : serializeAws_restJson1SourceKeyword ( input . sourceKeyword , context ) , } ) , ... ( input . sourceName !== undefined && input . sourceName !== null && { sourceName : input . sourceName } ) , ... ( input . sourceSetUpOption !== undefined && input . sourceSetUpOption !== null && { sourceSetUpOption : input . sourceSetUpOption } ) , ... ( input . sourceType !== undefined && input . sourceType !== null && { sourceType : input . sourceType } ) , ... ( input . troubleshootingText !== undefined && input . troubleshootingText !== null && { troubleshootingText : input . troubleshootingText } ) , } ; } ; const serializeAws_restJson1CreateControlMappingSources = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateControlMappingSource ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CreateDelegationRequest = ( input , context ) : any => { return { ... ( input . comment !== undefined && input . comment !== null && { comment : input . comment } ) , ... ( input . controlSetId !== undefined && input . controlSetId !== null && { controlSetId : input . controlSetId } ) , ... ( input . roleArn !== undefined && input . roleArn !== null && { roleArn : input . roleArn } ) , ... ( input . roleType !== undefined && input . roleType !== null && { roleType : input . roleType } ) , } ; } ; const serializeAws_restJson1CreateDelegationRequests = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateDelegationRequest ( entry , context ) ; } ) ; } ; const serializeAws_restJson1DelegationIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1EvidenceIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ManualEvidence = ( input , context ) : any => { return { ... ( input . s3ResourcePath !== undefined && input . s3ResourcePath !== null && { s3ResourcePath : input . s3ResourcePath } ) , } ; } ; const serializeAws_restJson1ManualEvidenceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ManualEvidence ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Role = ( input , context ) : any => { return { ... ( input . roleArn !== undefined && input . roleArn !== null && { roleArn : input . roleArn } ) , ... ( input . roleType !== undefined && input . roleType !== null && { roleType : input . roleType } ) , } ; } ; const serializeAws_restJson1Roles = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Role ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Scope = ( input , context ) : any => { return { ... ( input . awsAccounts !== undefined && input . awsAccounts !== null && { awsAccounts : serializeAws_restJson1AWSAccounts ( input . awsAccounts , context ) } ) , ... ( input . awsServices !== undefined && input . awsServices !== null && { awsServices : serializeAws_restJson1AWSServices ( input . awsServices , context ) } ) , } ; } ; const serializeAws_restJson1SourceKeyword = ( input , context ) : any => { return { ... ( input . keywordInputType !== undefined && input . keywordInputType !== null && { keywordInputType : input . keywordInputType } ) , ... ( input . keywordValue !== undefined && input . keywordValue !== null && { keywordValue : input . keywordValue } ) , } ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1UpdateAssessmentFrameworkControlSet = ( input , context ) : any => { return { ... ( input . controls !== undefined && input . controls !== null && { controls : serializeAws_restJson1CreateAssessmentFrameworkControls ( input . controls , context ) , } ) , ... ( input . id !== undefined && input . id !== null && { id : input . id } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ; } ; const serializeAws_restJson1UpdateAssessmentFrameworkControlSets = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1UpdateAssessmentFrameworkControlSet ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Assessment = ( output , context ) : Assessment => { return { arn : __expectString ( output . arn ) , awsAccount : output . awsAccount !== undefined && output . awsAccount !== null ? deserializeAws_restJson1AWSAccount ( output . awsAccount , context ) : undefined , framework : output . framework !== undefined && output . framework !== null ? deserializeAws_restJson1AssessmentFramework ( output . framework , context ) : undefined , metadata : output . metadata !== undefined && output . metadata !== null ? deserializeAws_restJson1AssessmentMetadata ( output . metadata , context ) : undefined , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AssessmentControl = ( output , context ) : AssessmentControl => { return { assessmentReportEvidenceCount : __expectInt32 ( output . assessmentReportEvidenceCount ) , comments : output . comments !== undefined && output . comments !== null ? deserializeAws_restJson1ControlComments ( output . comments , context ) : undefined , description : __expectString ( output . description ) , evidenceCount : __expectInt32 ( output . evidenceCount ) , evidenceSources : output . evidenceSources !== undefined && output . evidenceSources !== null ? deserializeAws_restJson1EvidenceSources ( output . evidenceSources , context ) : undefined , id : __expectString ( output . id ) , name : __expectString ( output . name ) , response : __expectString ( output . response ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentControls = ( output , context ) : AssessmentControl [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentControl ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssessmentControlSet = ( output , context ) : AssessmentControlSet => { return { controls : output . controls !== undefined && output . controls !== null ? deserializeAws_restJson1AssessmentControls ( output . controls , context ) : undefined , delegations : output . delegations !== undefined && output . delegations !== null ? deserializeAws_restJson1Delegations ( output . delegations , context ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , manualEvidenceCount : __expectInt32 ( output . manualEvidenceCount ) , roles : output . roles !== undefined && output . roles !== null ? deserializeAws_restJson1Roles ( output . roles , context ) : undefined , status : __expectString ( output . status ) , systemEvidenceCount : __expectInt32 ( output . systemEvidenceCount ) , } as any ; } ; const deserializeAws_restJson1AssessmentControlSets = ( output , context ) : AssessmentControlSet [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentControlSet ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssessmentEvidenceFolder = ( output , context ) : AssessmentEvidenceFolder => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentReportSelectionCount : __expectInt32 ( output . assessmentReportSelectionCount ) , author : __expectString ( output . author ) , controlId : __expectString ( output . controlId ) , controlName : __expectString ( output . controlName ) , controlSetId : __expectString ( output . controlSetId ) , dataSource : __expectString ( output . dataSource ) , date : output . date !== undefined && output . date !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . date ) ) ) : undefined , evidenceAwsServiceSourceCount : __expectInt32 ( output . evidenceAwsServiceSourceCount ) , evidenceByTypeComplianceCheckCount : __expectInt32 ( output . evidenceByTypeComplianceCheckCount ) , evidenceByTypeComplianceCheckIssuesCount : __expectInt32 ( output . evidenceByTypeComplianceCheckIssuesCount ) , evidenceByTypeConfigurationDataCount : __expectInt32 ( output . evidenceByTypeConfigurationDataCount ) , evidenceByTypeManualCount : __expectInt32 ( output . evidenceByTypeManualCount ) , evidenceByTypeUserActivityCount : __expectInt32 ( output . evidenceByTypeUserActivityCount ) , evidenceResourcesIncludedCount : __expectInt32 ( output . evidenceResourcesIncludedCount ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , totalEvidence : __expectInt32 ( output . totalEvidence ) , } as any ; } ; const deserializeAws_restJson1AssessmentEvidenceFolders = ( output , context ) : AssessmentEvidenceFolder [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentEvidenceFolder ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssessmentFramework = ( output , context ) : AssessmentFramework => { return { arn : __expectString ( output . arn ) , controlSets : output . controlSets !== undefined && output . controlSets !== null ? deserializeAws_restJson1AssessmentControlSets ( output . controlSets , context ) : undefined , id : __expectString ( output . id ) , metadata : output . metadata !== undefined && output . metadata !== null ? deserializeAws_restJson1FrameworkMetadata ( output . metadata , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AssessmentFrameworkMetadata = ( output , context ) : AssessmentFrameworkMetadata => { return { arn : __expectString ( output . arn ) , complianceType : __expectString ( output . complianceType ) , controlSetsCount : __expectInt32 ( output . controlSetsCount ) , controlsCount : __expectInt32 ( output . controlsCount ) , createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , lastUpdatedAt : output . lastUpdatedAt !== undefined && output . lastUpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedAt ) ) ) : undefined , logo : __expectString ( output . logo ) , name : __expectString ( output . name ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1AssessmentFrameworkShareRequest = ( output , context ) : AssessmentFrameworkShareRequest => { return { comment : __expectString ( output . comment ) , complianceType : __expectString ( output . complianceType ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , customControlsCount : __expectInt32 ( output . customControlsCount ) , destinationAccount : __expectString ( output . destinationAccount ) , destinationRegion : __expectString ( output . destinationRegion ) , expirationTime : output . expirationTime !== undefined && output . expirationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . expirationTime ) ) ) : undefined , frameworkDescription : __expectString ( output . frameworkDescription ) , frameworkId : __expectString ( output . frameworkId ) , frameworkName : __expectString ( output . frameworkName ) , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , sourceAccount : __expectString ( output . sourceAccount ) , standardControlsCount : __expectInt32 ( output . standardControlsCount ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentFrameworkShareRequestList = ( output , context ) : AssessmentFrameworkShareRequest [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentFrameworkShareRequest ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssessmentMetadata = ( output , context ) : AssessmentMetadata => { return { assessmentReportsDestination : output . assessmentReportsDestination !== undefined && output . assessmentReportsDestination !== null ? deserializeAws_restJson1AssessmentReportsDestination ( output . assessmentReportsDestination , context ) : undefined , complianceType : __expectString ( output . complianceType ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , delegations : output . delegations !== undefined && output . delegations !== null ? deserializeAws_restJson1Delegations ( output . delegations , context ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , name : __expectString ( output . name ) , roles : output . roles !== undefined && output . roles !== null ? deserializeAws_restJson1Roles ( output . roles , context ) : undefined , scope : output . scope !== undefined && output . scope !== null ? deserializeAws_restJson1Scope ( output . scope , context ) : undefined , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentMetadataItem = ( output , context ) : AssessmentMetadataItem => { return { complianceType : __expectString ( output . complianceType ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , delegations : output . delegations !== undefined && output . delegations !== null ? deserializeAws_restJson1Delegations ( output . delegations , context ) : undefined , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , name : __expectString ( output . name ) , roles : output . roles !== undefined && output . roles !== null ? deserializeAws_restJson1Roles ( output . roles , context ) : undefined , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentReport = ( output , context ) : AssessmentReport => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentName : __expectString ( output . assessmentName ) , author : __expectString ( output . author ) , awsAccountId : __expectString ( output . awsAccountId ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentReportEvidenceError = ( output , context ) : AssessmentReportEvidenceError => { return { errorCode : __expectString ( output . errorCode ) , errorMessage : __expectString ( output . errorMessage ) , evidenceId : __expectString ( output . evidenceId ) , } as any ; } ; const deserializeAws_restJson1AssessmentReportEvidenceErrors = ( output , context ) : AssessmentReportEvidenceError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentReportEvidenceError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssessmentReportMetadata = ( output , context ) : AssessmentReportMetadata => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentName : __expectString ( output . assessmentName ) , author : __expectString ( output . author ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , description : __expectString ( output . description ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1AssessmentReportsDestination = ( output , context ) : AssessmentReportsDestination => { return { destination : __expectString ( output . destination ) , destinationType : __expectString ( output . destinationType ) , } as any ; } ; const deserializeAws_restJson1AssessmentReportsMetadata = ( output , context ) : AssessmentReportMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentReportMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AWSAccount = ( output , context ) : AWSAccount => { return { emailAddress : __expectString ( output . emailAddress ) , id : __expectString ( output . id ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1AWSAccounts = ( output , context ) : AWSAccount [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AWSAccount ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AWSService = ( output , context ) : AWSService => { return { serviceName : __expectString ( output . serviceName ) , } as any ; } ; const deserializeAws_restJson1AWSServices = ( output , context ) : AWSService [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AWSService ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchCreateDelegationByAssessmentError = ( output , context ) : BatchCreateDelegationByAssessmentError => { return { createDelegationRequest : output . createDelegationRequest !== undefined && output . createDelegationRequest !== null ? deserializeAws_restJson1CreateDelegationRequest ( output . createDelegationRequest , context ) : undefined , errorCode : __expectString ( output . errorCode ) , errorMessage : __expectString ( output . errorMessage ) , } as any ; } ; const deserializeAws_restJson1BatchCreateDelegationByAssessmentErrors = ( output , context ) : BatchCreateDelegationByAssessmentError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchCreateDelegationByAssessmentError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchDeleteDelegationByAssessmentError = ( output , context ) : BatchDeleteDelegationByAssessmentError => { return { delegationId : __expectString ( output . delegationId ) , errorCode : __expectString ( output . errorCode ) , errorMessage : __expectString ( output . errorMessage ) , } as any ; } ; const deserializeAws_restJson1BatchDeleteDelegationByAssessmentErrors = ( output , context ) : BatchDeleteDelegationByAssessmentError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchDeleteDelegationByAssessmentError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchImportEvidenceToAssessmentControlError = ( output , context ) : BatchImportEvidenceToAssessmentControlError => { return { errorCode : __expectString ( output . errorCode ) , errorMessage : __expectString ( output . errorMessage ) , manualEvidence : output . manualEvidence !== undefined && output . manualEvidence !== null ? deserializeAws_restJson1ManualEvidence ( output . manualEvidence , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchImportEvidenceToAssessmentControlErrors = ( output , context ) : BatchImportEvidenceToAssessmentControlError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchImportEvidenceToAssessmentControlError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ChangeLog = ( output , context ) : ChangeLog => { return { action : __expectString ( output . action ) , createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , createdBy : __expectString ( output . createdBy ) , objectName : __expectString ( output . objectName ) , objectType : __expectString ( output . objectType ) , } as any ; } ; const deserializeAws_restJson1ChangeLogs = ( output , context ) : ChangeLog [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ChangeLog ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Control = ( output , context ) : Control => { return { actionPlanInstructions : __expectString ( output . actionPlanInstructions ) , actionPlanTitle : __expectString ( output . actionPlanTitle ) , arn : __expectString ( output . arn ) , controlMappingSources : output . controlMappingSources !== undefined && output . controlMappingSources !== null ? deserializeAws_restJson1ControlMappingSources ( output . controlMappingSources , context ) : undefined , controlSources : __expectString ( output . controlSources ) , createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , createdBy : __expectString ( output . createdBy ) , description : __expectString ( output . description ) , id : __expectString ( output . id ) , lastUpdatedAt : output . lastUpdatedAt !== undefined && output . lastUpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedAt ) ) ) : undefined , lastUpdatedBy : __expectString ( output . lastUpdatedBy ) , name : __expectString ( output . name ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , testingInformation : __expectString ( output . testingInformation ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1ControlComment = ( output , context ) : ControlComment => { return { authorName : __expectString ( output . authorName ) , commentBody : __expectString ( output . commentBody ) , postedDate : output . postedDate !== undefined && output . postedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . postedDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ControlComments = ( output , context ) : ControlComment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlComment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlDomainInsights = ( output , context ) : ControlDomainInsights => { return { controlsCountByNoncompliantEvidence : __expectInt32 ( output . controlsCountByNoncompliantEvidence ) , evidenceInsights : output . evidenceInsights !== undefined && output . evidenceInsights !== null ? deserializeAws_restJson1EvidenceInsights ( output . evidenceInsights , context ) : undefined , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , name : __expectString ( output . name ) , totalControlsCount : __expectInt32 ( output . totalControlsCount ) , } as any ; } ; const deserializeAws_restJson1ControlDomainInsightsList = ( output , context ) : ControlDomainInsights [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlDomainInsights ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlInsightsMetadata = ( output , context ) : ControlInsightsMetadataItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlInsightsMetadataItem ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlInsightsMetadataByAssessment = ( output , context ) : ControlInsightsMetadataByAssessmentItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlInsightsMetadataByAssessmentItem ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlInsightsMetadataByAssessmentItem = ( output , context ) : ControlInsightsMetadataByAssessmentItem => { return { controlSetName : __expectString ( output . controlSetName ) , evidenceInsights : output . evidenceInsights !== undefined && output . evidenceInsights !== null ? deserializeAws_restJson1EvidenceInsights ( output . evidenceInsights , context ) : undefined , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ControlInsightsMetadataItem = ( output , context ) : ControlInsightsMetadataItem => { return { evidenceInsights : output . evidenceInsights !== undefined && output . evidenceInsights !== null ? deserializeAws_restJson1EvidenceInsights ( output . evidenceInsights , context ) : undefined , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ControlMappingSource = ( output , context ) : ControlMappingSource => { return { sourceDescription : __expectString ( output . sourceDescription ) , sourceFrequency : __expectString ( output . sourceFrequency ) , sourceId : __expectString ( output . sourceId ) , sourceKeyword : output . sourceKeyword !== undefined && output . sourceKeyword !== null ? deserializeAws_restJson1SourceKeyword ( output . sourceKeyword , context ) : undefined , sourceName : __expectString ( output . sourceName ) , sourceSetUpOption : __expectString ( output . sourceSetUpOption ) , sourceType : __expectString ( output . sourceType ) , troubleshootingText : __expectString ( output . troubleshootingText ) , } as any ; } ; const deserializeAws_restJson1ControlMappingSources = ( output , context ) : ControlMappingSource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlMappingSource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlMetadata = ( output , context ) : ControlMetadata => { return { arn : __expectString ( output . arn ) , controlSources : __expectString ( output . controlSources ) , createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , id : __expectString ( output . id ) , lastUpdatedAt : output . lastUpdatedAt !== undefined && output . lastUpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedAt ) ) ) : undefined , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ControlMetadataList = ( output , context ) : ControlMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Controls = ( output , context ) : Control [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Control ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ControlSet = ( output , context ) : ControlSet => { return { controls : output . controls !== undefined && output . controls !== null ? deserializeAws_restJson1Controls ( output . controls , context ) : undefined , id : __expectString ( output . id ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ControlSets = ( output , context ) : ControlSet [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ControlSet ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CreateDelegationRequest = ( output , context ) : CreateDelegationRequest => { return { comment : __expectString ( output . comment ) , controlSetId : __expectString ( output . controlSetId ) , roleArn : __expectString ( output . roleArn ) , roleType : __expectString ( output . roleType ) , } as any ; } ; const deserializeAws_restJson1Delegation = ( output , context ) : Delegation => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentName : __expectString ( output . assessmentName ) , comment : __expectString ( output . comment ) , controlSetId : __expectString ( output . controlSetId ) , createdBy : __expectString ( output . createdBy ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , id : __expectString ( output . id ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , roleArn : __expectString ( output . roleArn ) , roleType : __expectString ( output . roleType ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1DelegationMetadata = ( output , context ) : DelegationMetadata => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentName : __expectString ( output . assessmentName ) , controlSetName : __expectString ( output . controlSetName ) , creationTime : output . creationTime !== undefined && output . creationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTime ) ) ) : undefined , id : __expectString ( output . id ) , roleArn : __expectString ( output . roleArn ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1DelegationMetadataList = ( output , context ) : DelegationMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DelegationMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Delegations = ( output , context ) : Delegation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Delegation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Evidence = ( output , context ) : Evidence => { return { assessmentReportSelection : __expectString ( output . assessmentReportSelection ) , attributes : output . attributes !== undefined && output . attributes !== null ? deserializeAws_restJson1EvidenceAttributes ( output . attributes , context ) : undefined , awsAccountId : __expectString ( output . awsAccountId ) , awsOrganization : __expectString ( output . awsOrganization ) , complianceCheck : __expectString ( output . complianceCheck ) , dataSource : __expectString ( output . dataSource ) , eventName : __expectString ( output . eventName ) , eventSource : __expectString ( output . eventSource ) , evidenceAwsAccountId : __expectString ( output . evidenceAwsAccountId ) , evidenceByType : __expectString ( output . evidenceByType ) , evidenceFolderId : __expectString ( output . evidenceFolderId ) , iamId : __expectString ( output . iamId ) , id : __expectString ( output . id ) , resourcesIncluded : output . resourcesIncluded !== undefined && output . resourcesIncluded !== null ? deserializeAws_restJson1Resources ( output . resourcesIncluded , context ) : undefined , time : output . time !== undefined && output . time !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . time ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1EvidenceAttributes = ( 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_restJson1EvidenceIds = ( 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_restJson1EvidenceInsights = ( output , context ) : EvidenceInsights => { return { compliantEvidenceCount : __expectInt32 ( output . compliantEvidenceCount ) , inconclusiveEvidenceCount : __expectInt32 ( output . inconclusiveEvidenceCount ) , noncompliantEvidenceCount : __expectInt32 ( output . noncompliantEvidenceCount ) , } as any ; } ; const deserializeAws_restJson1EvidenceList = ( output , context ) : Evidence [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Evidence ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EvidenceSources = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1Framework = ( output , context ) : Framework => { return { arn : __expectString ( output . arn ) , complianceType : __expectString ( output . complianceType ) , controlSets : output . controlSets !== undefined && output . controlSets !== null ? deserializeAws_restJson1ControlSets ( output . controlSets , context ) : undefined , controlSources : __expectString ( output . controlSources ) , createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , createdBy : __expectString ( output . createdBy ) , description : __expectString ( output . description ) , id : __expectString ( output . id ) , lastUpdatedAt : output . lastUpdatedAt !== undefined && output . lastUpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdatedAt ) ) ) : undefined , lastUpdatedBy : __expectString ( output . lastUpdatedBy ) , logo : __expectString ( output . logo ) , name : __expectString ( output . name ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1FrameworkMetadata = ( output , context ) : FrameworkMetadata => { return { complianceType : __expectString ( output . complianceType ) , description : __expectString ( output . description ) , logo : __expectString ( output . logo ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1FrameworkMetadataList = ( output , context ) : AssessmentFrameworkMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentFrameworkMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Insights = ( output , context ) : Insights => { return { activeAssessmentsCount : __expectInt32 ( output . activeAssessmentsCount ) , assessmentControlsCountByNoncompliantEvidence : __expectInt32 ( output . assessmentControlsCountByNoncompliantEvidence ) , compliantEvidenceCount : __expectInt32 ( output . compliantEvidenceCount ) , inconclusiveEvidenceCount : __expectInt32 ( output . inconclusiveEvidenceCount ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , noncompliantEvidenceCount : __expectInt32 ( output . noncompliantEvidenceCount ) , totalAssessmentControlsCount : __expectInt32 ( output . totalAssessmentControlsCount ) , } as any ; } ; const deserializeAws_restJson1InsightsByAssessment = ( output , context ) : InsightsByAssessment => { return { assessmentControlsCountByNoncompliantEvidence : __expectInt32 ( output . assessmentControlsCountByNoncompliantEvidence ) , compliantEvidenceCount : __expectInt32 ( output . compliantEvidenceCount ) , inconclusiveEvidenceCount : __expectInt32 ( output . inconclusiveEvidenceCount ) , lastUpdated : output . lastUpdated !== undefined && output . lastUpdated !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastUpdated ) ) ) : undefined , noncompliantEvidenceCount : __expectInt32 ( output . noncompliantEvidenceCount ) , totalAssessmentControlsCount : __expectInt32 ( output . totalAssessmentControlsCount ) , } as any ; } ; const deserializeAws_restJson1Keywords = ( 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_restJson1ListAssessmentMetadata = ( output , context ) : AssessmentMetadataItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssessmentMetadataItem ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ManualEvidence = ( output , context ) : ManualEvidence => { return { s3ResourcePath : __expectString ( output . s3ResourcePath ) , } as any ; } ; const deserializeAws_restJson1Notification = ( output , context ) : Notification => { return { assessmentId : __expectString ( output . assessmentId ) , assessmentName : __expectString ( output . assessmentName ) , controlSetId : __expectString ( output . controlSetId ) , controlSetName : __expectString ( output . controlSetName ) , description : __expectString ( output . description ) , eventTime : output . eventTime !== undefined && output . eventTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . eventTime ) ) ) : undefined , id : __expectString ( output . id ) , source : __expectString ( output . source ) , } as any ; } ; const deserializeAws_restJson1Notifications = ( output , context ) : Notification [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Notification ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Resource = ( output , context ) : Resource => { return { arn : __expectString ( output . arn ) , value : __expectString ( output . value ) , } as any ; } ; const deserializeAws_restJson1Resources = ( 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_restJson1Role = ( output , context ) : Role => { return { roleArn : __expectString ( output . roleArn ) , roleType : __expectString ( output . roleType ) , } as any ; } ; const deserializeAws_restJson1Roles = ( output , context ) : Role [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Role ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Scope = ( output , context ) : Scope => { return { awsAccounts : output . awsAccounts !== undefined && output . awsAccounts !== null ? deserializeAws_restJson1AWSAccounts ( output . awsAccounts , context ) : undefined , awsServices : output . awsServices !== undefined && output . awsServices !== null ? deserializeAws_restJson1AWSServices ( output . awsServices , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ServiceMetadata = ( output , context ) : ServiceMetadata => { return { category : __expectString ( output . category ) , description : __expectString ( output . description ) , displayName : __expectString ( output . displayName ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ServiceMetadataList = ( output , context ) : ServiceMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ServiceMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Settings = ( output , context ) : Settings => { return { defaultAssessmentReportsDestination : output . defaultAssessmentReportsDestination !== undefined && output . defaultAssessmentReportsDestination !== null ? deserializeAws_restJson1AssessmentReportsDestination ( output . defaultAssessmentReportsDestination , context ) : undefined , defaultProcessOwners : output . defaultProcessOwners !== undefined && output . defaultProcessOwners !== null ? deserializeAws_restJson1Roles ( output . defaultProcessOwners , context ) : undefined , isAwsOrgEnabled : __expectBoolean ( output . isAwsOrgEnabled ) , kmsKey : __expectString ( output . kmsKey ) , snsTopic : __expectString ( output . snsTopic ) , } as any ; } ; const deserializeAws_restJson1SourceKeyword = ( output , context ) : SourceKeyword => { return { keywordInputType : __expectString ( output . keywordInputType ) , keywordValue : __expectString ( output . keywordValue ) , } as any ; } ; const deserializeAws_restJson1TagMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1URL = ( output , context ) : URL => { return { hyperlinkName : __expectString ( output . hyperlinkName ) , link : __expectString ( output . link ) , } as any ; } ; const deserializeAws_restJson1ValidationErrors = ( 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_restJson1ValidationExceptionField = ( output , context ) : ValidationExceptionField => { return { message : __expectString ( output . message ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionFieldList = ( output , context ) : ValidationExceptionField [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ValidationExceptionField ( entry , context ) ; } ) ; } ; const 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 "" ; } ;