import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AddTagsCommandInput , AddTagsCommandOutput } from "../commands/AddTagsCommand" ; import { CancelQueryCommandInput , CancelQueryCommandOutput } from "../commands/CancelQueryCommand" ; import { CreateEventDataStoreCommandInput , CreateEventDataStoreCommandOutput , } from "../commands/CreateEventDataStoreCommand" ; import { CreateTrailCommandInput , CreateTrailCommandOutput } from "../commands/CreateTrailCommand" ; import { DeleteEventDataStoreCommandInput , DeleteEventDataStoreCommandOutput , } from "../commands/DeleteEventDataStoreCommand" ; import { DeleteTrailCommandInput , DeleteTrailCommandOutput } from "../commands/DeleteTrailCommand" ; import { DescribeQueryCommandInput , DescribeQueryCommandOutput } from "../commands/DescribeQueryCommand" ; import { DescribeTrailsCommandInput , DescribeTrailsCommandOutput } from "../commands/DescribeTrailsCommand" ; import { GetEventDataStoreCommandInput , GetEventDataStoreCommandOutput } from "../commands/GetEventDataStoreCommand" ; import { GetEventSelectorsCommandInput , GetEventSelectorsCommandOutput } from "../commands/GetEventSelectorsCommand" ; import { GetInsightSelectorsCommandInput , GetInsightSelectorsCommandOutput , } from "../commands/GetInsightSelectorsCommand" ; import { GetQueryResultsCommandInput , GetQueryResultsCommandOutput } from "../commands/GetQueryResultsCommand" ; import { GetTrailCommandInput , GetTrailCommandOutput } from "../commands/GetTrailCommand" ; import { GetTrailStatusCommandInput , GetTrailStatusCommandOutput } from "../commands/GetTrailStatusCommand" ; import { ListEventDataStoresCommandInput , ListEventDataStoresCommandOutput , } from "../commands/ListEventDataStoresCommand" ; import { ListPublicKeysCommandInput , ListPublicKeysCommandOutput } from "../commands/ListPublicKeysCommand" ; import { ListQueriesCommandInput , ListQueriesCommandOutput } from "../commands/ListQueriesCommand" ; import { ListTagsCommandInput , ListTagsCommandOutput } from "../commands/ListTagsCommand" ; import { ListTrailsCommandInput , ListTrailsCommandOutput } from "../commands/ListTrailsCommand" ; import { LookupEventsCommandInput , LookupEventsCommandOutput } from "../commands/LookupEventsCommand" ; import { PutEventSelectorsCommandInput , PutEventSelectorsCommandOutput } from "../commands/PutEventSelectorsCommand" ; import { PutInsightSelectorsCommandInput , PutInsightSelectorsCommandOutput , } from "../commands/PutInsightSelectorsCommand" ; import { RemoveTagsCommandInput , RemoveTagsCommandOutput } from "../commands/RemoveTagsCommand" ; import { RestoreEventDataStoreCommandInput , RestoreEventDataStoreCommandOutput , } from "../commands/RestoreEventDataStoreCommand" ; import { StartLoggingCommandInput , StartLoggingCommandOutput } from "../commands/StartLoggingCommand" ; import { StartQueryCommandInput , StartQueryCommandOutput } from "../commands/StartQueryCommand" ; import { StopLoggingCommandInput , StopLoggingCommandOutput } from "../commands/StopLoggingCommand" ; import { UpdateEventDataStoreCommandInput , UpdateEventDataStoreCommandOutput , } from "../commands/UpdateEventDataStoreCommand" ; import { UpdateTrailCommandInput , UpdateTrailCommandOutput } from "../commands/UpdateTrailCommand" ; import { AddTagsRequest , AddTagsResponse , AdvancedEventSelector , AdvancedFieldSelector , CancelQueryRequest , CancelQueryResponse , CloudTrailAccessNotEnabledException , CloudTrailARNInvalidException , CloudTrailInvalidClientTokenIdException , CloudWatchLogsDeliveryUnavailableException , ConflictException , CreateEventDataStoreRequest , CreateEventDataStoreResponse , CreateTrailRequest , CreateTrailResponse , DataResource , DeleteEventDataStoreRequest , DeleteEventDataStoreResponse , DeleteTrailRequest , DeleteTrailResponse , DescribeQueryRequest , DescribeQueryResponse , DescribeTrailsRequest , DescribeTrailsResponse , Event , EventDataStore , EventDataStoreAlreadyExistsException , EventDataStoreARNInvalidException , EventDataStoreMaxLimitExceededException , EventDataStoreNotFoundException , EventDataStoreTerminationProtectedException , EventSelector , GetEventDataStoreRequest , GetEventDataStoreResponse , GetEventSelectorsRequest , GetEventSelectorsResponse , GetInsightSelectorsRequest , GetInsightSelectorsResponse , GetQueryResultsRequest , GetQueryResultsResponse , GetTrailRequest , GetTrailResponse , GetTrailStatusRequest , GetTrailStatusResponse , InactiveEventDataStoreException , InactiveQueryException , InsightNotEnabledException , InsightSelector , InsufficientDependencyServiceAccessPermissionException , InsufficientEncryptionPolicyException , InsufficientS3BucketPolicyException , InsufficientSnsTopicPolicyException , InvalidCloudWatchLogsLogGroupArnException , InvalidCloudWatchLogsRoleArnException , InvalidDateRangeException , InvalidEventCategoryException , InvalidEventDataStoreStatusException , InvalidEventSelectorsException , InvalidHomeRegionException , InvalidInsightSelectorsException , InvalidKmsKeyIdException , InvalidLookupAttributesException , InvalidMaxResultsException , InvalidNextTokenException , InvalidParameterCombinationException , InvalidParameterException , InvalidQueryStatementException , InvalidQueryStatusException , InvalidS3BucketNameException , InvalidS3PrefixException , InvalidSnsTopicNameException , InvalidTagParameterException , InvalidTimeRangeException , InvalidTokenException , InvalidTrailNameException , KmsException , KmsKeyDisabledException , KmsKeyNotFoundException , ListEventDataStoresRequest , ListEventDataStoresResponse , ListPublicKeysRequest , ListPublicKeysResponse , ListQueriesRequest , ListQueriesResponse , ListTagsRequest , ListTagsResponse , ListTrailsRequest , ListTrailsResponse , LookupAttribute , LookupEventsRequest , LookupEventsResponse , MaxConcurrentQueriesException , MaximumNumberOfTrailsExceededException , NotOrganizationMasterAccountException , OperationNotPermittedException , OrganizationNotInAllFeaturesModeException , OrganizationsNotInUseException , PublicKey , PutEventSelectorsRequest , PutEventSelectorsResponse , PutInsightSelectorsRequest , PutInsightSelectorsResponse , Query , QueryIdNotFoundException , QueryStatistics , QueryStatisticsForDescribeQuery , RemoveTagsRequest , RemoveTagsResponse , Resource , ResourceNotFoundException , ResourceTag , ResourceTypeNotSupportedException , RestoreEventDataStoreRequest , RestoreEventDataStoreResponse , S3BucketDoesNotExistException , StartLoggingRequest , StartLoggingResponse , StartQueryRequest , StartQueryResponse , StopLoggingRequest , StopLoggingResponse , Tag , TagsLimitExceededException , Trail , TrailAlreadyExistsException , TrailInfo , TrailNotFoundException , TrailNotProvidedException , UnsupportedOperationException , UpdateEventDataStoreRequest , UpdateEventDataStoreResponse , UpdateTrailRequest , UpdateTrailResponse , } from "../models/models_0" ; export const serializeAws_json1_1AddTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.AddTags" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AddTagsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CancelQueryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.CancelQuery" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CancelQueryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateEventDataStoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.CreateEventDataStore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateEventDataStoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateTrailCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.CreateTrail" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateTrailRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteEventDataStoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.DeleteEventDataStore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteEventDataStoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteTrailCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.DeleteTrail" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteTrailRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeQueryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.DescribeQuery" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeQueryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeTrailsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.DescribeTrails" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeTrailsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetEventDataStoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetEventDataStore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetEventDataStoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetEventSelectorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetEventSelectors" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetEventSelectorsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetInsightSelectorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetInsightSelectors" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetInsightSelectorsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetQueryResultsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetQueryResults" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetQueryResultsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetTrailCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetTrail" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetTrailRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetTrailStatusCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.GetTrailStatus" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetTrailStatusRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEventDataStoresCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.ListEventDataStores" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEventDataStoresRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListPublicKeysCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.ListPublicKeys" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListPublicKeysRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListQueriesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.ListQueries" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListQueriesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.ListTags" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTrailsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.ListTrails" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTrailsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1LookupEventsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.LookupEvents" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1LookupEventsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutEventSelectorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.PutEventSelectors" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutEventSelectorsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutInsightSelectorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.PutInsightSelectors" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutInsightSelectorsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RemoveTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.RemoveTags" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RemoveTagsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RestoreEventDataStoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.RestoreEventDataStore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RestoreEventDataStoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartLoggingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.StartLogging" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartLoggingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartQueryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.StartQuery" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartQueryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopLoggingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.StopLogging" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopLoggingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateEventDataStoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.UpdateEventDataStore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateEventDataStoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateTrailCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CloudTrail_20131101.UpdateTrail" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateTrailRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1AddTagsCommand = async ( output , context ) : Promise < AddTagsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AddTagsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1AddTagsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AddTagsCommandError = async ( output , context ) : Promise < AddTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailARNInvalidException" : case "com.amazonaws.cloudtrail#CloudTrailARNInvalidException" : response = { ... ( await deserializeAws_json1_1CloudTrailARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloudtrail#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.cloudtrail#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cloudtrail#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceTypeNotSupportedException" : case "com.amazonaws.cloudtrail#ResourceTypeNotSupportedException" : response = { ... ( await deserializeAws_json1_1ResourceTypeNotSupportedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TagsLimitExceededException" : case "com.amazonaws.cloudtrail#TagsLimitExceededException" : response = { ... ( await deserializeAws_json1_1TagsLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CancelQueryCommand = async ( output , context ) : Promise < CancelQueryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CancelQueryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CancelQueryResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CancelQueryCommandError = async ( output , context ) : Promise < CancelQueryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.cloudtrail#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveQueryException" : case "com.amazonaws.cloudtrail#InactiveQueryException" : response = { ... ( await deserializeAws_json1_1InactiveQueryExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "QueryIdNotFoundException" : case "com.amazonaws.cloudtrail#QueryIdNotFoundException" : response = { ... ( await deserializeAws_json1_1QueryIdNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateEventDataStoreCommand = async ( output , context ) : Promise < CreateEventDataStoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateEventDataStoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateEventDataStoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateEventDataStoreCommandError = async ( output , context ) : Promise < CreateEventDataStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailAccessNotEnabledException" : case "com.amazonaws.cloudtrail#CloudTrailAccessNotEnabledException" : response = { ... ( await deserializeAws_json1_1CloudTrailAccessNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloudtrail#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreAlreadyExistsException" : case "com.amazonaws.cloudtrail#EventDataStoreAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1EventDataStoreAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreMaxLimitExceededException" : case "com.amazonaws.cloudtrail#EventDataStoreMaxLimitExceededException" : response = { ... ( await deserializeAws_json1_1EventDataStoreMaxLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.cloudtrail#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationNotInAllFeaturesModeException" : case "com.amazonaws.cloudtrail#OrganizationNotInAllFeaturesModeException" : response = { ... ( await deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationsNotInUseException" : case "com.amazonaws.cloudtrail#OrganizationsNotInUseException" : response = { ... ( await deserializeAws_json1_1OrganizationsNotInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateTrailCommand = async ( output , context ) : Promise < CreateTrailCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateTrailCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateTrailResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateTrailCommandError = async ( output , context ) : Promise < CreateTrailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailAccessNotEnabledException" : case "com.amazonaws.cloudtrail#CloudTrailAccessNotEnabledException" : response = { ... ( await deserializeAws_json1_1CloudTrailAccessNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CloudTrailInvalidClientTokenIdException" : case "com.amazonaws.cloudtrail#CloudTrailInvalidClientTokenIdException" : response = { ... ( await deserializeAws_json1_1CloudTrailInvalidClientTokenIdExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CloudWatchLogsDeliveryUnavailableException" : case "com.amazonaws.cloudtrail#CloudWatchLogsDeliveryUnavailableException" : response = { ... ( await deserializeAws_json1_1CloudWatchLogsDeliveryUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloudtrail#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientEncryptionPolicyException" : case "com.amazonaws.cloudtrail#InsufficientEncryptionPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientEncryptionPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientS3BucketPolicyException" : case "com.amazonaws.cloudtrail#InsufficientS3BucketPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientS3BucketPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientSnsTopicPolicyException" : case "com.amazonaws.cloudtrail#InsufficientSnsTopicPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientSnsTopicPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidCloudWatchLogsLogGroupArnException" : case "com.amazonaws.cloudtrail#InvalidCloudWatchLogsLogGroupArnException" : response = { ... ( await deserializeAws_json1_1InvalidCloudWatchLogsLogGroupArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidCloudWatchLogsRoleArnException" : case "com.amazonaws.cloudtrail#InvalidCloudWatchLogsRoleArnException" : response = { ... ( await deserializeAws_json1_1InvalidCloudWatchLogsRoleArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidKmsKeyIdException" : case "com.amazonaws.cloudtrail#InvalidKmsKeyIdException" : response = { ... ( await deserializeAws_json1_1InvalidKmsKeyIdExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterCombinationException" : case "com.amazonaws.cloudtrail#InvalidParameterCombinationException" : response = { ... ( await deserializeAws_json1_1InvalidParameterCombinationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidS3BucketNameException" : case "com.amazonaws.cloudtrail#InvalidS3BucketNameException" : response = { ... ( await deserializeAws_json1_1InvalidS3BucketNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidS3PrefixException" : case "com.amazonaws.cloudtrail#InvalidS3PrefixException" : response = { ... ( await deserializeAws_json1_1InvalidS3PrefixExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidSnsTopicNameException" : case "com.amazonaws.cloudtrail#InvalidSnsTopicNameException" : response = { ... ( await deserializeAws_json1_1InvalidSnsTopicNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.cloudtrail#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsException" : case "com.amazonaws.cloudtrail#KmsException" : response = { ... ( await deserializeAws_json1_1KmsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyDisabledException" : case "com.amazonaws.cloudtrail#KmsKeyDisabledException" : response = { ... ( await deserializeAws_json1_1KmsKeyDisabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyNotFoundException" : case "com.amazonaws.cloudtrail#KmsKeyNotFoundException" : response = { ... ( await deserializeAws_json1_1KmsKeyNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MaximumNumberOfTrailsExceededException" : case "com.amazonaws.cloudtrail#MaximumNumberOfTrailsExceededException" : response = { ... ( await deserializeAws_json1_1MaximumNumberOfTrailsExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationNotInAllFeaturesModeException" : case "com.amazonaws.cloudtrail#OrganizationNotInAllFeaturesModeException" : response = { ... ( await deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationsNotInUseException" : case "com.amazonaws.cloudtrail#OrganizationsNotInUseException" : response = { ... ( await deserializeAws_json1_1OrganizationsNotInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "S3BucketDoesNotExistException" : case "com.amazonaws.cloudtrail#S3BucketDoesNotExistException" : response = { ... ( await deserializeAws_json1_1S3BucketDoesNotExistExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailAlreadyExistsException" : case "com.amazonaws.cloudtrail#TrailAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1TrailAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotProvidedException" : case "com.amazonaws.cloudtrail#TrailNotProvidedException" : response = { ... ( await deserializeAws_json1_1TrailNotProvidedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteEventDataStoreCommand = async ( output , context ) : Promise < DeleteEventDataStoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteEventDataStoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteEventDataStoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteEventDataStoreCommandError = async ( output , context ) : Promise < DeleteEventDataStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreTerminationProtectedException" : case "com.amazonaws.cloudtrail#EventDataStoreTerminationProtectedException" : response = { ... ( await deserializeAws_json1_1EventDataStoreTerminationProtectedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteTrailCommand = async ( output , context ) : Promise < DeleteTrailCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteTrailCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteTrailResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteTrailCommandError = async ( output , context ) : Promise < DeleteTrailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.cloudtrail#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeQueryCommand = async ( output , context ) : Promise < DescribeQueryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeQueryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeQueryResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeQueryCommandError = async ( output , context ) : Promise < DescribeQueryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "QueryIdNotFoundException" : case "com.amazonaws.cloudtrail#QueryIdNotFoundException" : response = { ... ( await deserializeAws_json1_1QueryIdNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeTrailsCommand = async ( output , context ) : Promise < DescribeTrailsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeTrailsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeTrailsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeTrailsCommandError = async ( output , context ) : Promise < DescribeTrailsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetEventDataStoreCommand = async ( output , context ) : Promise < GetEventDataStoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetEventDataStoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetEventDataStoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetEventDataStoreCommandError = async ( output , context ) : Promise < GetEventDataStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetEventSelectorsCommand = async ( output , context ) : Promise < GetEventSelectorsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetEventSelectorsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetEventSelectorsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetEventSelectorsCommandError = async ( output , context ) : Promise < GetEventSelectorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetInsightSelectorsCommand = async ( output , context ) : Promise < GetInsightSelectorsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetInsightSelectorsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetInsightSelectorsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetInsightSelectorsCommandError = async ( output , context ) : Promise < GetInsightSelectorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InsightNotEnabledException" : case "com.amazonaws.cloudtrail#InsightNotEnabledException" : response = { ... ( await deserializeAws_json1_1InsightNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetQueryResultsCommand = async ( output , context ) : Promise < GetQueryResultsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetQueryResultsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetQueryResultsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetQueryResultsCommandError = async ( output , context ) : Promise < GetQueryResultsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidMaxResultsException" : case "com.amazonaws.cloudtrail#InvalidMaxResultsException" : response = { ... ( await deserializeAws_json1_1InvalidMaxResultsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidNextTokenException" : case "com.amazonaws.cloudtrail#InvalidNextTokenException" : response = { ... ( await deserializeAws_json1_1InvalidNextTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "QueryIdNotFoundException" : case "com.amazonaws.cloudtrail#QueryIdNotFoundException" : response = { ... ( await deserializeAws_json1_1QueryIdNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetTrailCommand = async ( output , context ) : Promise < GetTrailCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetTrailCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetTrailResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetTrailCommandError = async ( output , context ) : Promise < GetTrailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetTrailStatusCommand = async ( output , context ) : Promise < GetTrailStatusCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetTrailStatusCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetTrailStatusResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetTrailStatusCommandError = async ( output , context ) : Promise < GetTrailStatusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListEventDataStoresCommand = async ( output , context ) : Promise < ListEventDataStoresCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEventDataStoresCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEventDataStoresResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEventDataStoresCommandError = async ( output , context ) : Promise < ListEventDataStoresCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidMaxResultsException" : case "com.amazonaws.cloudtrail#InvalidMaxResultsException" : response = { ... ( await deserializeAws_json1_1InvalidMaxResultsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidNextTokenException" : case "com.amazonaws.cloudtrail#InvalidNextTokenException" : response = { ... ( await deserializeAws_json1_1InvalidNextTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListPublicKeysCommand = async ( output , context ) : Promise < ListPublicKeysCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListPublicKeysCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListPublicKeysResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListPublicKeysCommandError = async ( output , context ) : Promise < ListPublicKeysCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidTimeRangeException" : case "com.amazonaws.cloudtrail#InvalidTimeRangeException" : response = { ... ( await deserializeAws_json1_1InvalidTimeRangeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTokenException" : case "com.amazonaws.cloudtrail#InvalidTokenException" : response = { ... ( await deserializeAws_json1_1InvalidTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListQueriesCommand = async ( output , context ) : Promise < ListQueriesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListQueriesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListQueriesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListQueriesCommandError = async ( output , context ) : Promise < ListQueriesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidDateRangeException" : case "com.amazonaws.cloudtrail#InvalidDateRangeException" : response = { ... ( await deserializeAws_json1_1InvalidDateRangeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidMaxResultsException" : case "com.amazonaws.cloudtrail#InvalidMaxResultsException" : response = { ... ( await deserializeAws_json1_1InvalidMaxResultsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidNextTokenException" : case "com.amazonaws.cloudtrail#InvalidNextTokenException" : response = { ... ( await deserializeAws_json1_1InvalidNextTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidQueryStatusException" : case "com.amazonaws.cloudtrail#InvalidQueryStatusException" : response = { ... ( await deserializeAws_json1_1InvalidQueryStatusExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListTagsCommand = async ( output , context ) : Promise < ListTagsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsCommandError = async ( output , context ) : Promise < ListTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailARNInvalidException" : case "com.amazonaws.cloudtrail#CloudTrailARNInvalidException" : response = { ... ( await deserializeAws_json1_1CloudTrailARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTokenException" : case "com.amazonaws.cloudtrail#InvalidTokenException" : response = { ... ( await deserializeAws_json1_1InvalidTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cloudtrail#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceTypeNotSupportedException" : case "com.amazonaws.cloudtrail#ResourceTypeNotSupportedException" : response = { ... ( await deserializeAws_json1_1ResourceTypeNotSupportedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListTrailsCommand = async ( output , context ) : Promise < ListTrailsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTrailsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTrailsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTrailsCommandError = async ( output , context ) : Promise < ListTrailsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1LookupEventsCommand = async ( output , context ) : Promise < LookupEventsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1LookupEventsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1LookupEventsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1LookupEventsCommandError = async ( output , context ) : Promise < LookupEventsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidEventCategoryException" : case "com.amazonaws.cloudtrail#InvalidEventCategoryException" : response = { ... ( await deserializeAws_json1_1InvalidEventCategoryExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidLookupAttributesException" : case "com.amazonaws.cloudtrail#InvalidLookupAttributesException" : response = { ... ( await deserializeAws_json1_1InvalidLookupAttributesExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidMaxResultsException" : case "com.amazonaws.cloudtrail#InvalidMaxResultsException" : response = { ... ( await deserializeAws_json1_1InvalidMaxResultsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidNextTokenException" : case "com.amazonaws.cloudtrail#InvalidNextTokenException" : response = { ... ( await deserializeAws_json1_1InvalidNextTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTimeRangeException" : case "com.amazonaws.cloudtrail#InvalidTimeRangeException" : response = { ... ( await deserializeAws_json1_1InvalidTimeRangeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1PutEventSelectorsCommand = async ( output , context ) : Promise < PutEventSelectorsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutEventSelectorsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1PutEventSelectorsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutEventSelectorsCommandError = async ( output , context ) : Promise < PutEventSelectorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEventSelectorsException" : case "com.amazonaws.cloudtrail#InvalidEventSelectorsException" : response = { ... ( await deserializeAws_json1_1InvalidEventSelectorsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1PutInsightSelectorsCommand = async ( output , context ) : Promise < PutInsightSelectorsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutInsightSelectorsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1PutInsightSelectorsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutInsightSelectorsCommandError = async ( output , context ) : Promise < PutInsightSelectorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InsufficientEncryptionPolicyException" : case "com.amazonaws.cloudtrail#InsufficientEncryptionPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientEncryptionPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientS3BucketPolicyException" : case "com.amazonaws.cloudtrail#InsufficientS3BucketPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientS3BucketPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidInsightSelectorsException" : case "com.amazonaws.cloudtrail#InvalidInsightSelectorsException" : response = { ... ( await deserializeAws_json1_1InvalidInsightSelectorsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsException" : case "com.amazonaws.cloudtrail#KmsException" : response = { ... ( await deserializeAws_json1_1KmsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "S3BucketDoesNotExistException" : case "com.amazonaws.cloudtrail#S3BucketDoesNotExistException" : response = { ... ( await deserializeAws_json1_1S3BucketDoesNotExistExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RemoveTagsCommand = async ( output , context ) : Promise < RemoveTagsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RemoveTagsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RemoveTagsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RemoveTagsCommandError = async ( output , context ) : Promise < RemoveTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailARNInvalidException" : case "com.amazonaws.cloudtrail#CloudTrailARNInvalidException" : response = { ... ( await deserializeAws_json1_1CloudTrailARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.cloudtrail#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cloudtrail#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceTypeNotSupportedException" : case "com.amazonaws.cloudtrail#ResourceTypeNotSupportedException" : response = { ... ( await deserializeAws_json1_1ResourceTypeNotSupportedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RestoreEventDataStoreCommand = async ( output , context ) : Promise < RestoreEventDataStoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RestoreEventDataStoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RestoreEventDataStoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RestoreEventDataStoreCommandError = async ( output , context ) : Promise < RestoreEventDataStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailAccessNotEnabledException" : case "com.amazonaws.cloudtrail#CloudTrailAccessNotEnabledException" : response = { ... ( await deserializeAws_json1_1CloudTrailAccessNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreMaxLimitExceededException" : case "com.amazonaws.cloudtrail#EventDataStoreMaxLimitExceededException" : response = { ... ( await deserializeAws_json1_1EventDataStoreMaxLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEventDataStoreStatusException" : case "com.amazonaws.cloudtrail#InvalidEventDataStoreStatusException" : response = { ... ( await deserializeAws_json1_1InvalidEventDataStoreStatusExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationNotInAllFeaturesModeException" : case "com.amazonaws.cloudtrail#OrganizationNotInAllFeaturesModeException" : response = { ... ( await deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationsNotInUseException" : case "com.amazonaws.cloudtrail#OrganizationsNotInUseException" : response = { ... ( await deserializeAws_json1_1OrganizationsNotInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartLoggingCommand = async ( output , context ) : Promise < StartLoggingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartLoggingCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartLoggingResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartLoggingCommandError = async ( output , context ) : Promise < StartLoggingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartQueryCommand = async ( output , context ) : Promise < StartQueryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartQueryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartQueryResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartQueryCommandError = async ( output , context ) : Promise < StartQueryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidQueryStatementException" : case "com.amazonaws.cloudtrail#InvalidQueryStatementException" : response = { ... ( await deserializeAws_json1_1InvalidQueryStatementExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MaxConcurrentQueriesException" : case "com.amazonaws.cloudtrail#MaxConcurrentQueriesException" : response = { ... ( await deserializeAws_json1_1MaxConcurrentQueriesExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopLoggingCommand = async ( output , context ) : Promise < StopLoggingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopLoggingCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopLoggingResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopLoggingCommandError = async ( output , context ) : Promise < StopLoggingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateEventDataStoreCommand = async ( output , context ) : Promise < UpdateEventDataStoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateEventDataStoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateEventDataStoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateEventDataStoreCommandError = async ( output , context ) : Promise < UpdateEventDataStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailAccessNotEnabledException" : case "com.amazonaws.cloudtrail#CloudTrailAccessNotEnabledException" : response = { ... ( await deserializeAws_json1_1CloudTrailAccessNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreARNInvalidException" : case "com.amazonaws.cloudtrail#EventDataStoreARNInvalidException" : response = { ... ( await deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "EventDataStoreNotFoundException" : case "com.amazonaws.cloudtrail#EventDataStoreNotFoundException" : response = { ... ( await deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InactiveEventDataStoreException" : case "com.amazonaws.cloudtrail#InactiveEventDataStoreException" : response = { ... ( await deserializeAws_json1_1InactiveEventDataStoreExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cloudtrail#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationNotInAllFeaturesModeException" : case "com.amazonaws.cloudtrail#OrganizationNotInAllFeaturesModeException" : response = { ... ( await deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationsNotInUseException" : case "com.amazonaws.cloudtrail#OrganizationsNotInUseException" : response = { ... ( await deserializeAws_json1_1OrganizationsNotInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateTrailCommand = async ( output , context ) : Promise < UpdateTrailCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateTrailCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateTrailResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateTrailCommandError = async ( output , context ) : Promise < UpdateTrailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "CloudTrailAccessNotEnabledException" : case "com.amazonaws.cloudtrail#CloudTrailAccessNotEnabledException" : response = { ... ( await deserializeAws_json1_1CloudTrailAccessNotEnabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CloudTrailInvalidClientTokenIdException" : case "com.amazonaws.cloudtrail#CloudTrailInvalidClientTokenIdException" : response = { ... ( await deserializeAws_json1_1CloudTrailInvalidClientTokenIdExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "CloudWatchLogsDeliveryUnavailableException" : case "com.amazonaws.cloudtrail#CloudWatchLogsDeliveryUnavailableException" : response = { ... ( await deserializeAws_json1_1CloudWatchLogsDeliveryUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientDependencyServiceAccessPermissionException" : case "com.amazonaws.cloudtrail#InsufficientDependencyServiceAccessPermissionException" : response = { ... ( await deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientEncryptionPolicyException" : case "com.amazonaws.cloudtrail#InsufficientEncryptionPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientEncryptionPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientS3BucketPolicyException" : case "com.amazonaws.cloudtrail#InsufficientS3BucketPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientS3BucketPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientSnsTopicPolicyException" : case "com.amazonaws.cloudtrail#InsufficientSnsTopicPolicyException" : response = { ... ( await deserializeAws_json1_1InsufficientSnsTopicPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidCloudWatchLogsLogGroupArnException" : case "com.amazonaws.cloudtrail#InvalidCloudWatchLogsLogGroupArnException" : response = { ... ( await deserializeAws_json1_1InvalidCloudWatchLogsLogGroupArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidCloudWatchLogsRoleArnException" : case "com.amazonaws.cloudtrail#InvalidCloudWatchLogsRoleArnException" : response = { ... ( await deserializeAws_json1_1InvalidCloudWatchLogsRoleArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEventSelectorsException" : case "com.amazonaws.cloudtrail#InvalidEventSelectorsException" : response = { ... ( await deserializeAws_json1_1InvalidEventSelectorsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidHomeRegionException" : case "com.amazonaws.cloudtrail#InvalidHomeRegionException" : response = { ... ( await deserializeAws_json1_1InvalidHomeRegionExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidKmsKeyIdException" : case "com.amazonaws.cloudtrail#InvalidKmsKeyIdException" : response = { ... ( await deserializeAws_json1_1InvalidKmsKeyIdExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterCombinationException" : case "com.amazonaws.cloudtrail#InvalidParameterCombinationException" : response = { ... ( await deserializeAws_json1_1InvalidParameterCombinationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidS3BucketNameException" : case "com.amazonaws.cloudtrail#InvalidS3BucketNameException" : response = { ... ( await deserializeAws_json1_1InvalidS3BucketNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidS3PrefixException" : case "com.amazonaws.cloudtrail#InvalidS3PrefixException" : response = { ... ( await deserializeAws_json1_1InvalidS3PrefixExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidSnsTopicNameException" : case "com.amazonaws.cloudtrail#InvalidSnsTopicNameException" : response = { ... ( await deserializeAws_json1_1InvalidSnsTopicNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTrailNameException" : case "com.amazonaws.cloudtrail#InvalidTrailNameException" : response = { ... ( await deserializeAws_json1_1InvalidTrailNameExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsException" : case "com.amazonaws.cloudtrail#KmsException" : response = { ... ( await deserializeAws_json1_1KmsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyDisabledException" : case "com.amazonaws.cloudtrail#KmsKeyDisabledException" : response = { ... ( await deserializeAws_json1_1KmsKeyDisabledExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyNotFoundException" : case "com.amazonaws.cloudtrail#KmsKeyNotFoundException" : response = { ... ( await deserializeAws_json1_1KmsKeyNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotOrganizationMasterAccountException" : case "com.amazonaws.cloudtrail#NotOrganizationMasterAccountException" : response = { ... ( await deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OperationNotPermittedException" : case "com.amazonaws.cloudtrail#OperationNotPermittedException" : response = { ... ( await deserializeAws_json1_1OperationNotPermittedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationNotInAllFeaturesModeException" : case "com.amazonaws.cloudtrail#OrganizationNotInAllFeaturesModeException" : response = { ... ( await deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "OrganizationsNotInUseException" : case "com.amazonaws.cloudtrail#OrganizationsNotInUseException" : response = { ... ( await deserializeAws_json1_1OrganizationsNotInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "S3BucketDoesNotExistException" : case "com.amazonaws.cloudtrail#S3BucketDoesNotExistException" : response = { ... ( await deserializeAws_json1_1S3BucketDoesNotExistExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotFoundException" : case "com.amazonaws.cloudtrail#TrailNotFoundException" : response = { ... ( await deserializeAws_json1_1TrailNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TrailNotProvidedException" : case "com.amazonaws.cloudtrail#TrailNotProvidedException" : response = { ... ( await deserializeAws_json1_1TrailNotProvidedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedOperationException" : case "com.amazonaws.cloudtrail#UnsupportedOperationException" : response = { ... ( await deserializeAws_json1_1UnsupportedOperationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } 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_json1_1CloudTrailAccessNotEnabledExceptionResponse = async ( parsedOutput , context ) : Promise < CloudTrailAccessNotEnabledException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1CloudTrailAccessNotEnabledException ( body , context ) ; const contents = { name : "CloudTrailAccessNotEnabledException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1CloudTrailARNInvalidExceptionResponse = async ( parsedOutput , context ) : Promise < CloudTrailARNInvalidException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1CloudTrailARNInvalidException ( body , context ) ; const contents = { name : "CloudTrailARNInvalidException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1CloudTrailInvalidClientTokenIdExceptionResponse = async ( parsedOutput , context ) : Promise < CloudTrailInvalidClientTokenIdException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1CloudTrailInvalidClientTokenIdException ( body , context ) ; const contents = { name : "CloudTrailInvalidClientTokenIdException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1CloudWatchLogsDeliveryUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < CloudWatchLogsDeliveryUnavailableException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1CloudWatchLogsDeliveryUnavailableException ( body , context ) ; const contents = { name : "CloudWatchLogsDeliveryUnavailableException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConflictException ( body , context ) ; const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1EventDataStoreAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < EventDataStoreAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EventDataStoreAlreadyExistsException ( body , context ) ; const contents = { name : "EventDataStoreAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1EventDataStoreARNInvalidExceptionResponse = async ( parsedOutput , context ) : Promise < EventDataStoreARNInvalidException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EventDataStoreARNInvalidException ( body , context ) ; const contents = { name : "EventDataStoreARNInvalidException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1EventDataStoreMaxLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < EventDataStoreMaxLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EventDataStoreMaxLimitExceededException ( body , context ) ; const contents = { name : "EventDataStoreMaxLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1EventDataStoreNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < EventDataStoreNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EventDataStoreNotFoundException ( body , context ) ; const contents = { name : "EventDataStoreNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1EventDataStoreTerminationProtectedExceptionResponse = async ( parsedOutput , context ) : Promise < EventDataStoreTerminationProtectedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EventDataStoreTerminationProtectedException ( body , context ) ; const contents = { name : "EventDataStoreTerminationProtectedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InactiveEventDataStoreExceptionResponse = async ( parsedOutput , context ) : Promise < InactiveEventDataStoreException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InactiveEventDataStoreException ( body , context ) ; const contents = { name : "InactiveEventDataStoreException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InactiveQueryExceptionResponse = async ( parsedOutput , context ) : Promise < InactiveQueryException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InactiveQueryException ( body , context ) ; const contents = { name : "InactiveQueryException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InsightNotEnabledExceptionResponse = async ( parsedOutput , context ) : Promise < InsightNotEnabledException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InsightNotEnabledException ( body , context ) ; const contents = { name : "InsightNotEnabledException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionExceptionResponse = async ( parsedOutput , context ) : Promise < InsufficientDependencyServiceAccessPermissionException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionException ( body , context ) ; const contents = { name : "InsufficientDependencyServiceAccessPermissionException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InsufficientEncryptionPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < InsufficientEncryptionPolicyException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InsufficientEncryptionPolicyException ( body , context ) ; const contents = { name : "InsufficientEncryptionPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InsufficientS3BucketPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < InsufficientS3BucketPolicyException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InsufficientS3BucketPolicyException ( body , context ) ; const contents = { name : "InsufficientS3BucketPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InsufficientSnsTopicPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < InsufficientSnsTopicPolicyException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InsufficientSnsTopicPolicyException ( body , context ) ; const contents = { name : "InsufficientSnsTopicPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidCloudWatchLogsLogGroupArnExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidCloudWatchLogsLogGroupArnException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidCloudWatchLogsLogGroupArnException ( body , context ) ; const contents = { name : "InvalidCloudWatchLogsLogGroupArnException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidCloudWatchLogsRoleArnExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidCloudWatchLogsRoleArnException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidCloudWatchLogsRoleArnException ( body , context ) ; const contents = { name : "InvalidCloudWatchLogsRoleArnException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidDateRangeExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidDateRangeException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidDateRangeException ( body , context ) ; const contents = { name : "InvalidDateRangeException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidEventCategoryExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidEventCategoryException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidEventCategoryException ( body , context ) ; const contents = { name : "InvalidEventCategoryException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidEventDataStoreStatusExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidEventDataStoreStatusException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidEventDataStoreStatusException ( body , context ) ; const contents = { name : "InvalidEventDataStoreStatusException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidEventSelectorsExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidEventSelectorsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidEventSelectorsException ( body , context ) ; const contents = { name : "InvalidEventSelectorsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidHomeRegionExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidHomeRegionException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidHomeRegionException ( body , context ) ; const contents = { name : "InvalidHomeRegionException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidInsightSelectorsExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidInsightSelectorsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidInsightSelectorsException ( body , context ) ; const contents = { name : "InvalidInsightSelectorsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidKmsKeyIdExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidKmsKeyIdException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidKmsKeyIdException ( body , context ) ; const contents = { name : "InvalidKmsKeyIdException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidLookupAttributesExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidLookupAttributesException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidLookupAttributesException ( body , context ) ; const contents = { name : "InvalidLookupAttributesException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidMaxResultsExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidMaxResultsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidMaxResultsException ( body , context ) ; const contents = { name : "InvalidMaxResultsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidNextTokenExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidNextTokenException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidNextTokenException ( body , context ) ; const contents = { name : "InvalidNextTokenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidParameterCombinationExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterCombinationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidParameterCombinationException ( body , context ) ; const contents = { name : "InvalidParameterCombinationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidParameterException ( body , context ) ; const contents = { name : "InvalidParameterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidQueryStatementExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidQueryStatementException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidQueryStatementException ( body , context ) ; const contents = { name : "InvalidQueryStatementException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidQueryStatusExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidQueryStatusException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidQueryStatusException ( body , context ) ; const contents = { name : "InvalidQueryStatusException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidS3BucketNameExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidS3BucketNameException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidS3BucketNameException ( body , context ) ; const contents = { name : "InvalidS3BucketNameException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidS3PrefixExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidS3PrefixException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidS3PrefixException ( body , context ) ; const contents = { name : "InvalidS3PrefixException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidSnsTopicNameExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidSnsTopicNameException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidSnsTopicNameException ( body , context ) ; const contents = { name : "InvalidSnsTopicNameException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTagParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTagParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTagParameterException ( body , context ) ; const contents = { name : "InvalidTagParameterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTimeRangeExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTimeRangeException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTimeRangeException ( body , context ) ; const contents = { name : "InvalidTimeRangeException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTokenExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTokenException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTokenException ( body , context ) ; const contents = { name : "InvalidTokenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTrailNameExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTrailNameException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTrailNameException ( body , context ) ; const contents = { name : "InvalidTrailNameException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1KmsExceptionResponse = async ( parsedOutput , context ) : Promise < KmsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1KmsException ( body , context ) ; const contents = { name : "KmsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1KmsKeyDisabledExceptionResponse = async ( parsedOutput , context ) : Promise < KmsKeyDisabledException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1KmsKeyDisabledException ( body , context ) ; const contents = { name : "KmsKeyDisabledException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1KmsKeyNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < KmsKeyNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1KmsKeyNotFoundException ( body , context ) ; const contents = { name : "KmsKeyNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1MaxConcurrentQueriesExceptionResponse = async ( parsedOutput , context ) : Promise < MaxConcurrentQueriesException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1MaxConcurrentQueriesException ( body , context ) ; const contents = { name : "MaxConcurrentQueriesException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1MaximumNumberOfTrailsExceededExceptionResponse = async ( parsedOutput , context ) : Promise < MaximumNumberOfTrailsExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1MaximumNumberOfTrailsExceededException ( body , context ) ; const contents = { name : "MaximumNumberOfTrailsExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1NotOrganizationMasterAccountExceptionResponse = async ( parsedOutput , context ) : Promise < NotOrganizationMasterAccountException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1NotOrganizationMasterAccountException ( body , context ) ; const contents = { name : "NotOrganizationMasterAccountException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1OperationNotPermittedExceptionResponse = async ( parsedOutput , context ) : Promise < OperationNotPermittedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1OperationNotPermittedException ( body , context ) ; const contents = { name : "OperationNotPermittedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1OrganizationNotInAllFeaturesModeExceptionResponse = async ( parsedOutput , context ) : Promise < OrganizationNotInAllFeaturesModeException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1OrganizationNotInAllFeaturesModeException ( body , context ) ; const contents = { name : "OrganizationNotInAllFeaturesModeException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1OrganizationsNotInUseExceptionResponse = async ( parsedOutput , context ) : Promise < OrganizationsNotInUseException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1OrganizationsNotInUseException ( body , context ) ; const contents = { name : "OrganizationsNotInUseException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1QueryIdNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < QueryIdNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1QueryIdNotFoundException ( body , context ) ; const contents = { name : "QueryIdNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceNotFoundException ( body , context ) ; const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceTypeNotSupportedExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceTypeNotSupportedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceTypeNotSupportedException ( body , context ) ; const contents = { name : "ResourceTypeNotSupportedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1S3BucketDoesNotExistExceptionResponse = async ( parsedOutput , context ) : Promise < S3BucketDoesNotExistException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1S3BucketDoesNotExistException ( body , context ) ; const contents = { name : "S3BucketDoesNotExistException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TagsLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < TagsLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TagsLimitExceededException ( body , context ) ; const contents = { name : "TagsLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TrailAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < TrailAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TrailAlreadyExistsException ( body , context ) ; const contents = { name : "TrailAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TrailNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < TrailNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TrailNotFoundException ( body , context ) ; const contents = { name : "TrailNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TrailNotProvidedExceptionResponse = async ( parsedOutput , context ) : Promise < TrailNotProvidedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TrailNotProvidedException ( body , context ) ; const contents = { name : "TrailNotProvidedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1UnsupportedOperationExceptionResponse = async ( parsedOutput , context ) : Promise < UnsupportedOperationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1UnsupportedOperationException ( body , context ) ; const contents = { name : "UnsupportedOperationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1AddTagsRequest = ( input , context ) : any => { return { ... ( input . ResourceId !== undefined && input . ResourceId !== null && { ResourceId : input . ResourceId } ) , ... ( input . TagsList !== undefined && input . TagsList !== null && { TagsList : serializeAws_json1_1TagsList ( input . TagsList , context ) } ) , } ; } ; const serializeAws_json1_1AdvancedEventSelector = ( input , context ) : any => { return { ... ( input . FieldSelectors !== undefined && input . FieldSelectors !== null && { FieldSelectors : serializeAws_json1_1AdvancedFieldSelectors ( input . FieldSelectors , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1AdvancedEventSelectors = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1AdvancedEventSelector ( entry , context ) ; } ) ; } ; const serializeAws_json1_1AdvancedFieldSelector = ( input , context ) : any => { return { ... ( input . EndsWith !== undefined && input . EndsWith !== null && { EndsWith : serializeAws_json1_1Operator ( input . EndsWith , context ) } ) , ... ( input . Equals !== undefined && input . Equals !== null && { Equals : serializeAws_json1_1Operator ( input . Equals , context ) } ) , ... ( input . Field !== undefined && input . Field !== null && { Field : input . Field } ) , ... ( input . NotEndsWith !== undefined && input . NotEndsWith !== null && { NotEndsWith : serializeAws_json1_1Operator ( input . NotEndsWith , context ) } ) , ... ( input . NotEquals !== undefined && input . NotEquals !== null && { NotEquals : serializeAws_json1_1Operator ( input . NotEquals , context ) } ) , ... ( input . NotStartsWith !== undefined && input . NotStartsWith !== null && { NotStartsWith : serializeAws_json1_1Operator ( input . NotStartsWith , context ) } ) , ... ( input . StartsWith !== undefined && input . StartsWith !== null && { StartsWith : serializeAws_json1_1Operator ( input . StartsWith , context ) } ) , } ; } ; const serializeAws_json1_1AdvancedFieldSelectors = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1AdvancedFieldSelector ( entry , context ) ; } ) ; } ; const serializeAws_json1_1CancelQueryRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , ... ( input . QueryId !== undefined && input . QueryId !== null && { QueryId : input . QueryId } ) , } ; } ; const serializeAws_json1_1CreateEventDataStoreRequest = ( input , context ) : any => { return { ... ( input . AdvancedEventSelectors !== undefined && input . AdvancedEventSelectors !== null && { AdvancedEventSelectors : serializeAws_json1_1AdvancedEventSelectors ( input . AdvancedEventSelectors , context ) , } ) , ... ( input . MultiRegionEnabled !== undefined && input . MultiRegionEnabled !== null && { MultiRegionEnabled : input . MultiRegionEnabled } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . OrganizationEnabled !== undefined && input . OrganizationEnabled !== null && { OrganizationEnabled : input . OrganizationEnabled } ) , ... ( input . RetentionPeriod !== undefined && input . RetentionPeriod !== null && { RetentionPeriod : input . RetentionPeriod } ) , ... ( input . TagsList !== undefined && input . TagsList !== null && { TagsList : serializeAws_json1_1TagsList ( input . TagsList , context ) } ) , ... ( input . TerminationProtectionEnabled !== undefined && input . TerminationProtectionEnabled !== null && { TerminationProtectionEnabled : input . TerminationProtectionEnabled , } ) , } ; } ; const serializeAws_json1_1CreateTrailRequest = ( input , context ) : any => { return { ... ( input . CloudWatchLogsLogGroupArn !== undefined && input . CloudWatchLogsLogGroupArn !== null && { CloudWatchLogsLogGroupArn : input . CloudWatchLogsLogGroupArn } ) , ... ( input . CloudWatchLogsRoleArn !== undefined && input . CloudWatchLogsRoleArn !== null && { CloudWatchLogsRoleArn : input . CloudWatchLogsRoleArn } ) , ... ( input . EnableLogFileValidation !== undefined && input . EnableLogFileValidation !== null && { EnableLogFileValidation : input . EnableLogFileValidation } ) , ... ( input . IncludeGlobalServiceEvents !== undefined && input . IncludeGlobalServiceEvents !== null && { IncludeGlobalServiceEvents : input . IncludeGlobalServiceEvents } ) , ... ( input . IsMultiRegionTrail !== undefined && input . IsMultiRegionTrail !== null && { IsMultiRegionTrail : input . IsMultiRegionTrail } ) , ... ( input . IsOrganizationTrail !== undefined && input . IsOrganizationTrail !== null && { IsOrganizationTrail : input . IsOrganizationTrail } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . S3BucketName !== undefined && input . S3BucketName !== null && { S3BucketName : input . S3BucketName } ) , ... ( input . S3KeyPrefix !== undefined && input . S3KeyPrefix !== null && { S3KeyPrefix : input . S3KeyPrefix } ) , ... ( input . SnsTopicName !== undefined && input . SnsTopicName !== null && { SnsTopicName : input . SnsTopicName } ) , ... ( input . TagsList !== undefined && input . TagsList !== null && { TagsList : serializeAws_json1_1TagsList ( input . TagsList , context ) } ) , } ; } ; const serializeAws_json1_1DataResource = ( input , context ) : any => { return { ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . Values !== undefined && input . Values !== null && { Values : serializeAws_json1_1DataResourceValues ( input . Values , context ) } ) , } ; } ; const serializeAws_json1_1DataResources = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1DataResource ( entry , context ) ; } ) ; } ; const serializeAws_json1_1DataResourceValues = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1DeleteEventDataStoreRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , } ; } ; const serializeAws_json1_1DeleteTrailRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1DescribeQueryRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , ... ( input . QueryId !== undefined && input . QueryId !== null && { QueryId : input . QueryId } ) , } ; } ; const serializeAws_json1_1DescribeTrailsRequest = ( input , context ) : any => { return { ... ( input . includeShadowTrails !== undefined && input . includeShadowTrails !== null && { includeShadowTrails : input . includeShadowTrails } ) , ... ( input . trailNameList !== undefined && input . trailNameList !== null && { trailNameList : serializeAws_json1_1TrailNameList ( input . trailNameList , context ) , } ) , } ; } ; const serializeAws_json1_1EventSelector = ( input , context ) : any => { return { ... ( input . DataResources !== undefined && input . DataResources !== null && { DataResources : serializeAws_json1_1DataResources ( input . DataResources , context ) , } ) , ... ( input . ExcludeManagementEventSources !== undefined && input . ExcludeManagementEventSources !== null && { ExcludeManagementEventSources : serializeAws_json1_1ExcludeManagementEventSources ( input . ExcludeManagementEventSources , context ) , } ) , ... ( input . IncludeManagementEvents !== undefined && input . IncludeManagementEvents !== null && { IncludeManagementEvents : input . IncludeManagementEvents } ) , ... ( input . ReadWriteType !== undefined && input . ReadWriteType !== null && { ReadWriteType : input . ReadWriteType } ) , } ; } ; const serializeAws_json1_1EventSelectors = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1EventSelector ( entry , context ) ; } ) ; } ; const serializeAws_json1_1ExcludeManagementEventSources = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1GetEventDataStoreRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , } ; } ; const serializeAws_json1_1GetEventSelectorsRequest = ( input , context ) : any => { return { ... ( input . TrailName !== undefined && input . TrailName !== null && { TrailName : input . TrailName } ) , } ; } ; const serializeAws_json1_1GetInsightSelectorsRequest = ( input , context ) : any => { return { ... ( input . TrailName !== undefined && input . TrailName !== null && { TrailName : input . TrailName } ) , } ; } ; const serializeAws_json1_1GetQueryResultsRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , ... ( input . MaxQueryResults !== undefined && input . MaxQueryResults !== null && { MaxQueryResults : input . MaxQueryResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . QueryId !== undefined && input . QueryId !== null && { QueryId : input . QueryId } ) , } ; } ; const serializeAws_json1_1GetTrailRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1GetTrailStatusRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1InsightSelector = ( input , context ) : any => { return { ... ( input . InsightType !== undefined && input . InsightType !== null && { InsightType : input . InsightType } ) , } ; } ; const serializeAws_json1_1InsightSelectors = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1InsightSelector ( entry , context ) ; } ) ; } ; const serializeAws_json1_1ListEventDataStoresRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListPublicKeysRequest = ( input , context ) : any => { return { ... ( input . EndTime !== undefined && input . EndTime !== null && { EndTime : Math . round ( input . EndTime . getTime ( ) / 1000 ) } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { StartTime : Math . round ( input . StartTime . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1ListQueriesRequest = ( input , context ) : any => { return { ... ( input . EndTime !== undefined && input . EndTime !== null && { EndTime : Math . round ( input . EndTime . getTime ( ) / 1000 ) } ) , ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . QueryStatus !== undefined && input . QueryStatus !== null && { QueryStatus : input . QueryStatus } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { StartTime : Math . round ( input . StartTime . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1ListTagsRequest = ( input , context ) : any => { return { ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . ResourceIdList !== undefined && input . ResourceIdList !== null && { ResourceIdList : serializeAws_json1_1ResourceIdList ( input . ResourceIdList , context ) , } ) , } ; } ; const serializeAws_json1_1ListTrailsRequest = ( input , context ) : any => { return { ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1LookupAttribute = ( input , context ) : any => { return { ... ( input . AttributeKey !== undefined && input . AttributeKey !== null && { AttributeKey : input . AttributeKey } ) , ... ( input . AttributeValue !== undefined && input . AttributeValue !== null && { AttributeValue : input . AttributeValue } ) , } ; } ; const serializeAws_json1_1LookupAttributesList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1LookupAttribute ( entry , context ) ; } ) ; } ; const serializeAws_json1_1LookupEventsRequest = ( input , context ) : any => { return { ... ( input . EndTime !== undefined && input . EndTime !== null && { EndTime : Math . round ( input . EndTime . getTime ( ) / 1000 ) } ) , ... ( input . EventCategory !== undefined && input . EventCategory !== null && { EventCategory : input . EventCategory } ) , ... ( input . LookupAttributes !== undefined && input . LookupAttributes !== null && { LookupAttributes : serializeAws_json1_1LookupAttributesList ( input . LookupAttributes , context ) , } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { StartTime : Math . round ( input . StartTime . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1Operator = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1PutEventSelectorsRequest = ( input , context ) : any => { return { ... ( input . AdvancedEventSelectors !== undefined && input . AdvancedEventSelectors !== null && { AdvancedEventSelectors : serializeAws_json1_1AdvancedEventSelectors ( input . AdvancedEventSelectors , context ) , } ) , ... ( input . EventSelectors !== undefined && input . EventSelectors !== null && { EventSelectors : serializeAws_json1_1EventSelectors ( input . EventSelectors , context ) , } ) , ... ( input . TrailName !== undefined && input . TrailName !== null && { TrailName : input . TrailName } ) , } ; } ; const serializeAws_json1_1PutInsightSelectorsRequest = ( input , context ) : any => { return { ... ( input . InsightSelectors !== undefined && input . InsightSelectors !== null && { InsightSelectors : serializeAws_json1_1InsightSelectors ( input . InsightSelectors , context ) , } ) , ... ( input . TrailName !== undefined && input . TrailName !== null && { TrailName : input . TrailName } ) , } ; } ; const serializeAws_json1_1RemoveTagsRequest = ( input , context ) : any => { return { ... ( input . ResourceId !== undefined && input . ResourceId !== null && { ResourceId : input . ResourceId } ) , ... ( input . TagsList !== undefined && input . TagsList !== null && { TagsList : serializeAws_json1_1TagsList ( input . TagsList , context ) } ) , } ; } ; const serializeAws_json1_1ResourceIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1RestoreEventDataStoreRequest = ( input , context ) : any => { return { ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , } ; } ; const serializeAws_json1_1StartLoggingRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1StartQueryRequest = ( input , context ) : any => { return { ... ( input . QueryStatement !== undefined && input . QueryStatement !== null && { QueryStatement : input . QueryStatement } ) , } ; } ; const serializeAws_json1_1StopLoggingRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1TagsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const serializeAws_json1_1TrailNameList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1UpdateEventDataStoreRequest = ( input , context ) : any => { return { ... ( input . AdvancedEventSelectors !== undefined && input . AdvancedEventSelectors !== null && { AdvancedEventSelectors : serializeAws_json1_1AdvancedEventSelectors ( input . AdvancedEventSelectors , context ) , } ) , ... ( input . EventDataStore !== undefined && input . EventDataStore !== null && { EventDataStore : input . EventDataStore } ) , ... ( input . MultiRegionEnabled !== undefined && input . MultiRegionEnabled !== null && { MultiRegionEnabled : input . MultiRegionEnabled } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . OrganizationEnabled !== undefined && input . OrganizationEnabled !== null && { OrganizationEnabled : input . OrganizationEnabled } ) , ... ( input . RetentionPeriod !== undefined && input . RetentionPeriod !== null && { RetentionPeriod : input . RetentionPeriod } ) , ... ( input . TerminationProtectionEnabled !== undefined && input . TerminationProtectionEnabled !== null && { TerminationProtectionEnabled : input . TerminationProtectionEnabled , } ) , } ; } ; const serializeAws_json1_1UpdateTrailRequest = ( input , context ) : any => { return { ... ( input . CloudWatchLogsLogGroupArn !== undefined && input . CloudWatchLogsLogGroupArn !== null && { CloudWatchLogsLogGroupArn : input . CloudWatchLogsLogGroupArn } ) , ... ( input . CloudWatchLogsRoleArn !== undefined && input . CloudWatchLogsRoleArn !== null && { CloudWatchLogsRoleArn : input . CloudWatchLogsRoleArn } ) , ... ( input . EnableLogFileValidation !== undefined && input . EnableLogFileValidation !== null && { EnableLogFileValidation : input . EnableLogFileValidation } ) , ... ( input . IncludeGlobalServiceEvents !== undefined && input . IncludeGlobalServiceEvents !== null && { IncludeGlobalServiceEvents : input . IncludeGlobalServiceEvents } ) , ... ( input . IsMultiRegionTrail !== undefined && input . IsMultiRegionTrail !== null && { IsMultiRegionTrail : input . IsMultiRegionTrail } ) , ... ( input . IsOrganizationTrail !== undefined && input . IsOrganizationTrail !== null && { IsOrganizationTrail : input . IsOrganizationTrail } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . S3BucketName !== undefined && input . S3BucketName !== null && { S3BucketName : input . S3BucketName } ) , ... ( input . S3KeyPrefix !== undefined && input . S3KeyPrefix !== null && { S3KeyPrefix : input . S3KeyPrefix } ) , ... ( input . SnsTopicName !== undefined && input . SnsTopicName !== null && { SnsTopicName : input . SnsTopicName } ) , } ; } ; const deserializeAws_json1_1AddTagsResponse = ( output , context ) : AddTagsResponse => { return { } as any ; } ; const deserializeAws_json1_1AdvancedEventSelector = ( output , context ) : AdvancedEventSelector => { return { FieldSelectors : output . FieldSelectors !== undefined && output . FieldSelectors !== null ? deserializeAws_json1_1AdvancedFieldSelectors ( output . FieldSelectors , context ) : undefined , Name : __expectString ( output . Name ) , } as any ; } ; const deserializeAws_json1_1AdvancedEventSelectors = ( output , context ) : AdvancedEventSelector [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1AdvancedEventSelector ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1AdvancedFieldSelector = ( output , context ) : AdvancedFieldSelector => { return { EndsWith : output . EndsWith !== undefined && output . EndsWith !== null ? deserializeAws_json1_1Operator ( output . EndsWith , context ) : undefined , Equals : output . Equals !== undefined && output . Equals !== null ? deserializeAws_json1_1Operator ( output . Equals , context ) : undefined , Field : __expectString ( output . Field ) , NotEndsWith : output . NotEndsWith !== undefined && output . NotEndsWith !== null ? deserializeAws_json1_1Operator ( output . NotEndsWith , context ) : undefined , NotEquals : output . NotEquals !== undefined && output . NotEquals !== null ? deserializeAws_json1_1Operator ( output . NotEquals , context ) : undefined , NotStartsWith : output . NotStartsWith !== undefined && output . NotStartsWith !== null ? deserializeAws_json1_1Operator ( output . NotStartsWith , context ) : undefined , StartsWith : output . StartsWith !== undefined && output . StartsWith !== null ? deserializeAws_json1_1Operator ( output . StartsWith , context ) : undefined , } as any ; } ; const deserializeAws_json1_1AdvancedFieldSelectors = ( output , context ) : AdvancedFieldSelector [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1AdvancedFieldSelector ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1CancelQueryResponse = ( output , context ) : CancelQueryResponse => { return { QueryId : __expectString ( output . QueryId ) , QueryStatus : __expectString ( output . QueryStatus ) , } as any ; } ; const deserializeAws_json1_1CloudTrailAccessNotEnabledException = ( output , context ) : CloudTrailAccessNotEnabledException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1CloudTrailARNInvalidException = ( output , context ) : CloudTrailARNInvalidException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1CloudTrailInvalidClientTokenIdException = ( output , context ) : CloudTrailInvalidClientTokenIdException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1CloudWatchLogsDeliveryUnavailableException = ( output , context ) : CloudWatchLogsDeliveryUnavailableException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ConflictException = ( output , context ) : ConflictException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1CreateEventDataStoreResponse = ( output , context ) : CreateEventDataStoreResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , EventDataStoreArn : __expectString ( output . EventDataStoreArn ) , MultiRegionEnabled : __expectBoolean ( output . MultiRegionEnabled ) , Name : __expectString ( output . Name ) , OrganizationEnabled : __expectBoolean ( output . OrganizationEnabled ) , RetentionPeriod : __expectInt32 ( output . RetentionPeriod ) , Status : __expectString ( output . Status ) , TagsList : output . TagsList !== undefined && output . TagsList !== null ? deserializeAws_json1_1TagsList ( output . TagsList , context ) : undefined , TerminationProtectionEnabled : __expectBoolean ( output . TerminationProtectionEnabled ) , UpdatedTimestamp : output . UpdatedTimestamp !== undefined && output . UpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1CreateTrailResponse = ( output , context ) : CreateTrailResponse => { return { CloudWatchLogsLogGroupArn : __expectString ( output . CloudWatchLogsLogGroupArn ) , CloudWatchLogsRoleArn : __expectString ( output . CloudWatchLogsRoleArn ) , IncludeGlobalServiceEvents : __expectBoolean ( output . IncludeGlobalServiceEvents ) , IsMultiRegionTrail : __expectBoolean ( output . IsMultiRegionTrail ) , IsOrganizationTrail : __expectBoolean ( output . IsOrganizationTrail ) , KmsKeyId : __expectString ( output . KmsKeyId ) , LogFileValidationEnabled : __expectBoolean ( output . LogFileValidationEnabled ) , Name : __expectString ( output . Name ) , S3BucketName : __expectString ( output . S3BucketName ) , S3KeyPrefix : __expectString ( output . S3KeyPrefix ) , SnsTopicARN : __expectString ( output . SnsTopicARN ) , SnsTopicName : __expectString ( output . SnsTopicName ) , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1DataResource = ( output , context ) : DataResource => { return { Type : __expectString ( output . Type ) , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_json1_1DataResourceValues ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DataResources = ( output , context ) : DataResource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DataResource ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DataResourceValues = ( 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_json1_1DeleteEventDataStoreResponse = ( output , context ) : DeleteEventDataStoreResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteTrailResponse = ( output , context ) : DeleteTrailResponse => { return { } as any ; } ; const deserializeAws_json1_1DescribeQueryResponse = ( output , context ) : DescribeQueryResponse => { return { ErrorMessage : __expectString ( output . ErrorMessage ) , QueryId : __expectString ( output . QueryId ) , QueryStatistics : output . QueryStatistics !== undefined && output . QueryStatistics !== null ? deserializeAws_json1_1QueryStatisticsForDescribeQuery ( output . QueryStatistics , context ) : undefined , QueryStatus : __expectString ( output . QueryStatus ) , QueryString : __expectString ( output . QueryString ) , } as any ; } ; const deserializeAws_json1_1DescribeTrailsResponse = ( output , context ) : DescribeTrailsResponse => { return { trailList : output . trailList !== undefined && output . trailList !== null ? deserializeAws_json1_1TrailList ( output . trailList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1Event = ( output , context ) : Event => { return { AccessKeyId : __expectString ( output . AccessKeyId ) , CloudTrailEvent : __expectString ( output . CloudTrailEvent ) , EventId : __expectString ( output . EventId ) , EventName : __expectString ( output . EventName ) , EventSource : __expectString ( output . EventSource ) , EventTime : output . EventTime !== undefined && output . EventTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EventTime ) ) ) : undefined , ReadOnly : __expectString ( output . ReadOnly ) , Resources : output . Resources !== undefined && output . Resources !== null ? deserializeAws_json1_1ResourceList ( output . Resources , context ) : undefined , Username : __expectString ( output . Username ) , } as any ; } ; const deserializeAws_json1_1EventDataStore = ( output , context ) : EventDataStore => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , EventDataStoreArn : __expectString ( output . EventDataStoreArn ) , MultiRegionEnabled : __expectBoolean ( output . MultiRegionEnabled ) , Name : __expectString ( output . Name ) , OrganizationEnabled : __expectBoolean ( output . OrganizationEnabled ) , RetentionPeriod : __expectInt32 ( output . RetentionPeriod ) , Status : __expectString ( output . Status ) , TerminationProtectionEnabled : __expectBoolean ( output . TerminationProtectionEnabled ) , UpdatedTimestamp : output . UpdatedTimestamp !== undefined && output . UpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1EventDataStoreAlreadyExistsException = ( output , context ) : EventDataStoreAlreadyExistsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1EventDataStoreARNInvalidException = ( output , context ) : EventDataStoreARNInvalidException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1EventDataStoreMaxLimitExceededException = ( output , context ) : EventDataStoreMaxLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1EventDataStoreNotFoundException = ( output , context ) : EventDataStoreNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1EventDataStores = ( output , context ) : EventDataStore [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EventDataStore ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EventDataStoreTerminationProtectedException = ( output , context ) : EventDataStoreTerminationProtectedException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1EventSelector = ( output , context ) : EventSelector => { return { DataResources : output . DataResources !== undefined && output . DataResources !== null ? deserializeAws_json1_1DataResources ( output . DataResources , context ) : undefined , ExcludeManagementEventSources : output . ExcludeManagementEventSources !== undefined && output . ExcludeManagementEventSources !== null ? deserializeAws_json1_1ExcludeManagementEventSources ( output . ExcludeManagementEventSources , context ) : undefined , IncludeManagementEvents : __expectBoolean ( output . IncludeManagementEvents ) , ReadWriteType : __expectString ( output . ReadWriteType ) , } as any ; } ; const deserializeAws_json1_1EventSelectors = ( output , context ) : EventSelector [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EventSelector ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EventsList = ( output , context ) : Event [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Event ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ExcludeManagementEventSources = ( 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_json1_1GetEventDataStoreResponse = ( output , context ) : GetEventDataStoreResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , EventDataStoreArn : __expectString ( output . EventDataStoreArn ) , MultiRegionEnabled : __expectBoolean ( output . MultiRegionEnabled ) , Name : __expectString ( output . Name ) , OrganizationEnabled : __expectBoolean ( output . OrganizationEnabled ) , RetentionPeriod : __expectInt32 ( output . RetentionPeriod ) , Status : __expectString ( output . Status ) , TerminationProtectionEnabled : __expectBoolean ( output . TerminationProtectionEnabled ) , UpdatedTimestamp : output . UpdatedTimestamp !== undefined && output . UpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1GetEventSelectorsResponse = ( output , context ) : GetEventSelectorsResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , EventSelectors : output . EventSelectors !== undefined && output . EventSelectors !== null ? deserializeAws_json1_1EventSelectors ( output . EventSelectors , context ) : undefined , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1GetInsightSelectorsResponse = ( output , context ) : GetInsightSelectorsResponse => { return { InsightSelectors : output . InsightSelectors !== undefined && output . InsightSelectors !== null ? deserializeAws_json1_1InsightSelectors ( output . InsightSelectors , context ) : undefined , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1GetQueryResultsResponse = ( output , context ) : GetQueryResultsResponse => { return { ErrorMessage : __expectString ( output . ErrorMessage ) , NextToken : __expectString ( output . NextToken ) , QueryResultRows : output . QueryResultRows !== undefined && output . QueryResultRows !== null ? deserializeAws_json1_1QueryResultRows ( output . QueryResultRows , context ) : undefined , QueryStatistics : output . QueryStatistics !== undefined && output . QueryStatistics !== null ? deserializeAws_json1_1QueryStatistics ( output . QueryStatistics , context ) : undefined , QueryStatus : __expectString ( output . QueryStatus ) , } as any ; } ; const deserializeAws_json1_1GetTrailResponse = ( output , context ) : GetTrailResponse => { return { Trail : output . Trail !== undefined && output . Trail !== null ? deserializeAws_json1_1Trail ( output . Trail , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetTrailStatusResponse = ( output , context ) : GetTrailStatusResponse => { return { IsLogging : __expectBoolean ( output . IsLogging ) , LatestCloudWatchLogsDeliveryError : __expectString ( output . LatestCloudWatchLogsDeliveryError ) , LatestCloudWatchLogsDeliveryTime : output . LatestCloudWatchLogsDeliveryTime !== undefined && output . LatestCloudWatchLogsDeliveryTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestCloudWatchLogsDeliveryTime ) ) ) : undefined , LatestDeliveryAttemptSucceeded : __expectString ( output . LatestDeliveryAttemptSucceeded ) , LatestDeliveryAttemptTime : __expectString ( output . LatestDeliveryAttemptTime ) , LatestDeliveryError : __expectString ( output . LatestDeliveryError ) , LatestDeliveryTime : output . LatestDeliveryTime !== undefined && output . LatestDeliveryTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestDeliveryTime ) ) ) : undefined , LatestDigestDeliveryError : __expectString ( output . LatestDigestDeliveryError ) , LatestDigestDeliveryTime : output . LatestDigestDeliveryTime !== undefined && output . LatestDigestDeliveryTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestDigestDeliveryTime ) ) ) : undefined , LatestNotificationAttemptSucceeded : __expectString ( output . LatestNotificationAttemptSucceeded ) , LatestNotificationAttemptTime : __expectString ( output . LatestNotificationAttemptTime ) , LatestNotificationError : __expectString ( output . LatestNotificationError ) , LatestNotificationTime : output . LatestNotificationTime !== undefined && output . LatestNotificationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestNotificationTime ) ) ) : undefined , StartLoggingTime : output . StartLoggingTime !== undefined && output . StartLoggingTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . StartLoggingTime ) ) ) : undefined , StopLoggingTime : output . StopLoggingTime !== undefined && output . StopLoggingTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . StopLoggingTime ) ) ) : undefined , TimeLoggingStarted : __expectString ( output . TimeLoggingStarted ) , TimeLoggingStopped : __expectString ( output . TimeLoggingStopped ) , } as any ; } ; const deserializeAws_json1_1InactiveEventDataStoreException = ( output , context ) : InactiveEventDataStoreException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InactiveQueryException = ( output , context ) : InactiveQueryException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InsightNotEnabledException = ( output , context ) : InsightNotEnabledException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InsightSelector = ( output , context ) : InsightSelector => { return { InsightType : __expectString ( output . InsightType ) , } as any ; } ; const deserializeAws_json1_1InsightSelectors = ( output , context ) : InsightSelector [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1InsightSelector ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1InsufficientDependencyServiceAccessPermissionException = ( output , context ) : InsufficientDependencyServiceAccessPermissionException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InsufficientEncryptionPolicyException = ( output , context ) : InsufficientEncryptionPolicyException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InsufficientS3BucketPolicyException = ( output , context ) : InsufficientS3BucketPolicyException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InsufficientSnsTopicPolicyException = ( output , context ) : InsufficientSnsTopicPolicyException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidCloudWatchLogsLogGroupArnException = ( output , context ) : InvalidCloudWatchLogsLogGroupArnException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidCloudWatchLogsRoleArnException = ( output , context ) : InvalidCloudWatchLogsRoleArnException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidDateRangeException = ( output , context ) : InvalidDateRangeException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidEventCategoryException = ( output , context ) : InvalidEventCategoryException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidEventDataStoreStatusException = ( output , context ) : InvalidEventDataStoreStatusException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidEventSelectorsException = ( output , context ) : InvalidEventSelectorsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidHomeRegionException = ( output , context ) : InvalidHomeRegionException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidInsightSelectorsException = ( output , context ) : InvalidInsightSelectorsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidKmsKeyIdException = ( output , context ) : InvalidKmsKeyIdException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidLookupAttributesException = ( output , context ) : InvalidLookupAttributesException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidMaxResultsException = ( output , context ) : InvalidMaxResultsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidNextTokenException = ( output , context ) : InvalidNextTokenException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidParameterCombinationException = ( output , context ) : InvalidParameterCombinationException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidParameterException = ( output , context ) : InvalidParameterException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidQueryStatementException = ( output , context ) : InvalidQueryStatementException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidQueryStatusException = ( output , context ) : InvalidQueryStatusException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidS3BucketNameException = ( output , context ) : InvalidS3BucketNameException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidS3PrefixException = ( output , context ) : InvalidS3PrefixException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidSnsTopicNameException = ( output , context ) : InvalidSnsTopicNameException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidTagParameterException = ( output , context ) : InvalidTagParameterException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidTimeRangeException = ( output , context ) : InvalidTimeRangeException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidTokenException = ( output , context ) : InvalidTokenException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidTrailNameException = ( output , context ) : InvalidTrailNameException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1KmsException = ( output , context ) : KmsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1KmsKeyDisabledException = ( output , context ) : KmsKeyDisabledException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1KmsKeyNotFoundException = ( output , context ) : KmsKeyNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ListEventDataStoresResponse = ( output , context ) : ListEventDataStoresResponse => { return { EventDataStores : output . EventDataStores !== undefined && output . EventDataStores !== null ? deserializeAws_json1_1EventDataStores ( output . EventDataStores , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListPublicKeysResponse = ( output , context ) : ListPublicKeysResponse => { return { NextToken : __expectString ( output . NextToken ) , PublicKeyList : output . PublicKeyList !== undefined && output . PublicKeyList !== null ? deserializeAws_json1_1PublicKeyList ( output . PublicKeyList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListQueriesResponse = ( output , context ) : ListQueriesResponse => { return { NextToken : __expectString ( output . NextToken ) , Queries : output . Queries !== undefined && output . Queries !== null ? deserializeAws_json1_1Queries ( output . Queries , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListTagsResponse = ( output , context ) : ListTagsResponse => { return { NextToken : __expectString ( output . NextToken ) , ResourceTagList : output . ResourceTagList !== undefined && output . ResourceTagList !== null ? deserializeAws_json1_1ResourceTagList ( output . ResourceTagList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListTrailsResponse = ( output , context ) : ListTrailsResponse => { return { NextToken : __expectString ( output . NextToken ) , Trails : output . Trails !== undefined && output . Trails !== null ? deserializeAws_json1_1Trails ( output . Trails , context ) : undefined , } as any ; } ; const deserializeAws_json1_1LookupEventsResponse = ( output , context ) : LookupEventsResponse => { return { Events : output . Events !== undefined && output . Events !== null ? deserializeAws_json1_1EventsList ( output . Events , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1MaxConcurrentQueriesException = ( output , context ) : MaxConcurrentQueriesException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1MaximumNumberOfTrailsExceededException = ( output , context ) : MaximumNumberOfTrailsExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1NotOrganizationMasterAccountException = ( output , context ) : NotOrganizationMasterAccountException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1OperationNotPermittedException = ( output , context ) : OperationNotPermittedException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1Operator = ( 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_json1_1OrganizationNotInAllFeaturesModeException = ( output , context ) : OrganizationNotInAllFeaturesModeException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1OrganizationsNotInUseException = ( output , context ) : OrganizationsNotInUseException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1PublicKey = ( output , context ) : PublicKey => { return { Fingerprint : __expectString ( output . Fingerprint ) , ValidityEndTime : output . ValidityEndTime !== undefined && output . ValidityEndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ValidityEndTime ) ) ) : undefined , ValidityStartTime : output . ValidityStartTime !== undefined && output . ValidityStartTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ValidityStartTime ) ) ) : undefined , Value : output . Value !== undefined && output . Value !== null ? context . base64Decoder ( output . Value ) : undefined , } as any ; } ; const deserializeAws_json1_1PublicKeyList = ( output , context ) : PublicKey [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1PublicKey ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1PutEventSelectorsResponse = ( output , context ) : PutEventSelectorsResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , EventSelectors : output . EventSelectors !== undefined && output . EventSelectors !== null ? deserializeAws_json1_1EventSelectors ( output . EventSelectors , context ) : undefined , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1PutInsightSelectorsResponse = ( output , context ) : PutInsightSelectorsResponse => { return { InsightSelectors : output . InsightSelectors !== undefined && output . InsightSelectors !== null ? deserializeAws_json1_1InsightSelectors ( output . InsightSelectors , context ) : undefined , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1Queries = ( output , context ) : Query [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Query ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Query = ( output , context ) : Query => { return { CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , QueryId : __expectString ( output . QueryId ) , QueryStatus : __expectString ( output . QueryStatus ) , } as any ; } ; const deserializeAws_json1_1QueryIdNotFoundException = ( output , context ) : QueryIdNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1QueryResultColumn = ( 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_json1_1QueryResultRow = ( output , context ) : { [ key ] : string ; } [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1QueryResultColumn ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1QueryResultRows = ( output , context ) : { [ key ] : string ; } [ ] [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1QueryResultRow ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1QueryStatistics = ( output , context ) : QueryStatistics => { return { ResultsCount : __expectInt32 ( output . ResultsCount ) , TotalResultsCount : __expectInt32 ( output . TotalResultsCount ) , } as any ; } ; const deserializeAws_json1_1QueryStatisticsForDescribeQuery = ( output , context ) : QueryStatisticsForDescribeQuery => { return { CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , EventsMatched : __expectLong ( output . EventsMatched ) , EventsScanned : __expectLong ( output . EventsScanned ) , ExecutionTimeInMillis : __expectInt32 ( output . ExecutionTimeInMillis ) , } as any ; } ; const deserializeAws_json1_1RemoveTagsResponse = ( output , context ) : RemoveTagsResponse => { return { } as any ; } ; const deserializeAws_json1_1Resource = ( output , context ) : Resource => { return { ResourceName : __expectString ( output . ResourceName ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_json1_1ResourceList = ( output , context ) : Resource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Resource ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ResourceTag = ( output , context ) : ResourceTag => { return { ResourceId : __expectString ( output . ResourceId ) , TagsList : output . TagsList !== undefined && output . TagsList !== null ? deserializeAws_json1_1TagsList ( output . TagsList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ResourceTagList = ( output , context ) : ResourceTag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ResourceTag ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ResourceTypeNotSupportedException = ( output , context ) : ResourceTypeNotSupportedException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1RestoreEventDataStoreResponse = ( output , context ) : RestoreEventDataStoreResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , EventDataStoreArn : __expectString ( output . EventDataStoreArn ) , MultiRegionEnabled : __expectBoolean ( output . MultiRegionEnabled ) , Name : __expectString ( output . Name ) , OrganizationEnabled : __expectBoolean ( output . OrganizationEnabled ) , RetentionPeriod : __expectInt32 ( output . RetentionPeriod ) , Status : __expectString ( output . Status ) , TerminationProtectionEnabled : __expectBoolean ( output . TerminationProtectionEnabled ) , UpdatedTimestamp : output . UpdatedTimestamp !== undefined && output . UpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1S3BucketDoesNotExistException = ( output , context ) : S3BucketDoesNotExistException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1StartLoggingResponse = ( output , context ) : StartLoggingResponse => { return { } as any ; } ; const deserializeAws_json1_1StartQueryResponse = ( output , context ) : StartQueryResponse => { return { QueryId : __expectString ( output . QueryId ) , } as any ; } ; const deserializeAws_json1_1StopLoggingResponse = ( output , context ) : StopLoggingResponse => { return { } as any ; } ; const deserializeAws_json1_1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1TagsLimitExceededException = ( output , context ) : TagsLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TagsList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Trail = ( output , context ) : Trail => { return { CloudWatchLogsLogGroupArn : __expectString ( output . CloudWatchLogsLogGroupArn ) , CloudWatchLogsRoleArn : __expectString ( output . CloudWatchLogsRoleArn ) , HasCustomEventSelectors : __expectBoolean ( output . HasCustomEventSelectors ) , HasInsightSelectors : __expectBoolean ( output . HasInsightSelectors ) , HomeRegion : __expectString ( output . HomeRegion ) , IncludeGlobalServiceEvents : __expectBoolean ( output . IncludeGlobalServiceEvents ) , IsMultiRegionTrail : __expectBoolean ( output . IsMultiRegionTrail ) , IsOrganizationTrail : __expectBoolean ( output . IsOrganizationTrail ) , KmsKeyId : __expectString ( output . KmsKeyId ) , LogFileValidationEnabled : __expectBoolean ( output . LogFileValidationEnabled ) , Name : __expectString ( output . Name ) , S3BucketName : __expectString ( output . S3BucketName ) , S3KeyPrefix : __expectString ( output . S3KeyPrefix ) , SnsTopicARN : __expectString ( output . SnsTopicARN ) , SnsTopicName : __expectString ( output . SnsTopicName ) , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1TrailAlreadyExistsException = ( output , context ) : TrailAlreadyExistsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TrailInfo = ( output , context ) : TrailInfo => { return { HomeRegion : __expectString ( output . HomeRegion ) , Name : __expectString ( output . Name ) , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeAws_json1_1TrailList = ( output , context ) : Trail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Trail ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1TrailNotFoundException = ( output , context ) : TrailNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TrailNotProvidedException = ( output , context ) : TrailNotProvidedException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1Trails = ( output , context ) : TrailInfo [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1TrailInfo ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1UnsupportedOperationException = ( output , context ) : UnsupportedOperationException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1UpdateEventDataStoreResponse = ( output , context ) : UpdateEventDataStoreResponse => { return { AdvancedEventSelectors : output . AdvancedEventSelectors !== undefined && output . AdvancedEventSelectors !== null ? deserializeAws_json1_1AdvancedEventSelectors ( output . AdvancedEventSelectors , context ) : undefined , CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , EventDataStoreArn : __expectString ( output . EventDataStoreArn ) , MultiRegionEnabled : __expectBoolean ( output . MultiRegionEnabled ) , Name : __expectString ( output . Name ) , OrganizationEnabled : __expectBoolean ( output . OrganizationEnabled ) , RetentionPeriod : __expectInt32 ( output . RetentionPeriod ) , Status : __expectString ( output . Status ) , TerminationProtectionEnabled : __expectBoolean ( output . TerminationProtectionEnabled ) , UpdatedTimestamp : output . UpdatedTimestamp !== undefined && output . UpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1UpdateTrailResponse = ( output , context ) : UpdateTrailResponse => { return { CloudWatchLogsLogGroupArn : __expectString ( output . CloudWatchLogsLogGroupArn ) , CloudWatchLogsRoleArn : __expectString ( output . CloudWatchLogsRoleArn ) , IncludeGlobalServiceEvents : __expectBoolean ( output . IncludeGlobalServiceEvents ) , IsMultiRegionTrail : __expectBoolean ( output . IsMultiRegionTrail ) , IsOrganizationTrail : __expectBoolean ( output . IsOrganizationTrail ) , KmsKeyId : __expectString ( output . KmsKeyId ) , LogFileValidationEnabled : __expectBoolean ( output . LogFileValidationEnabled ) , Name : __expectString ( output . Name ) , S3BucketName : __expectString ( output . S3BucketName ) , S3KeyPrefix : __expectString ( output . S3KeyPrefix ) , SnsTopicARN : __expectString ( output . SnsTopicARN ) , SnsTopicName : __expectString ( output . SnsTopicName ) , TrailARN : __expectString ( output . TrailARN ) , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const contents = { protocol , hostname , port , method : "POST" , path : basePath . endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) + path : basePath + path , headers , } ; if ( resolvedHostname !== undefined ) { contents . hostname = resolvedHostname ; } if ( body !== undefined ) { contents . body = body ; } return new __HttpRequest ( contents ) ; } ; 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 "" ; } ;