import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , limitedParseDouble as __limitedParseDouble , limitedParseFloat32 as __limitedParseFloat32 , 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 { v4 as generateIdempotencyToken } from "uuid" ; import { BatchDetectDominantLanguageCommandInput , BatchDetectDominantLanguageCommandOutput , } from "../commands/BatchDetectDominantLanguageCommand" ; import { BatchDetectEntitiesCommandInput , BatchDetectEntitiesCommandOutput , } from "../commands/BatchDetectEntitiesCommand" ; import { BatchDetectKeyPhrasesCommandInput , BatchDetectKeyPhrasesCommandOutput , } from "../commands/BatchDetectKeyPhrasesCommand" ; import { BatchDetectSentimentCommandInput , BatchDetectSentimentCommandOutput , } from "../commands/BatchDetectSentimentCommand" ; import { BatchDetectSyntaxCommandInput , BatchDetectSyntaxCommandOutput } from "../commands/BatchDetectSyntaxCommand" ; import { ClassifyDocumentCommandInput , ClassifyDocumentCommandOutput } from "../commands/ClassifyDocumentCommand" ; import { ContainsPiiEntitiesCommandInput , ContainsPiiEntitiesCommandOutput , } from "../commands/ContainsPiiEntitiesCommand" ; import { CreateDocumentClassifierCommandInput , CreateDocumentClassifierCommandOutput , } from "../commands/CreateDocumentClassifierCommand" ; import { CreateEndpointCommandInput , CreateEndpointCommandOutput } from "../commands/CreateEndpointCommand" ; import { CreateEntityRecognizerCommandInput , CreateEntityRecognizerCommandOutput , } from "../commands/CreateEntityRecognizerCommand" ; import { DeleteDocumentClassifierCommandInput , DeleteDocumentClassifierCommandOutput , } from "../commands/DeleteDocumentClassifierCommand" ; import { DeleteEndpointCommandInput , DeleteEndpointCommandOutput } from "../commands/DeleteEndpointCommand" ; import { DeleteEntityRecognizerCommandInput , DeleteEntityRecognizerCommandOutput , } from "../commands/DeleteEntityRecognizerCommand" ; import { DescribeDocumentClassificationJobCommandInput , DescribeDocumentClassificationJobCommandOutput , } from "../commands/DescribeDocumentClassificationJobCommand" ; import { DescribeDocumentClassifierCommandInput , DescribeDocumentClassifierCommandOutput , } from "../commands/DescribeDocumentClassifierCommand" ; import { DescribeDominantLanguageDetectionJobCommandInput , DescribeDominantLanguageDetectionJobCommandOutput , } from "../commands/DescribeDominantLanguageDetectionJobCommand" ; import { DescribeEndpointCommandInput , DescribeEndpointCommandOutput } from "../commands/DescribeEndpointCommand" ; import { DescribeEntitiesDetectionJobCommandInput , DescribeEntitiesDetectionJobCommandOutput , } from "../commands/DescribeEntitiesDetectionJobCommand" ; import { DescribeEntityRecognizerCommandInput , DescribeEntityRecognizerCommandOutput , } from "../commands/DescribeEntityRecognizerCommand" ; import { DescribeEventsDetectionJobCommandInput , DescribeEventsDetectionJobCommandOutput , } from "../commands/DescribeEventsDetectionJobCommand" ; import { DescribeKeyPhrasesDetectionJobCommandInput , DescribeKeyPhrasesDetectionJobCommandOutput , } from "../commands/DescribeKeyPhrasesDetectionJobCommand" ; import { DescribePiiEntitiesDetectionJobCommandInput , DescribePiiEntitiesDetectionJobCommandOutput , } from "../commands/DescribePiiEntitiesDetectionJobCommand" ; import { DescribeSentimentDetectionJobCommandInput , DescribeSentimentDetectionJobCommandOutput , } from "../commands/DescribeSentimentDetectionJobCommand" ; import { DescribeTopicsDetectionJobCommandInput , DescribeTopicsDetectionJobCommandOutput , } from "../commands/DescribeTopicsDetectionJobCommand" ; import { DetectDominantLanguageCommandInput , DetectDominantLanguageCommandOutput , } from "../commands/DetectDominantLanguageCommand" ; import { DetectEntitiesCommandInput , DetectEntitiesCommandOutput } from "../commands/DetectEntitiesCommand" ; import { DetectKeyPhrasesCommandInput , DetectKeyPhrasesCommandOutput } from "../commands/DetectKeyPhrasesCommand" ; import { DetectPiiEntitiesCommandInput , DetectPiiEntitiesCommandOutput } from "../commands/DetectPiiEntitiesCommand" ; import { DetectSentimentCommandInput , DetectSentimentCommandOutput } from "../commands/DetectSentimentCommand" ; import { DetectSyntaxCommandInput , DetectSyntaxCommandOutput } from "../commands/DetectSyntaxCommand" ; import { ListDocumentClassificationJobsCommandInput , ListDocumentClassificationJobsCommandOutput , } from "../commands/ListDocumentClassificationJobsCommand" ; import { ListDocumentClassifiersCommandInput , ListDocumentClassifiersCommandOutput , } from "../commands/ListDocumentClassifiersCommand" ; import { ListDocumentClassifierSummariesCommandInput , ListDocumentClassifierSummariesCommandOutput , } from "../commands/ListDocumentClassifierSummariesCommand" ; import { ListDominantLanguageDetectionJobsCommandInput , ListDominantLanguageDetectionJobsCommandOutput , } from "../commands/ListDominantLanguageDetectionJobsCommand" ; import { ListEndpointsCommandInput , ListEndpointsCommandOutput } from "../commands/ListEndpointsCommand" ; import { ListEntitiesDetectionJobsCommandInput , ListEntitiesDetectionJobsCommandOutput , } from "../commands/ListEntitiesDetectionJobsCommand" ; import { ListEntityRecognizersCommandInput , ListEntityRecognizersCommandOutput , } from "../commands/ListEntityRecognizersCommand" ; import { ListEntityRecognizerSummariesCommandInput , ListEntityRecognizerSummariesCommandOutput , } from "../commands/ListEntityRecognizerSummariesCommand" ; import { ListEventsDetectionJobsCommandInput , ListEventsDetectionJobsCommandOutput , } from "../commands/ListEventsDetectionJobsCommand" ; import { ListKeyPhrasesDetectionJobsCommandInput , ListKeyPhrasesDetectionJobsCommandOutput , } from "../commands/ListKeyPhrasesDetectionJobsCommand" ; import { ListPiiEntitiesDetectionJobsCommandInput , ListPiiEntitiesDetectionJobsCommandOutput , } from "../commands/ListPiiEntitiesDetectionJobsCommand" ; import { ListSentimentDetectionJobsCommandInput , ListSentimentDetectionJobsCommandOutput , } from "../commands/ListSentimentDetectionJobsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListTopicsDetectionJobsCommandInput , ListTopicsDetectionJobsCommandOutput , } from "../commands/ListTopicsDetectionJobsCommand" ; import { StartDocumentClassificationJobCommandInput , StartDocumentClassificationJobCommandOutput , } from "../commands/StartDocumentClassificationJobCommand" ; import { StartDominantLanguageDetectionJobCommandInput , StartDominantLanguageDetectionJobCommandOutput , } from "../commands/StartDominantLanguageDetectionJobCommand" ; import { StartEntitiesDetectionJobCommandInput , StartEntitiesDetectionJobCommandOutput , } from "../commands/StartEntitiesDetectionJobCommand" ; import { StartEventsDetectionJobCommandInput , StartEventsDetectionJobCommandOutput , } from "../commands/StartEventsDetectionJobCommand" ; import { StartKeyPhrasesDetectionJobCommandInput , StartKeyPhrasesDetectionJobCommandOutput , } from "../commands/StartKeyPhrasesDetectionJobCommand" ; import { StartPiiEntitiesDetectionJobCommandInput , StartPiiEntitiesDetectionJobCommandOutput , } from "../commands/StartPiiEntitiesDetectionJobCommand" ; import { StartSentimentDetectionJobCommandInput , StartSentimentDetectionJobCommandOutput , } from "../commands/StartSentimentDetectionJobCommand" ; import { StartTopicsDetectionJobCommandInput , StartTopicsDetectionJobCommandOutput , } from "../commands/StartTopicsDetectionJobCommand" ; import { StopDominantLanguageDetectionJobCommandInput , StopDominantLanguageDetectionJobCommandOutput , } from "../commands/StopDominantLanguageDetectionJobCommand" ; import { StopEntitiesDetectionJobCommandInput , StopEntitiesDetectionJobCommandOutput , } from "../commands/StopEntitiesDetectionJobCommand" ; import { StopEventsDetectionJobCommandInput , StopEventsDetectionJobCommandOutput , } from "../commands/StopEventsDetectionJobCommand" ; import { StopKeyPhrasesDetectionJobCommandInput , StopKeyPhrasesDetectionJobCommandOutput , } from "../commands/StopKeyPhrasesDetectionJobCommand" ; import { StopPiiEntitiesDetectionJobCommandInput , StopPiiEntitiesDetectionJobCommandOutput , } from "../commands/StopPiiEntitiesDetectionJobCommand" ; import { StopSentimentDetectionJobCommandInput , StopSentimentDetectionJobCommandOutput , } from "../commands/StopSentimentDetectionJobCommand" ; import { StopTrainingDocumentClassifierCommandInput , StopTrainingDocumentClassifierCommandOutput , } from "../commands/StopTrainingDocumentClassifierCommand" ; import { StopTrainingEntityRecognizerCommandInput , StopTrainingEntityRecognizerCommandOutput , } from "../commands/StopTrainingEntityRecognizerCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateEndpointCommandInput , UpdateEndpointCommandOutput } from "../commands/UpdateEndpointCommand" ; import { AugmentedManifestsListItem , BatchDetectDominantLanguageItemResult , BatchDetectDominantLanguageRequest , BatchDetectDominantLanguageResponse , BatchDetectEntitiesItemResult , BatchDetectEntitiesRequest , BatchDetectEntitiesResponse , BatchDetectKeyPhrasesItemResult , BatchDetectKeyPhrasesRequest , BatchDetectKeyPhrasesResponse , BatchDetectSentimentItemResult , BatchDetectSentimentRequest , BatchDetectSentimentResponse , BatchDetectSyntaxItemResult , BatchDetectSyntaxRequest , BatchDetectSyntaxResponse , BatchItemError , BatchSizeLimitExceededException , ClassifierEvaluationMetrics , ClassifierMetadata , ClassifyDocumentRequest , ClassifyDocumentResponse , ConcurrentModificationException , ContainsPiiEntitiesRequest , ContainsPiiEntitiesResponse , CreateDocumentClassifierRequest , CreateDocumentClassifierResponse , CreateEndpointRequest , CreateEndpointResponse , CreateEntityRecognizerRequest , CreateEntityRecognizerResponse , DeleteDocumentClassifierRequest , DeleteDocumentClassifierResponse , DeleteEndpointRequest , DeleteEndpointResponse , DeleteEntityRecognizerRequest , DeleteEntityRecognizerResponse , DescribeDocumentClassificationJobRequest , DescribeDocumentClassificationJobResponse , DescribeDocumentClassifierRequest , DescribeDocumentClassifierResponse , DescribeDominantLanguageDetectionJobRequest , DescribeDominantLanguageDetectionJobResponse , DescribeEndpointRequest , DescribeEndpointResponse , DescribeEntitiesDetectionJobRequest , DescribeEntitiesDetectionJobResponse , DescribeEntityRecognizerRequest , DescribeEntityRecognizerResponse , DescribeEventsDetectionJobRequest , DescribeEventsDetectionJobResponse , DescribeKeyPhrasesDetectionJobRequest , DescribeKeyPhrasesDetectionJobResponse , DescribePiiEntitiesDetectionJobRequest , DescribePiiEntitiesDetectionJobResponse , DescribeSentimentDetectionJobRequest , DescribeSentimentDetectionJobResponse , DescribeTopicsDetectionJobRequest , DescribeTopicsDetectionJobResponse , DetectDominantLanguageRequest , DetectDominantLanguageResponse , DetectEntitiesRequest , DetectEntitiesResponse , DetectKeyPhrasesRequest , DetectKeyPhrasesResponse , DetectPiiEntitiesRequest , DetectPiiEntitiesResponse , DetectSentimentRequest , DetectSentimentResponse , DetectSyntaxRequest , DetectSyntaxResponse , DocumentClass , DocumentClassificationJobFilter , DocumentClassificationJobProperties , DocumentClassifierFilter , DocumentClassifierInputDataConfig , DocumentClassifierOutputDataConfig , DocumentClassifierProperties , DocumentClassifierSummary , DocumentLabel , DocumentReaderConfig , DocumentReadFeatureTypes , DominantLanguage , DominantLanguageDetectionJobFilter , DominantLanguageDetectionJobProperties , EndpointFilter , EndpointProperties , EntitiesDetectionJobFilter , EntitiesDetectionJobProperties , Entity , EntityLabel , EntityRecognizerAnnotations , EntityRecognizerDocuments , EntityRecognizerEntityList , EntityRecognizerEvaluationMetrics , EntityRecognizerFilter , EntityRecognizerInputDataConfig , EntityRecognizerMetadata , EntityRecognizerMetadataEntityTypesListItem , EntityRecognizerProperties , EntityRecognizerSummary , EntityTypesEvaluationMetrics , EntityTypesListItem , EventsDetectionJobFilter , EventsDetectionJobProperties , InputDataConfig , InternalServerException , InvalidFilterException , InvalidRequestException , JobNotFoundException , KeyPhrase , KeyPhrasesDetectionJobFilter , KeyPhrasesDetectionJobProperties , KmsKeyValidationException , ListDocumentClassificationJobsRequest , ListDocumentClassificationJobsResponse , ListDocumentClassifiersRequest , ListDocumentClassifiersResponse , ListDocumentClassifierSummariesRequest , ListDocumentClassifierSummariesResponse , ListDominantLanguageDetectionJobsRequest , ListDominantLanguageDetectionJobsResponse , ListEndpointsRequest , ListEndpointsResponse , ListEntitiesDetectionJobsRequest , ListEntitiesDetectionJobsResponse , ListEntityRecognizersRequest , ListEntityRecognizersResponse , ListEntityRecognizerSummariesRequest , ListEntityRecognizerSummariesResponse , ListEventsDetectionJobsRequest , ListEventsDetectionJobsResponse , ListKeyPhrasesDetectionJobsRequest , ListKeyPhrasesDetectionJobsResponse , ListPiiEntitiesDetectionJobsRequest , ListPiiEntitiesDetectionJobsResponse , ListSentimentDetectionJobsRequest , ListSentimentDetectionJobsResponse , ListTagsForResourceRequest , ListTagsForResourceResponse , ListTopicsDetectionJobsRequest , ListTopicsDetectionJobsResponse , OutputDataConfig , PartOfSpeechTag , PiiEntitiesDetectionJobFilter , PiiEntitiesDetectionJobProperties , PiiEntity , PiiEntityType , PiiOutputDataConfig , RedactionConfig , ResourceInUseException , ResourceLimitExceededException , ResourceNotFoundException , ResourceUnavailableException , SentimentDetectionJobFilter , SentimentDetectionJobProperties , SentimentScore , StartDocumentClassificationJobRequest , StartDocumentClassificationJobResponse , StartDominantLanguageDetectionJobRequest , StartDominantLanguageDetectionJobResponse , StartEntitiesDetectionJobRequest , StartEntitiesDetectionJobResponse , StartEventsDetectionJobRequest , StartEventsDetectionJobResponse , StartKeyPhrasesDetectionJobRequest , StartKeyPhrasesDetectionJobResponse , StartPiiEntitiesDetectionJobRequest , StartPiiEntitiesDetectionJobResponse , StartSentimentDetectionJobRequest , StartSentimentDetectionJobResponse , StartTopicsDetectionJobRequest , StartTopicsDetectionJobResponse , StopDominantLanguageDetectionJobRequest , StopDominantLanguageDetectionJobResponse , StopEntitiesDetectionJobRequest , StopEntitiesDetectionJobResponse , StopEventsDetectionJobRequest , StopEventsDetectionJobResponse , StopKeyPhrasesDetectionJobRequest , StopKeyPhrasesDetectionJobResponse , StopPiiEntitiesDetectionJobRequest , StopPiiEntitiesDetectionJobResponse , StopSentimentDetectionJobRequest , StopSentimentDetectionJobResponse , StopTrainingDocumentClassifierRequest , StopTrainingDocumentClassifierResponse , StopTrainingEntityRecognizerRequest , StopTrainingEntityRecognizerResponse , SyntaxToken , Tag , TagResourceRequest , TagResourceResponse , TextSizeLimitExceededException , TooManyRequestsException , TooManyTagKeysException , TooManyTagsException , TopicsDetectionJobFilter , TopicsDetectionJobProperties , UnsupportedLanguageException , UntagResourceRequest , UntagResourceResponse , UpdateEndpointRequest , UpdateEndpointResponse , VpcConfig , } from "../models/models_0" ; export const serializeAws_json1_1BatchDetectDominantLanguageCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.BatchDetectDominantLanguage" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDetectDominantLanguageRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1BatchDetectEntitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.BatchDetectEntities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDetectEntitiesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1BatchDetectKeyPhrasesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.BatchDetectKeyPhrases" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDetectKeyPhrasesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1BatchDetectSentimentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.BatchDetectSentiment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDetectSentimentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1BatchDetectSyntaxCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.BatchDetectSyntax" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDetectSyntaxRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ClassifyDocumentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ClassifyDocument" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ClassifyDocumentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ContainsPiiEntitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ContainsPiiEntities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ContainsPiiEntitiesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateDocumentClassifierCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.CreateDocumentClassifier" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateDocumentClassifierRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateEndpointCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.CreateEndpoint" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateEndpointRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateEntityRecognizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.CreateEntityRecognizer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateEntityRecognizerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteDocumentClassifierCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DeleteDocumentClassifier" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteDocumentClassifierRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteEndpointCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DeleteEndpoint" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteEndpointRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteEntityRecognizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DeleteEntityRecognizer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteEntityRecognizerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeDocumentClassificationJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeDocumentClassificationJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeDocumentClassificationJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeDocumentClassifierCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeDocumentClassifier" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeDocumentClassifierRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeDominantLanguageDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeDominantLanguageDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeDominantLanguageDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEndpointCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeEndpoint" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEndpointRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEntityRecognizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeEntityRecognizer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEntityRecognizerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEventsDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeEventsDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEventsDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeKeyPhrasesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeKeyPhrasesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeKeyPhrasesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribePiiEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribePiiEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribePiiEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeSentimentDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeSentimentDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeSentimentDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeTopicsDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DescribeTopicsDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeTopicsDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectDominantLanguageCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectDominantLanguage" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectDominantLanguageRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectEntitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectEntities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectEntitiesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectKeyPhrasesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectKeyPhrases" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectKeyPhrasesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectPiiEntitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectPiiEntities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectPiiEntitiesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectSentimentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectSentiment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectSentimentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectSyntaxCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.DetectSyntax" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectSyntaxRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListDocumentClassificationJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListDocumentClassificationJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListDocumentClassificationJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListDocumentClassifiersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListDocumentClassifiers" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListDocumentClassifiersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListDocumentClassifierSummariesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListDocumentClassifierSummaries" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListDocumentClassifierSummariesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListDominantLanguageDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListDominantLanguageDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListDominantLanguageDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEndpointsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListEndpoints" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEndpointsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEntitiesDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListEntitiesDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEntitiesDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEntityRecognizersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListEntityRecognizers" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEntityRecognizersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEntityRecognizerSummariesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListEntityRecognizerSummaries" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEntityRecognizerSummariesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEventsDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListEventsDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEventsDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListKeyPhrasesDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListKeyPhrasesDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListKeyPhrasesDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListPiiEntitiesDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListPiiEntitiesDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListPiiEntitiesDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListSentimentDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListSentimentDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListSentimentDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListTagsForResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsForResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTopicsDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.ListTopicsDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTopicsDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartDocumentClassificationJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartDocumentClassificationJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartDocumentClassificationJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartDominantLanguageDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartDominantLanguageDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartDominantLanguageDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartEventsDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartEventsDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartEventsDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartKeyPhrasesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartKeyPhrasesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartKeyPhrasesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartPiiEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartPiiEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartPiiEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartSentimentDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartSentimentDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartSentimentDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartTopicsDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StartTopicsDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartTopicsDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopDominantLanguageDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopDominantLanguageDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopDominantLanguageDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopEventsDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopEventsDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopEventsDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopKeyPhrasesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopKeyPhrasesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopKeyPhrasesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopPiiEntitiesDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopPiiEntitiesDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopPiiEntitiesDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopSentimentDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopSentimentDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopSentimentDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopTrainingDocumentClassifierCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopTrainingDocumentClassifier" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopTrainingDocumentClassifierRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopTrainingEntityRecognizerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.StopTrainingEntityRecognizer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopTrainingEntityRecognizerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.TagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1TagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.UntagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UntagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateEndpointCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "Comprehend_20171127.UpdateEndpoint" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateEndpointRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1BatchDetectDominantLanguageCommand = async ( output , context ) : Promise < BatchDetectDominantLanguageCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDetectDominantLanguageCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDetectDominantLanguageResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDetectDominantLanguageCommandError = async ( output , context ) : Promise < BatchDetectDominantLanguageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BatchSizeLimitExceededException" : case "com.amazonaws.comprehend#BatchSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1BatchSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( 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_1BatchDetectEntitiesCommand = async ( output , context ) : Promise < BatchDetectEntitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDetectEntitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDetectEntitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDetectEntitiesCommandError = async ( output , context ) : Promise < BatchDetectEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BatchSizeLimitExceededException" : case "com.amazonaws.comprehend#BatchSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1BatchSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1BatchDetectKeyPhrasesCommand = async ( output , context ) : Promise < BatchDetectKeyPhrasesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDetectKeyPhrasesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDetectKeyPhrasesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDetectKeyPhrasesCommandError = async ( output , context ) : Promise < BatchDetectKeyPhrasesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BatchSizeLimitExceededException" : case "com.amazonaws.comprehend#BatchSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1BatchSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1BatchDetectSentimentCommand = async ( output , context ) : Promise < BatchDetectSentimentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDetectSentimentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDetectSentimentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDetectSentimentCommandError = async ( output , context ) : Promise < BatchDetectSentimentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BatchSizeLimitExceededException" : case "com.amazonaws.comprehend#BatchSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1BatchSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1BatchDetectSyntaxCommand = async ( output , context ) : Promise < BatchDetectSyntaxCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDetectSyntaxCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDetectSyntaxResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDetectSyntaxCommandError = async ( output , context ) : Promise < BatchDetectSyntaxCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BatchSizeLimitExceededException" : case "com.amazonaws.comprehend#BatchSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1BatchSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1ClassifyDocumentCommand = async ( output , context ) : Promise < ClassifyDocumentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ClassifyDocumentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ClassifyDocumentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ClassifyDocumentCommandError = async ( output , context ) : Promise < ClassifyDocumentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( 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_1ContainsPiiEntitiesCommand = async ( output , context ) : Promise < ContainsPiiEntitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ContainsPiiEntitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ContainsPiiEntitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ContainsPiiEntitiesCommandError = async ( output , context ) : Promise < ContainsPiiEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1CreateDocumentClassifierCommand = async ( output , context ) : Promise < CreateDocumentClassifierCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateDocumentClassifierCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateDocumentClassifierResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateDocumentClassifierCommandError = async ( output , context ) : Promise < CreateDocumentClassifierCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceLimitExceededException" : case "com.amazonaws.comprehend#ResourceLimitExceededException" : response = { ... ( await deserializeAws_json1_1ResourceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1CreateEndpointCommand = async ( output , context ) : Promise < CreateEndpointCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateEndpointCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateEndpointResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateEndpointCommandError = async ( output , context ) : Promise < CreateEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceLimitExceededException" : case "com.amazonaws.comprehend#ResourceLimitExceededException" : response = { ... ( await deserializeAws_json1_1ResourceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1CreateEntityRecognizerCommand = async ( output , context ) : Promise < CreateEntityRecognizerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateEntityRecognizerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateEntityRecognizerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateEntityRecognizerCommandError = async ( output , context ) : Promise < CreateEntityRecognizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceLimitExceededException" : case "com.amazonaws.comprehend#ResourceLimitExceededException" : response = { ... ( await deserializeAws_json1_1ResourceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1DeleteDocumentClassifierCommand = async ( output , context ) : Promise < DeleteDocumentClassifierCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteDocumentClassifierCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteDocumentClassifierResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteDocumentClassifierCommandError = async ( output , context ) : Promise < DeleteDocumentClassifierCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DeleteEndpointCommand = async ( output , context ) : Promise < DeleteEndpointCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteEndpointCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteEndpointResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteEndpointCommandError = async ( output , context ) : Promise < DeleteEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DeleteEntityRecognizerCommand = async ( output , context ) : Promise < DeleteEntityRecognizerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteEntityRecognizerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteEntityRecognizerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteEntityRecognizerCommandError = async ( output , context ) : Promise < DeleteEntityRecognizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeDocumentClassificationJobCommand = async ( output , context ) : Promise < DescribeDocumentClassificationJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeDocumentClassificationJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeDocumentClassificationJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeDocumentClassificationJobCommandError = async ( output , context ) : Promise < DescribeDocumentClassificationJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeDocumentClassifierCommand = async ( output , context ) : Promise < DescribeDocumentClassifierCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeDocumentClassifierCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeDocumentClassifierResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeDocumentClassifierCommandError = async ( output , context ) : Promise < DescribeDocumentClassifierCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeDominantLanguageDetectionJobCommand = async ( output , context ) : Promise < DescribeDominantLanguageDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeDominantLanguageDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeDominantLanguageDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeDominantLanguageDetectionJobCommandError = async ( output , context ) : Promise < DescribeDominantLanguageDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeEndpointCommand = async ( output , context ) : Promise < DescribeEndpointCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEndpointCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEndpointResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEndpointCommandError = async ( output , context ) : Promise < DescribeEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeEntitiesDetectionJobCommand = async ( output , context ) : Promise < DescribeEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEntitiesDetectionJobCommandError = async ( output , context ) : Promise < DescribeEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeEntityRecognizerCommand = async ( output , context ) : Promise < DescribeEntityRecognizerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEntityRecognizerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEntityRecognizerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEntityRecognizerCommandError = async ( output , context ) : Promise < DescribeEntityRecognizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeEventsDetectionJobCommand = async ( output , context ) : Promise < DescribeEventsDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEventsDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEventsDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEventsDetectionJobCommandError = async ( output , context ) : Promise < DescribeEventsDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeKeyPhrasesDetectionJobCommand = async ( output , context ) : Promise < DescribeKeyPhrasesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeKeyPhrasesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeKeyPhrasesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeKeyPhrasesDetectionJobCommandError = async ( output , context ) : Promise < DescribeKeyPhrasesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribePiiEntitiesDetectionJobCommand = async ( output , context ) : Promise < DescribePiiEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribePiiEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribePiiEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribePiiEntitiesDetectionJobCommandError = async ( output , context ) : Promise < DescribePiiEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeSentimentDetectionJobCommand = async ( output , context ) : Promise < DescribeSentimentDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeSentimentDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeSentimentDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeSentimentDetectionJobCommandError = async ( output , context ) : Promise < DescribeSentimentDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DescribeTopicsDetectionJobCommand = async ( output , context ) : Promise < DescribeTopicsDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeTopicsDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeTopicsDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeTopicsDetectionJobCommandError = async ( output , context ) : Promise < DescribeTopicsDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1DetectDominantLanguageCommand = async ( output , context ) : Promise < DetectDominantLanguageCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectDominantLanguageCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectDominantLanguageResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectDominantLanguageCommandError = async ( output , context ) : Promise < DetectDominantLanguageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( 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_1DetectEntitiesCommand = async ( output , context ) : Promise < DetectEntitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectEntitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectEntitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectEntitiesCommandError = async ( output , context ) : Promise < DetectEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1DetectKeyPhrasesCommand = async ( output , context ) : Promise < DetectKeyPhrasesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectKeyPhrasesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectKeyPhrasesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectKeyPhrasesCommandError = async ( output , context ) : Promise < DetectKeyPhrasesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1DetectPiiEntitiesCommand = async ( output , context ) : Promise < DetectPiiEntitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectPiiEntitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectPiiEntitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectPiiEntitiesCommandError = async ( output , context ) : Promise < DetectPiiEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1DetectSentimentCommand = async ( output , context ) : Promise < DetectSentimentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectSentimentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectSentimentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectSentimentCommandError = async ( output , context ) : Promise < DetectSentimentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1DetectSyntaxCommand = async ( output , context ) : Promise < DetectSyntaxCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectSyntaxCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectSyntaxResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectSyntaxCommandError = async ( output , context ) : Promise < DetectSyntaxCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehend#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedLanguageException" : case "com.amazonaws.comprehend#UnsupportedLanguageException" : response = { ... ( await deserializeAws_json1_1UnsupportedLanguageExceptionResponse ( 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_1ListDocumentClassificationJobsCommand = async ( output , context ) : Promise < ListDocumentClassificationJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListDocumentClassificationJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListDocumentClassificationJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListDocumentClassificationJobsCommandError = async ( output , context ) : Promise < ListDocumentClassificationJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListDocumentClassifiersCommand = async ( output , context ) : Promise < ListDocumentClassifiersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListDocumentClassifiersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListDocumentClassifiersResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListDocumentClassifiersCommandError = async ( output , context ) : Promise < ListDocumentClassifiersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListDocumentClassifierSummariesCommand = async ( output , context ) : Promise < ListDocumentClassifierSummariesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListDocumentClassifierSummariesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListDocumentClassifierSummariesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListDocumentClassifierSummariesCommandError = async ( output , context ) : Promise < ListDocumentClassifierSummariesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListDominantLanguageDetectionJobsCommand = async ( output , context ) : Promise < ListDominantLanguageDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListDominantLanguageDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListDominantLanguageDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListDominantLanguageDetectionJobsCommandError = async ( output , context ) : Promise < ListDominantLanguageDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListEndpointsCommand = async ( output , context ) : Promise < ListEndpointsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEndpointsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEndpointsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEndpointsCommandError = async ( output , context ) : Promise < ListEndpointsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListEntitiesDetectionJobsCommand = async ( output , context ) : Promise < ListEntitiesDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEntitiesDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEntitiesDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEntitiesDetectionJobsCommandError = async ( output , context ) : Promise < ListEntitiesDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListEntityRecognizersCommand = async ( output , context ) : Promise < ListEntityRecognizersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEntityRecognizersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEntityRecognizersResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEntityRecognizersCommandError = async ( output , context ) : Promise < ListEntityRecognizersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListEntityRecognizerSummariesCommand = async ( output , context ) : Promise < ListEntityRecognizerSummariesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEntityRecognizerSummariesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEntityRecognizerSummariesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEntityRecognizerSummariesCommandError = async ( output , context ) : Promise < ListEntityRecognizerSummariesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListEventsDetectionJobsCommand = async ( output , context ) : Promise < ListEventsDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEventsDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEventsDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEventsDetectionJobsCommandError = async ( output , context ) : Promise < ListEventsDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListKeyPhrasesDetectionJobsCommand = async ( output , context ) : Promise < ListKeyPhrasesDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListKeyPhrasesDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListKeyPhrasesDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListKeyPhrasesDetectionJobsCommandError = async ( output , context ) : Promise < ListKeyPhrasesDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListPiiEntitiesDetectionJobsCommand = async ( output , context ) : Promise < ListPiiEntitiesDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListPiiEntitiesDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListPiiEntitiesDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListPiiEntitiesDetectionJobsCommandError = async ( output , context ) : Promise < ListPiiEntitiesDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListSentimentDetectionJobsCommand = async ( output , context ) : Promise < ListSentimentDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListSentimentDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListSentimentDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListSentimentDetectionJobsCommandError = async ( output , context ) : Promise < ListSentimentDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsForResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsForResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( 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_1ListTopicsDetectionJobsCommand = async ( output , context ) : Promise < ListTopicsDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTopicsDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTopicsDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTopicsDetectionJobsCommandError = async ( output , context ) : Promise < ListTopicsDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidFilterException" : case "com.amazonaws.comprehend#InvalidFilterException" : response = { ... ( await deserializeAws_json1_1InvalidFilterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1StartDocumentClassificationJobCommand = async ( output , context ) : Promise < StartDocumentClassificationJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartDocumentClassificationJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartDocumentClassificationJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartDocumentClassificationJobCommandError = async ( output , context ) : Promise < StartDocumentClassificationJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartDominantLanguageDetectionJobCommand = async ( output , context ) : Promise < StartDominantLanguageDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartDominantLanguageDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartDominantLanguageDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartDominantLanguageDetectionJobCommandError = async ( output , context ) : Promise < StartDominantLanguageDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartEntitiesDetectionJobCommand = async ( output , context ) : Promise < StartEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartEntitiesDetectionJobCommandError = async ( output , context ) : Promise < StartEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartEventsDetectionJobCommand = async ( output , context ) : Promise < StartEventsDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartEventsDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartEventsDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartEventsDetectionJobCommandError = async ( output , context ) : Promise < StartEventsDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartKeyPhrasesDetectionJobCommand = async ( output , context ) : Promise < StartKeyPhrasesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartKeyPhrasesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartKeyPhrasesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartKeyPhrasesDetectionJobCommandError = async ( output , context ) : Promise < StartKeyPhrasesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartPiiEntitiesDetectionJobCommand = async ( output , context ) : Promise < StartPiiEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartPiiEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartPiiEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartPiiEntitiesDetectionJobCommandError = async ( output , context ) : Promise < StartPiiEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartSentimentDetectionJobCommand = async ( output , context ) : Promise < StartSentimentDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartSentimentDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartSentimentDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartSentimentDetectionJobCommandError = async ( output , context ) : Promise < StartSentimentDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StartTopicsDetectionJobCommand = async ( output , context ) : Promise < StartTopicsDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartTopicsDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartTopicsDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartTopicsDetectionJobCommandError = async ( output , context ) : Promise < StartTopicsDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "KmsKeyValidationException" : case "com.amazonaws.comprehend#KmsKeyValidationException" : response = { ... ( await deserializeAws_json1_1KmsKeyValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1StopDominantLanguageDetectionJobCommand = async ( output , context ) : Promise < StopDominantLanguageDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopDominantLanguageDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopDominantLanguageDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopDominantLanguageDetectionJobCommandError = async ( output , context ) : Promise < StopDominantLanguageDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopEntitiesDetectionJobCommand = async ( output , context ) : Promise < StopEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopEntitiesDetectionJobCommandError = async ( output , context ) : Promise < StopEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopEventsDetectionJobCommand = async ( output , context ) : Promise < StopEventsDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopEventsDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopEventsDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopEventsDetectionJobCommandError = async ( output , context ) : Promise < StopEventsDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopKeyPhrasesDetectionJobCommand = async ( output , context ) : Promise < StopKeyPhrasesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopKeyPhrasesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopKeyPhrasesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopKeyPhrasesDetectionJobCommandError = async ( output , context ) : Promise < StopKeyPhrasesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopPiiEntitiesDetectionJobCommand = async ( output , context ) : Promise < StopPiiEntitiesDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopPiiEntitiesDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopPiiEntitiesDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopPiiEntitiesDetectionJobCommandError = async ( output , context ) : Promise < StopPiiEntitiesDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopSentimentDetectionJobCommand = async ( output , context ) : Promise < StopSentimentDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopSentimentDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopSentimentDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopSentimentDetectionJobCommandError = async ( output , context ) : Promise < StopSentimentDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "JobNotFoundException" : case "com.amazonaws.comprehend#JobNotFoundException" : response = { ... ( await deserializeAws_json1_1JobNotFoundExceptionResponse ( 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_1StopTrainingDocumentClassifierCommand = async ( output , context ) : Promise < StopTrainingDocumentClassifierCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopTrainingDocumentClassifierCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopTrainingDocumentClassifierResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopTrainingDocumentClassifierCommandError = async ( output , context ) : Promise < StopTrainingDocumentClassifierCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1StopTrainingEntityRecognizerCommand = async ( output , context ) : Promise < StopTrainingEntityRecognizerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopTrainingEntityRecognizerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopTrainingEntityRecognizerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopTrainingEntityRecognizerCommandError = async ( output , context ) : Promise < StopTrainingEntityRecognizerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1TagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1TagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.comprehend#ConcurrentModificationException" : response = { ... ( await deserializeAws_json1_1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.comprehend#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( 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_1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UntagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UntagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.comprehend#ConcurrentModificationException" : response = { ... ( await deserializeAws_json1_1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagKeysException" : case "com.amazonaws.comprehend#TooManyTagKeysException" : response = { ... ( await deserializeAws_json1_1TooManyTagKeysExceptionResponse ( 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_1UpdateEndpointCommand = async ( output , context ) : Promise < UpdateEndpointCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateEndpointCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateEndpointResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateEndpointCommandError = async ( output , context ) : Promise < UpdateEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehend#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehend#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.comprehend#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceLimitExceededException" : case "com.amazonaws.comprehend#ResourceLimitExceededException" : response = { ... ( await deserializeAws_json1_1ResourceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehend#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceUnavailableException" : case "com.amazonaws.comprehend#ResourceUnavailableException" : response = { ... ( await deserializeAws_json1_1ResourceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehend#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_1BatchSizeLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < BatchSizeLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1BatchSizeLimitExceededException ( body , context ) ; const contents = { name : "BatchSizeLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ConcurrentModificationExceptionResponse = async ( parsedOutput , context ) : Promise < ConcurrentModificationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConcurrentModificationException ( body , context ) ; const contents = { name : "ConcurrentModificationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InternalServerException ( body , context ) ; const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidFilterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidFilterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidFilterException ( body , context ) ; const contents = { name : "InvalidFilterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidRequestExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidRequestException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidRequestException ( body , context ) ; const contents = { name : "InvalidRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1JobNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < JobNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1JobNotFoundException ( body , context ) ; const contents = { name : "JobNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1KmsKeyValidationExceptionResponse = async ( parsedOutput , context ) : Promise < KmsKeyValidationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1KmsKeyValidationException ( body , context ) ; const contents = { name : "KmsKeyValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceInUseExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceInUseException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceInUseException ( body , context ) ; const contents = { name : "ResourceInUseException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceLimitExceededException ( body , context ) ; const contents = { name : "ResourceLimitExceededException" , $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_1ResourceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceUnavailableException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceUnavailableException ( body , context ) ; const contents = { name : "ResourceUnavailableException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TextSizeLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < TextSizeLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TextSizeLimitExceededException ( body , context ) ; const contents = { name : "TextSizeLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyRequestsException ( body , context ) ; const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyTagKeysExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyTagKeysException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyTagKeysException ( body , context ) ; const contents = { name : "TooManyTagKeysException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyTagsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyTagsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyTagsException ( body , context ) ; const contents = { name : "TooManyTagsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1UnsupportedLanguageExceptionResponse = async ( parsedOutput , context ) : Promise < UnsupportedLanguageException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1UnsupportedLanguageException ( body , context ) ; const contents = { name : "UnsupportedLanguageException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1AttributeNamesList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1AugmentedManifestsListItem = ( input , context ) : any => { return { ... ( input . AnnotationDataS3Uri !== undefined && input . AnnotationDataS3Uri !== null && { AnnotationDataS3Uri : input . AnnotationDataS3Uri } ) , ... ( input . AttributeNames !== undefined && input . AttributeNames !== null && { AttributeNames : serializeAws_json1_1AttributeNamesList ( input . AttributeNames , context ) , } ) , ... ( input . DocumentType !== undefined && input . DocumentType !== null && { DocumentType : input . DocumentType } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , ... ( input . SourceDocumentsS3Uri !== undefined && input . SourceDocumentsS3Uri !== null && { SourceDocumentsS3Uri : input . SourceDocumentsS3Uri } ) , ... ( input . Split !== undefined && input . Split !== null && { Split : input . Split } ) , } ; } ; const serializeAws_json1_1BatchDetectDominantLanguageRequest = ( input , context ) : any => { return { ... ( input . TextList !== undefined && input . TextList !== null && { TextList : serializeAws_json1_1CustomerInputStringList ( input . TextList , context ) } ) , } ; } ; const serializeAws_json1_1BatchDetectEntitiesRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . TextList !== undefined && input . TextList !== null && { TextList : serializeAws_json1_1CustomerInputStringList ( input . TextList , context ) } ) , } ; } ; const serializeAws_json1_1BatchDetectKeyPhrasesRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . TextList !== undefined && input . TextList !== null && { TextList : serializeAws_json1_1CustomerInputStringList ( input . TextList , context ) } ) , } ; } ; const serializeAws_json1_1BatchDetectSentimentRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . TextList !== undefined && input . TextList !== null && { TextList : serializeAws_json1_1CustomerInputStringList ( input . TextList , context ) } ) , } ; } ; const serializeAws_json1_1BatchDetectSyntaxRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . TextList !== undefined && input . TextList !== null && { TextList : serializeAws_json1_1CustomerInputStringList ( input . TextList , context ) } ) , } ; } ; const serializeAws_json1_1ClassifyDocumentRequest = ( input , context ) : any => { return { ... ( input . EndpointArn !== undefined && input . EndpointArn !== null && { EndpointArn : input . EndpointArn } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1ContainsPiiEntitiesRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1CreateDocumentClassifierRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . DocumentClassifierName !== undefined && input . DocumentClassifierName !== null && { DocumentClassifierName : input . DocumentClassifierName } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1DocumentClassifierInputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Mode !== undefined && input . Mode !== null && { Mode : input . Mode } ) , ... ( input . ModelKmsKeyId !== undefined && input . ModelKmsKeyId !== null && { ModelKmsKeyId : input . ModelKmsKeyId } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1DocumentClassifierOutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VersionName !== undefined && input . VersionName !== null && { VersionName : input . VersionName } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1CreateEndpointRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . DesiredInferenceUnits !== undefined && input . DesiredInferenceUnits !== null && { DesiredInferenceUnits : input . DesiredInferenceUnits } ) , ... ( input . EndpointName !== undefined && input . EndpointName !== null && { EndpointName : input . EndpointName } ) , ... ( input . ModelArn !== undefined && input . ModelArn !== null && { ModelArn : input . ModelArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1CreateEntityRecognizerRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1EntityRecognizerInputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . ModelKmsKeyId !== undefined && input . ModelKmsKeyId !== null && { ModelKmsKeyId : input . ModelKmsKeyId } ) , ... ( input . RecognizerName !== undefined && input . RecognizerName !== null && { RecognizerName : input . RecognizerName } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VersionName !== undefined && input . VersionName !== null && { VersionName : input . VersionName } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1CustomerInputStringList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1DeleteDocumentClassifierRequest = ( input , context ) : any => { return { ... ( input . DocumentClassifierArn !== undefined && input . DocumentClassifierArn !== null && { DocumentClassifierArn : input . DocumentClassifierArn } ) , } ; } ; const serializeAws_json1_1DeleteEndpointRequest = ( input , context ) : any => { return { ... ( input . EndpointArn !== undefined && input . EndpointArn !== null && { EndpointArn : input . EndpointArn } ) , } ; } ; const serializeAws_json1_1DeleteEntityRecognizerRequest = ( input , context ) : any => { return { ... ( input . EntityRecognizerArn !== undefined && input . EntityRecognizerArn !== null && { EntityRecognizerArn : input . EntityRecognizerArn } ) , } ; } ; const serializeAws_json1_1DescribeDocumentClassificationJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeDocumentClassifierRequest = ( input , context ) : any => { return { ... ( input . DocumentClassifierArn !== undefined && input . DocumentClassifierArn !== null && { DocumentClassifierArn : input . DocumentClassifierArn } ) , } ; } ; const serializeAws_json1_1DescribeDominantLanguageDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeEndpointRequest = ( input , context ) : any => { return { ... ( input . EndpointArn !== undefined && input . EndpointArn !== null && { EndpointArn : input . EndpointArn } ) , } ; } ; const serializeAws_json1_1DescribeEntitiesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeEntityRecognizerRequest = ( input , context ) : any => { return { ... ( input . EntityRecognizerArn !== undefined && input . EntityRecognizerArn !== null && { EntityRecognizerArn : input . EntityRecognizerArn } ) , } ; } ; const serializeAws_json1_1DescribeEventsDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeKeyPhrasesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribePiiEntitiesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeSentimentDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeTopicsDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DetectDominantLanguageRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectEntitiesRequest = ( input , context ) : any => { return { ... ( input . EndpointArn !== undefined && input . EndpointArn !== null && { EndpointArn : input . EndpointArn } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectKeyPhrasesRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectPiiEntitiesRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectSentimentRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectSyntaxRequest = ( input , context ) : any => { return { ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DocumentClassificationJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1DocumentClassifierAugmentedManifestsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1AugmentedManifestsListItem ( entry , context ) ; } ) ; } ; const serializeAws_json1_1DocumentClassifierFilter = ( input , context ) : any => { return { ... ( input . DocumentClassifierName !== undefined && input . DocumentClassifierName !== null && { DocumentClassifierName : input . DocumentClassifierName } ) , ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1DocumentClassifierInputDataConfig = ( input , context ) : any => { return { ... ( input . AugmentedManifests !== undefined && input . AugmentedManifests !== null && { AugmentedManifests : serializeAws_json1_1DocumentClassifierAugmentedManifestsList ( input . AugmentedManifests , context ) , } ) , ... ( input . DataFormat !== undefined && input . DataFormat !== null && { DataFormat : input . DataFormat } ) , ... ( input . LabelDelimiter !== undefined && input . LabelDelimiter !== null && { LabelDelimiter : input . LabelDelimiter } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , ... ( input . TestS3Uri !== undefined && input . TestS3Uri !== null && { TestS3Uri : input . TestS3Uri } ) , } ; } ; const serializeAws_json1_1DocumentClassifierOutputDataConfig = ( input , context ) : any => { return { ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , } ; } ; const serializeAws_json1_1DocumentReaderConfig = ( input , context ) : any => { return { ... ( input . DocumentReadAction !== undefined && input . DocumentReadAction !== null && { DocumentReadAction : input . DocumentReadAction } ) , ... ( input . DocumentReadMode !== undefined && input . DocumentReadMode !== null && { DocumentReadMode : input . DocumentReadMode } ) , ... ( input . FeatureTypes !== undefined && input . FeatureTypes !== null && { FeatureTypes : serializeAws_json1_1ListOfDocumentReadFeatureTypes ( input . FeatureTypes , context ) , } ) , } ; } ; const serializeAws_json1_1DominantLanguageDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1EndpointFilter = ( input , context ) : any => { return { ... ( input . CreationTimeAfter !== undefined && input . CreationTimeAfter !== null && { CreationTimeAfter : Math . round ( input . CreationTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . CreationTimeBefore !== undefined && input . CreationTimeBefore !== null && { CreationTimeBefore : Math . round ( input . CreationTimeBefore . getTime ( ) / 1000 ) , } ) , ... ( input . ModelArn !== undefined && input . ModelArn !== null && { ModelArn : input . ModelArn } ) , ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , } ; } ; const serializeAws_json1_1EntitiesDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1EntityRecognizerAnnotations = ( input , context ) : any => { return { ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , ... ( input . TestS3Uri !== undefined && input . TestS3Uri !== null && { TestS3Uri : input . TestS3Uri } ) , } ; } ; const serializeAws_json1_1EntityRecognizerAugmentedManifestsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1AugmentedManifestsListItem ( entry , context ) ; } ) ; } ; const serializeAws_json1_1EntityRecognizerDocuments = ( input , context ) : any => { return { ... ( input . InputFormat !== undefined && input . InputFormat !== null && { InputFormat : input . InputFormat } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , ... ( input . TestS3Uri !== undefined && input . TestS3Uri !== null && { TestS3Uri : input . TestS3Uri } ) , } ; } ; const serializeAws_json1_1EntityRecognizerEntityList = ( input , context ) : any => { return { ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , } ; } ; const serializeAws_json1_1EntityRecognizerFilter = ( input , context ) : any => { return { ... ( input . RecognizerName !== undefined && input . RecognizerName !== null && { RecognizerName : input . RecognizerName } ) , ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1EntityRecognizerInputDataConfig = ( input , context ) : any => { return { ... ( input . Annotations !== undefined && input . Annotations !== null && { Annotations : serializeAws_json1_1EntityRecognizerAnnotations ( input . Annotations , context ) , } ) , ... ( input . AugmentedManifests !== undefined && input . AugmentedManifests !== null && { AugmentedManifests : serializeAws_json1_1EntityRecognizerAugmentedManifestsList ( input . AugmentedManifests , context ) , } ) , ... ( input . DataFormat !== undefined && input . DataFormat !== null && { DataFormat : input . DataFormat } ) , ... ( input . Documents !== undefined && input . Documents !== null && { Documents : serializeAws_json1_1EntityRecognizerDocuments ( input . Documents , context ) , } ) , ... ( input . EntityList !== undefined && input . EntityList !== null && { EntityList : serializeAws_json1_1EntityRecognizerEntityList ( input . EntityList , context ) , } ) , ... ( input . EntityTypes !== undefined && input . EntityTypes !== null && { EntityTypes : serializeAws_json1_1EntityTypesList ( input . EntityTypes , context ) } ) , } ; } ; const serializeAws_json1_1EntityTypesList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1EntityTypesListItem ( entry , context ) ; } ) ; } ; const serializeAws_json1_1EntityTypesListItem = ( input , context ) : any => { return { ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_json1_1EventsDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1InputDataConfig = ( input , context ) : any => { return { ... ( input . DocumentReaderConfig !== undefined && input . DocumentReaderConfig !== null && { DocumentReaderConfig : serializeAws_json1_1DocumentReaderConfig ( input . DocumentReaderConfig , context ) , } ) , ... ( input . InputFormat !== undefined && input . InputFormat !== null && { InputFormat : input . InputFormat } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , } ; } ; const serializeAws_json1_1KeyPhrasesDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1ListDocumentClassificationJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1DocumentClassificationJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListDocumentClassifiersRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1DocumentClassifierFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListDocumentClassifierSummariesRequest = ( 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_1ListDominantLanguageDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1DominantLanguageDetectionJobFilter ( input . Filter , context ) , } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListEndpointsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1EndpointFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListEntitiesDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1EntitiesDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListEntityRecognizersRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1EntityRecognizerFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListEntityRecognizerSummariesRequest = ( 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_1ListEventsDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1EventsDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListKeyPhrasesDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1KeyPhrasesDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListOfDocumentReadFeatureTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1ListOfPiiEntityTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1ListPiiEntitiesDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1PiiEntitiesDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListSentimentDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1SentimentDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListTagsForResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , } ; } ; const serializeAws_json1_1ListTopicsDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1TopicsDetectionJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1OutputDataConfig = ( input , context ) : any => { return { ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . S3Uri !== undefined && input . S3Uri !== null && { S3Uri : input . S3Uri } ) , } ; } ; const serializeAws_json1_1PiiEntitiesDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1RedactionConfig = ( input , context ) : any => { return { ... ( input . MaskCharacter !== undefined && input . MaskCharacter !== null && { MaskCharacter : input . MaskCharacter } ) , ... ( input . MaskMode !== undefined && input . MaskMode !== null && { MaskMode : input . MaskMode } ) , ... ( input . PiiEntityTypes !== undefined && input . PiiEntityTypes !== null && { PiiEntityTypes : serializeAws_json1_1ListOfPiiEntityTypes ( input . PiiEntityTypes , context ) , } ) , } ; } ; const serializeAws_json1_1SecurityGroupIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1SentimentDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1StartDocumentClassificationJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . DocumentClassifierArn !== undefined && input . DocumentClassifierArn !== null && { DocumentClassifierArn : input . DocumentClassifierArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StartDominantLanguageDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StartEntitiesDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . EntityRecognizerArn !== undefined && input . EntityRecognizerArn !== null && { EntityRecognizerArn : input . EntityRecognizerArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StartEventsDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . TargetEventTypes !== undefined && input . TargetEventTypes !== null && { TargetEventTypes : serializeAws_json1_1TargetEventTypes ( input . TargetEventTypes , context ) , } ) , } ; } ; const serializeAws_json1_1StartKeyPhrasesDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StartPiiEntitiesDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Mode !== undefined && input . Mode !== null && { Mode : input . Mode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . RedactionConfig !== undefined && input . RedactionConfig !== null && { RedactionConfig : serializeAws_json1_1RedactionConfig ( input . RedactionConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1StartSentimentDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StartTopicsDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . NumberOfTopics !== undefined && input . NumberOfTopics !== null && { NumberOfTopics : input . NumberOfTopics } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . VolumeKmsKeyId !== undefined && input . VolumeKmsKeyId !== null && { VolumeKmsKeyId : input . VolumeKmsKeyId } ) , ... ( input . VpcConfig !== undefined && input . VpcConfig !== null && { VpcConfig : serializeAws_json1_1VpcConfig ( input . VpcConfig , context ) } ) , } ; } ; const serializeAws_json1_1StopDominantLanguageDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopEntitiesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopEventsDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopKeyPhrasesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopPiiEntitiesDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopSentimentDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopTrainingDocumentClassifierRequest = ( input , context ) : any => { return { ... ( input . DocumentClassifierArn !== undefined && input . DocumentClassifierArn !== null && { DocumentClassifierArn : input . DocumentClassifierArn } ) , } ; } ; const serializeAws_json1_1StopTrainingEntityRecognizerRequest = ( input , context ) : any => { return { ... ( input . EntityRecognizerArn !== undefined && input . EntityRecognizerArn !== null && { EntityRecognizerArn : input . EntityRecognizerArn } ) , } ; } ; const serializeAws_json1_1Subnets = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; 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_1TagKeyList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TagList = ( 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_1TagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1TargetEventTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TopicsDetectionJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1UntagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . TagKeys !== undefined && input . TagKeys !== null && { TagKeys : serializeAws_json1_1TagKeyList ( input . TagKeys , context ) } ) , } ; } ; const serializeAws_json1_1UpdateEndpointRequest = ( input , context ) : any => { return { ... ( input . DesiredDataAccessRoleArn !== undefined && input . DesiredDataAccessRoleArn !== null && { DesiredDataAccessRoleArn : input . DesiredDataAccessRoleArn } ) , ... ( input . DesiredInferenceUnits !== undefined && input . DesiredInferenceUnits !== null && { DesiredInferenceUnits : input . DesiredInferenceUnits } ) , ... ( input . DesiredModelArn !== undefined && input . DesiredModelArn !== null && { DesiredModelArn : input . DesiredModelArn } ) , ... ( input . EndpointArn !== undefined && input . EndpointArn !== null && { EndpointArn : input . EndpointArn } ) , } ; } ; const serializeAws_json1_1VpcConfig = ( input , context ) : any => { return { ... ( input . SecurityGroupIds !== undefined && input . SecurityGroupIds !== null && { SecurityGroupIds : serializeAws_json1_1SecurityGroupIds ( input . SecurityGroupIds , context ) , } ) , ... ( input . Subnets !== undefined && input . Subnets !== null && { Subnets : serializeAws_json1_1Subnets ( input . Subnets , context ) } ) , } ; } ; const deserializeAws_json1_1AttributeNamesList = ( 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_1AugmentedManifestsListItem = ( output , context ) : AugmentedManifestsListItem => { return { AnnotationDataS3Uri : __expectString ( output . AnnotationDataS3Uri ) , AttributeNames : output . AttributeNames !== undefined && output . AttributeNames !== null ? deserializeAws_json1_1AttributeNamesList ( output . AttributeNames , context ) : undefined , DocumentType : __expectString ( output . DocumentType ) , S3Uri : __expectString ( output . S3Uri ) , SourceDocumentsS3Uri : __expectString ( output . SourceDocumentsS3Uri ) , Split : __expectString ( output . Split ) , } as any ; } ; const deserializeAws_json1_1BatchDetectDominantLanguageItemResult = ( output , context ) : BatchDetectDominantLanguageItemResult => { return { Index : __expectInt32 ( output . Index ) , Languages : output . Languages !== undefined && output . Languages !== null ? deserializeAws_json1_1ListOfDominantLanguages ( output . Languages , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectDominantLanguageResponse = ( output , context ) : BatchDetectDominantLanguageResponse => { return { ErrorList : output . ErrorList !== undefined && output . ErrorList !== null ? deserializeAws_json1_1BatchItemErrorList ( output . ErrorList , context ) : undefined , ResultList : output . ResultList !== undefined && output . ResultList !== null ? deserializeAws_json1_1ListOfDetectDominantLanguageResult ( output . ResultList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectEntitiesItemResult = ( output , context ) : BatchDetectEntitiesItemResult => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1ListOfEntities ( output . Entities , context ) : undefined , Index : __expectInt32 ( output . Index ) , } as any ; } ; const deserializeAws_json1_1BatchDetectEntitiesResponse = ( output , context ) : BatchDetectEntitiesResponse => { return { ErrorList : output . ErrorList !== undefined && output . ErrorList !== null ? deserializeAws_json1_1BatchItemErrorList ( output . ErrorList , context ) : undefined , ResultList : output . ResultList !== undefined && output . ResultList !== null ? deserializeAws_json1_1ListOfDetectEntitiesResult ( output . ResultList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectKeyPhrasesItemResult = ( output , context ) : BatchDetectKeyPhrasesItemResult => { return { Index : __expectInt32 ( output . Index ) , KeyPhrases : output . KeyPhrases !== undefined && output . KeyPhrases !== null ? deserializeAws_json1_1ListOfKeyPhrases ( output . KeyPhrases , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectKeyPhrasesResponse = ( output , context ) : BatchDetectKeyPhrasesResponse => { return { ErrorList : output . ErrorList !== undefined && output . ErrorList !== null ? deserializeAws_json1_1BatchItemErrorList ( output . ErrorList , context ) : undefined , ResultList : output . ResultList !== undefined && output . ResultList !== null ? deserializeAws_json1_1ListOfDetectKeyPhrasesResult ( output . ResultList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectSentimentItemResult = ( output , context ) : BatchDetectSentimentItemResult => { return { Index : __expectInt32 ( output . Index ) , Sentiment : __expectString ( output . Sentiment ) , SentimentScore : output . SentimentScore !== undefined && output . SentimentScore !== null ? deserializeAws_json1_1SentimentScore ( output . SentimentScore , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectSentimentResponse = ( output , context ) : BatchDetectSentimentResponse => { return { ErrorList : output . ErrorList !== undefined && output . ErrorList !== null ? deserializeAws_json1_1BatchItemErrorList ( output . ErrorList , context ) : undefined , ResultList : output . ResultList !== undefined && output . ResultList !== null ? deserializeAws_json1_1ListOfDetectSentimentResult ( output . ResultList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectSyntaxItemResult = ( output , context ) : BatchDetectSyntaxItemResult => { return { Index : __expectInt32 ( output . Index ) , SyntaxTokens : output . SyntaxTokens !== undefined && output . SyntaxTokens !== null ? deserializeAws_json1_1ListOfSyntaxTokens ( output . SyntaxTokens , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDetectSyntaxResponse = ( output , context ) : BatchDetectSyntaxResponse => { return { ErrorList : output . ErrorList !== undefined && output . ErrorList !== null ? deserializeAws_json1_1BatchItemErrorList ( output . ErrorList , context ) : undefined , ResultList : output . ResultList !== undefined && output . ResultList !== null ? deserializeAws_json1_1ListOfDetectSyntaxResult ( output . ResultList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchItemError = ( output , context ) : BatchItemError => { return { ErrorCode : __expectString ( output . ErrorCode ) , ErrorMessage : __expectString ( output . ErrorMessage ) , Index : __expectInt32 ( output . Index ) , } as any ; } ; const deserializeAws_json1_1BatchItemErrorList = ( output , context ) : BatchItemError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchItemError ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1BatchSizeLimitExceededException = ( output , context ) : BatchSizeLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ClassifierEvaluationMetrics = ( output , context ) : ClassifierEvaluationMetrics => { return { Accuracy : __limitedParseDouble ( output . Accuracy ) , F1Score : __limitedParseDouble ( output . F1Score ) , HammingLoss : __limitedParseDouble ( output . HammingLoss ) , MicroF1Score : __limitedParseDouble ( output . MicroF1Score ) , MicroPrecision : __limitedParseDouble ( output . MicroPrecision ) , MicroRecall : __limitedParseDouble ( output . MicroRecall ) , Precision : __limitedParseDouble ( output . Precision ) , Recall : __limitedParseDouble ( output . Recall ) , } as any ; } ; const deserializeAws_json1_1ClassifierMetadata = ( output , context ) : ClassifierMetadata => { return { EvaluationMetrics : output . EvaluationMetrics !== undefined && output . EvaluationMetrics !== null ? deserializeAws_json1_1ClassifierEvaluationMetrics ( output . EvaluationMetrics , context ) : undefined , NumberOfLabels : __expectInt32 ( output . NumberOfLabels ) , NumberOfTestDocuments : __expectInt32 ( output . NumberOfTestDocuments ) , NumberOfTrainedDocuments : __expectInt32 ( output . NumberOfTrainedDocuments ) , } as any ; } ; const deserializeAws_json1_1ClassifyDocumentResponse = ( output , context ) : ClassifyDocumentResponse => { return { Classes : output . Classes !== undefined && output . Classes !== null ? deserializeAws_json1_1ListOfClasses ( output . Classes , context ) : undefined , Labels : output . Labels !== undefined && output . Labels !== null ? deserializeAws_json1_1ListOfLabels ( output . Labels , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ConcurrentModificationException = ( output , context ) : ConcurrentModificationException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ContainsPiiEntitiesResponse = ( output , context ) : ContainsPiiEntitiesResponse => { return { Labels : output . Labels !== undefined && output . Labels !== null ? deserializeAws_json1_1ListOfEntityLabels ( output . Labels , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CreateDocumentClassifierResponse = ( output , context ) : CreateDocumentClassifierResponse => { return { DocumentClassifierArn : __expectString ( output . DocumentClassifierArn ) , } as any ; } ; const deserializeAws_json1_1CreateEndpointResponse = ( output , context ) : CreateEndpointResponse => { return { EndpointArn : __expectString ( output . EndpointArn ) , } as any ; } ; const deserializeAws_json1_1CreateEntityRecognizerResponse = ( output , context ) : CreateEntityRecognizerResponse => { return { EntityRecognizerArn : __expectString ( output . EntityRecognizerArn ) , } as any ; } ; const deserializeAws_json1_1DeleteDocumentClassifierResponse = ( output , context ) : DeleteDocumentClassifierResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteEndpointResponse = ( output , context ) : DeleteEndpointResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteEntityRecognizerResponse = ( output , context ) : DeleteEntityRecognizerResponse => { return { } as any ; } ; const deserializeAws_json1_1DescribeDocumentClassificationJobResponse = ( output , context ) : DescribeDocumentClassificationJobResponse => { return { DocumentClassificationJobProperties : output . DocumentClassificationJobProperties !== undefined && output . DocumentClassificationJobProperties !== null ? deserializeAws_json1_1DocumentClassificationJobProperties ( output . DocumentClassificationJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeDocumentClassifierResponse = ( output , context ) : DescribeDocumentClassifierResponse => { return { DocumentClassifierProperties : output . DocumentClassifierProperties !== undefined && output . DocumentClassifierProperties !== null ? deserializeAws_json1_1DocumentClassifierProperties ( output . DocumentClassifierProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeDominantLanguageDetectionJobResponse = ( output , context ) : DescribeDominantLanguageDetectionJobResponse => { return { DominantLanguageDetectionJobProperties : output . DominantLanguageDetectionJobProperties !== undefined && output . DominantLanguageDetectionJobProperties !== null ? deserializeAws_json1_1DominantLanguageDetectionJobProperties ( output . DominantLanguageDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEndpointResponse = ( output , context ) : DescribeEndpointResponse => { return { EndpointProperties : output . EndpointProperties !== undefined && output . EndpointProperties !== null ? deserializeAws_json1_1EndpointProperties ( output . EndpointProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEntitiesDetectionJobResponse = ( output , context ) : DescribeEntitiesDetectionJobResponse => { return { EntitiesDetectionJobProperties : output . EntitiesDetectionJobProperties !== undefined && output . EntitiesDetectionJobProperties !== null ? deserializeAws_json1_1EntitiesDetectionJobProperties ( output . EntitiesDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEntityRecognizerResponse = ( output , context ) : DescribeEntityRecognizerResponse => { return { EntityRecognizerProperties : output . EntityRecognizerProperties !== undefined && output . EntityRecognizerProperties !== null ? deserializeAws_json1_1EntityRecognizerProperties ( output . EntityRecognizerProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEventsDetectionJobResponse = ( output , context ) : DescribeEventsDetectionJobResponse => { return { EventsDetectionJobProperties : output . EventsDetectionJobProperties !== undefined && output . EventsDetectionJobProperties !== null ? deserializeAws_json1_1EventsDetectionJobProperties ( output . EventsDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeKeyPhrasesDetectionJobResponse = ( output , context ) : DescribeKeyPhrasesDetectionJobResponse => { return { KeyPhrasesDetectionJobProperties : output . KeyPhrasesDetectionJobProperties !== undefined && output . KeyPhrasesDetectionJobProperties !== null ? deserializeAws_json1_1KeyPhrasesDetectionJobProperties ( output . KeyPhrasesDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribePiiEntitiesDetectionJobResponse = ( output , context ) : DescribePiiEntitiesDetectionJobResponse => { return { PiiEntitiesDetectionJobProperties : output . PiiEntitiesDetectionJobProperties !== undefined && output . PiiEntitiesDetectionJobProperties !== null ? deserializeAws_json1_1PiiEntitiesDetectionJobProperties ( output . PiiEntitiesDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeSentimentDetectionJobResponse = ( output , context ) : DescribeSentimentDetectionJobResponse => { return { SentimentDetectionJobProperties : output . SentimentDetectionJobProperties !== undefined && output . SentimentDetectionJobProperties !== null ? deserializeAws_json1_1SentimentDetectionJobProperties ( output . SentimentDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeTopicsDetectionJobResponse = ( output , context ) : DescribeTopicsDetectionJobResponse => { return { TopicsDetectionJobProperties : output . TopicsDetectionJobProperties !== undefined && output . TopicsDetectionJobProperties !== null ? deserializeAws_json1_1TopicsDetectionJobProperties ( output . TopicsDetectionJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectDominantLanguageResponse = ( output , context ) : DetectDominantLanguageResponse => { return { Languages : output . Languages !== undefined && output . Languages !== null ? deserializeAws_json1_1ListOfDominantLanguages ( output . Languages , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectEntitiesResponse = ( output , context ) : DetectEntitiesResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1ListOfEntities ( output . Entities , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectKeyPhrasesResponse = ( output , context ) : DetectKeyPhrasesResponse => { return { KeyPhrases : output . KeyPhrases !== undefined && output . KeyPhrases !== null ? deserializeAws_json1_1ListOfKeyPhrases ( output . KeyPhrases , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectPiiEntitiesResponse = ( output , context ) : DetectPiiEntitiesResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1ListOfPiiEntities ( output . Entities , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectSentimentResponse = ( output , context ) : DetectSentimentResponse => { return { Sentiment : __expectString ( output . Sentiment ) , SentimentScore : output . SentimentScore !== undefined && output . SentimentScore !== null ? deserializeAws_json1_1SentimentScore ( output . SentimentScore , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectSyntaxResponse = ( output , context ) : DetectSyntaxResponse => { return { SyntaxTokens : output . SyntaxTokens !== undefined && output . SyntaxTokens !== null ? deserializeAws_json1_1ListOfSyntaxTokens ( output . SyntaxTokens , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DocumentClass = ( output , context ) : DocumentClass => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1DocumentClassificationJobProperties = ( output , context ) : DocumentClassificationJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , DocumentClassifierArn : __expectString ( output . DocumentClassifierArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DocumentClassificationJobPropertiesList = ( output , context ) : DocumentClassificationJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DocumentClassificationJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DocumentClassifierAugmentedManifestsList = ( output , context ) : AugmentedManifestsListItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1AugmentedManifestsListItem ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DocumentClassifierInputDataConfig = ( output , context ) : DocumentClassifierInputDataConfig => { return { AugmentedManifests : output . AugmentedManifests !== undefined && output . AugmentedManifests !== null ? deserializeAws_json1_1DocumentClassifierAugmentedManifestsList ( output . AugmentedManifests , context ) : undefined , DataFormat : __expectString ( output . DataFormat ) , LabelDelimiter : __expectString ( output . LabelDelimiter ) , S3Uri : __expectString ( output . S3Uri ) , TestS3Uri : __expectString ( output . TestS3Uri ) , } as any ; } ; const deserializeAws_json1_1DocumentClassifierOutputDataConfig = ( output , context ) : DocumentClassifierOutputDataConfig => { return { KmsKeyId : __expectString ( output . KmsKeyId ) , S3Uri : __expectString ( output . S3Uri ) , } as any ; } ; const deserializeAws_json1_1DocumentClassifierProperties = ( output , context ) : DocumentClassifierProperties => { return { ClassifierMetadata : output . ClassifierMetadata !== undefined && output . ClassifierMetadata !== null ? deserializeAws_json1_1ClassifierMetadata ( output . ClassifierMetadata , context ) : undefined , DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , DocumentClassifierArn : __expectString ( output . DocumentClassifierArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1DocumentClassifierInputDataConfig ( output . InputDataConfig , context ) : undefined , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , Mode : __expectString ( output . Mode ) , ModelKmsKeyId : __expectString ( output . ModelKmsKeyId ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1DocumentClassifierOutputDataConfig ( output . OutputDataConfig , context ) : undefined , Status : __expectString ( output . Status ) , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , TrainingEndTime : output . TrainingEndTime !== undefined && output . TrainingEndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . TrainingEndTime ) ) ) : undefined , TrainingStartTime : output . TrainingStartTime !== undefined && output . TrainingStartTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . TrainingStartTime ) ) ) : undefined , VersionName : __expectString ( output . VersionName ) , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DocumentClassifierPropertiesList = ( output , context ) : DocumentClassifierProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DocumentClassifierProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DocumentClassifierSummariesList = ( output , context ) : DocumentClassifierSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DocumentClassifierSummary ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DocumentClassifierSummary = ( output , context ) : DocumentClassifierSummary => { return { DocumentClassifierName : __expectString ( output . DocumentClassifierName ) , LatestVersionCreatedAt : output . LatestVersionCreatedAt !== undefined && output . LatestVersionCreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestVersionCreatedAt ) ) ) : undefined , LatestVersionName : __expectString ( output . LatestVersionName ) , LatestVersionStatus : __expectString ( output . LatestVersionStatus ) , NumberOfVersions : __expectInt32 ( output . NumberOfVersions ) , } as any ; } ; const deserializeAws_json1_1DocumentLabel = ( output , context ) : DocumentLabel => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1DocumentReaderConfig = ( output , context ) : DocumentReaderConfig => { return { DocumentReadAction : __expectString ( output . DocumentReadAction ) , DocumentReadMode : __expectString ( output . DocumentReadMode ) , FeatureTypes : output . FeatureTypes !== undefined && output . FeatureTypes !== null ? deserializeAws_json1_1ListOfDocumentReadFeatureTypes ( output . FeatureTypes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DominantLanguage = ( output , context ) : DominantLanguage => { return { LanguageCode : __expectString ( output . LanguageCode ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1DominantLanguageDetectionJobProperties = ( output , context ) : DominantLanguageDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DominantLanguageDetectionJobPropertiesList = ( output , context ) : DominantLanguageDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DominantLanguageDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EndpointProperties = ( output , context ) : EndpointProperties => { return { CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , CurrentInferenceUnits : __expectInt32 ( output . CurrentInferenceUnits ) , DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , DesiredDataAccessRoleArn : __expectString ( output . DesiredDataAccessRoleArn ) , DesiredInferenceUnits : __expectInt32 ( output . DesiredInferenceUnits ) , DesiredModelArn : __expectString ( output . DesiredModelArn ) , EndpointArn : __expectString ( output . EndpointArn ) , LastModifiedTime : output . LastModifiedTime !== undefined && output . LastModifiedTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastModifiedTime ) ) ) : undefined , Message : __expectString ( output . Message ) , ModelArn : __expectString ( output . ModelArn ) , Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_json1_1EndpointPropertiesList = ( output , context ) : EndpointProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EndpointProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntitiesDetectionJobProperties = ( output , context ) : EntitiesDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , EntityRecognizerArn : __expectString ( output . EntityRecognizerArn ) , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EntitiesDetectionJobPropertiesList = ( output , context ) : EntitiesDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntitiesDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Entity = ( output , context ) : Entity => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , EndOffset : __expectInt32 ( output . EndOffset ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1EntityLabel = ( output , context ) : EntityLabel => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerAnnotations = ( output , context ) : EntityRecognizerAnnotations => { return { S3Uri : __expectString ( output . S3Uri ) , TestS3Uri : __expectString ( output . TestS3Uri ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerAugmentedManifestsList = ( output , context ) : AugmentedManifestsListItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1AugmentedManifestsListItem ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntityRecognizerDocuments = ( output , context ) : EntityRecognizerDocuments => { return { InputFormat : __expectString ( output . InputFormat ) , S3Uri : __expectString ( output . S3Uri ) , TestS3Uri : __expectString ( output . TestS3Uri ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerEntityList = ( output , context ) : EntityRecognizerEntityList => { return { S3Uri : __expectString ( output . S3Uri ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerEvaluationMetrics = ( output , context ) : EntityRecognizerEvaluationMetrics => { return { F1Score : __limitedParseDouble ( output . F1Score ) , Precision : __limitedParseDouble ( output . Precision ) , Recall : __limitedParseDouble ( output . Recall ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerInputDataConfig = ( output , context ) : EntityRecognizerInputDataConfig => { return { Annotations : output . Annotations !== undefined && output . Annotations !== null ? deserializeAws_json1_1EntityRecognizerAnnotations ( output . Annotations , context ) : undefined , AugmentedManifests : output . AugmentedManifests !== undefined && output . AugmentedManifests !== null ? deserializeAws_json1_1EntityRecognizerAugmentedManifestsList ( output . AugmentedManifests , context ) : undefined , DataFormat : __expectString ( output . DataFormat ) , Documents : output . Documents !== undefined && output . Documents !== null ? deserializeAws_json1_1EntityRecognizerDocuments ( output . Documents , context ) : undefined , EntityList : output . EntityList !== undefined && output . EntityList !== null ? deserializeAws_json1_1EntityRecognizerEntityList ( output . EntityList , context ) : undefined , EntityTypes : output . EntityTypes !== undefined && output . EntityTypes !== null ? deserializeAws_json1_1EntityTypesList ( output . EntityTypes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EntityRecognizerMetadata = ( output , context ) : EntityRecognizerMetadata => { return { EntityTypes : output . EntityTypes !== undefined && output . EntityTypes !== null ? deserializeAws_json1_1EntityRecognizerMetadataEntityTypesList ( output . EntityTypes , context ) : undefined , EvaluationMetrics : output . EvaluationMetrics !== undefined && output . EvaluationMetrics !== null ? deserializeAws_json1_1EntityRecognizerEvaluationMetrics ( output . EvaluationMetrics , context ) : undefined , NumberOfTestDocuments : __expectInt32 ( output . NumberOfTestDocuments ) , NumberOfTrainedDocuments : __expectInt32 ( output . NumberOfTrainedDocuments ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerMetadataEntityTypesList = ( output , context ) : EntityRecognizerMetadataEntityTypesListItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntityRecognizerMetadataEntityTypesListItem ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntityRecognizerMetadataEntityTypesListItem = ( output , context ) : EntityRecognizerMetadataEntityTypesListItem => { return { EvaluationMetrics : output . EvaluationMetrics !== undefined && output . EvaluationMetrics !== null ? deserializeAws_json1_1EntityTypesEvaluationMetrics ( output . EvaluationMetrics , context ) : undefined , NumberOfTrainMentions : __expectInt32 ( output . NumberOfTrainMentions ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1EntityRecognizerProperties = ( output , context ) : EntityRecognizerProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , EntityRecognizerArn : __expectString ( output . EntityRecognizerArn ) , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1EntityRecognizerInputDataConfig ( output . InputDataConfig , context ) : undefined , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , ModelKmsKeyId : __expectString ( output . ModelKmsKeyId ) , RecognizerMetadata : output . RecognizerMetadata !== undefined && output . RecognizerMetadata !== null ? deserializeAws_json1_1EntityRecognizerMetadata ( output . RecognizerMetadata , context ) : undefined , Status : __expectString ( output . Status ) , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , TrainingEndTime : output . TrainingEndTime !== undefined && output . TrainingEndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . TrainingEndTime ) ) ) : undefined , TrainingStartTime : output . TrainingStartTime !== undefined && output . TrainingStartTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . TrainingStartTime ) ) ) : undefined , VersionName : __expectString ( output . VersionName ) , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EntityRecognizerPropertiesList = ( output , context ) : EntityRecognizerProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntityRecognizerProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntityRecognizerSummariesList = ( output , context ) : EntityRecognizerSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntityRecognizerSummary ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntityRecognizerSummary = ( output , context ) : EntityRecognizerSummary => { return { LatestVersionCreatedAt : output . LatestVersionCreatedAt !== undefined && output . LatestVersionCreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LatestVersionCreatedAt ) ) ) : undefined , LatestVersionName : __expectString ( output . LatestVersionName ) , LatestVersionStatus : __expectString ( output . LatestVersionStatus ) , NumberOfVersions : __expectInt32 ( output . NumberOfVersions ) , RecognizerName : __expectString ( output . RecognizerName ) , } as any ; } ; const deserializeAws_json1_1EntityTypesEvaluationMetrics = ( output , context ) : EntityTypesEvaluationMetrics => { return { F1Score : __limitedParseDouble ( output . F1Score ) , Precision : __limitedParseDouble ( output . Precision ) , Recall : __limitedParseDouble ( output . Recall ) , } as any ; } ; const deserializeAws_json1_1EntityTypesList = ( output , context ) : EntityTypesListItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntityTypesListItem ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EntityTypesListItem = ( output , context ) : EntityTypesListItem => { return { Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1EventsDetectionJobProperties = ( output , context ) : EventsDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , TargetEventTypes : output . TargetEventTypes !== undefined && output . TargetEventTypes !== null ? deserializeAws_json1_1TargetEventTypes ( output . TargetEventTypes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EventsDetectionJobPropertiesList = ( output , context ) : EventsDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EventsDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1InputDataConfig = ( output , context ) : InputDataConfig => { return { DocumentReaderConfig : output . DocumentReaderConfig !== undefined && output . DocumentReaderConfig !== null ? deserializeAws_json1_1DocumentReaderConfig ( output . DocumentReaderConfig , context ) : undefined , InputFormat : __expectString ( output . InputFormat ) , S3Uri : __expectString ( output . S3Uri ) , } as any ; } ; const deserializeAws_json1_1InternalServerException = ( output , context ) : InternalServerException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidFilterException = ( output , context ) : InvalidFilterException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidRequestException = ( output , context ) : InvalidRequestException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1JobNotFoundException = ( output , context ) : JobNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1KeyPhrase = ( output , context ) : KeyPhrase => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , EndOffset : __expectInt32 ( output . EndOffset ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , } as any ; } ; const deserializeAws_json1_1KeyPhrasesDetectionJobProperties = ( output , context ) : KeyPhrasesDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1KeyPhrasesDetectionJobPropertiesList = ( output , context ) : KeyPhrasesDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1KeyPhrasesDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1KmsKeyValidationException = ( output , context ) : KmsKeyValidationException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ListDocumentClassificationJobsResponse = ( output , context ) : ListDocumentClassificationJobsResponse => { return { DocumentClassificationJobPropertiesList : output . DocumentClassificationJobPropertiesList !== undefined && output . DocumentClassificationJobPropertiesList !== null ? deserializeAws_json1_1DocumentClassificationJobPropertiesList ( output . DocumentClassificationJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListDocumentClassifiersResponse = ( output , context ) : ListDocumentClassifiersResponse => { return { DocumentClassifierPropertiesList : output . DocumentClassifierPropertiesList !== undefined && output . DocumentClassifierPropertiesList !== null ? deserializeAws_json1_1DocumentClassifierPropertiesList ( output . DocumentClassifierPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListDocumentClassifierSummariesResponse = ( output , context ) : ListDocumentClassifierSummariesResponse => { return { DocumentClassifierSummariesList : output . DocumentClassifierSummariesList !== undefined && output . DocumentClassifierSummariesList !== null ? deserializeAws_json1_1DocumentClassifierSummariesList ( output . DocumentClassifierSummariesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListDominantLanguageDetectionJobsResponse = ( output , context ) : ListDominantLanguageDetectionJobsResponse => { return { DominantLanguageDetectionJobPropertiesList : output . DominantLanguageDetectionJobPropertiesList !== undefined && output . DominantLanguageDetectionJobPropertiesList !== null ? deserializeAws_json1_1DominantLanguageDetectionJobPropertiesList ( output . DominantLanguageDetectionJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListEndpointsResponse = ( output , context ) : ListEndpointsResponse => { return { EndpointPropertiesList : output . EndpointPropertiesList !== undefined && output . EndpointPropertiesList !== null ? deserializeAws_json1_1EndpointPropertiesList ( output . EndpointPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListEntitiesDetectionJobsResponse = ( output , context ) : ListEntitiesDetectionJobsResponse => { return { EntitiesDetectionJobPropertiesList : output . EntitiesDetectionJobPropertiesList !== undefined && output . EntitiesDetectionJobPropertiesList !== null ? deserializeAws_json1_1EntitiesDetectionJobPropertiesList ( output . EntitiesDetectionJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListEntityRecognizersResponse = ( output , context ) : ListEntityRecognizersResponse => { return { EntityRecognizerPropertiesList : output . EntityRecognizerPropertiesList !== undefined && output . EntityRecognizerPropertiesList !== null ? deserializeAws_json1_1EntityRecognizerPropertiesList ( output . EntityRecognizerPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListEntityRecognizerSummariesResponse = ( output , context ) : ListEntityRecognizerSummariesResponse => { return { EntityRecognizerSummariesList : output . EntityRecognizerSummariesList !== undefined && output . EntityRecognizerSummariesList !== null ? deserializeAws_json1_1EntityRecognizerSummariesList ( output . EntityRecognizerSummariesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListEventsDetectionJobsResponse = ( output , context ) : ListEventsDetectionJobsResponse => { return { EventsDetectionJobPropertiesList : output . EventsDetectionJobPropertiesList !== undefined && output . EventsDetectionJobPropertiesList !== null ? deserializeAws_json1_1EventsDetectionJobPropertiesList ( output . EventsDetectionJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListKeyPhrasesDetectionJobsResponse = ( output , context ) : ListKeyPhrasesDetectionJobsResponse => { return { KeyPhrasesDetectionJobPropertiesList : output . KeyPhrasesDetectionJobPropertiesList !== undefined && output . KeyPhrasesDetectionJobPropertiesList !== null ? deserializeAws_json1_1KeyPhrasesDetectionJobPropertiesList ( output . KeyPhrasesDetectionJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListOfClasses = ( output , context ) : DocumentClass [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DocumentClass ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDetectDominantLanguageResult = ( output , context ) : BatchDetectDominantLanguageItemResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchDetectDominantLanguageItemResult ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDetectEntitiesResult = ( output , context ) : BatchDetectEntitiesItemResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchDetectEntitiesItemResult ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDetectKeyPhrasesResult = ( output , context ) : BatchDetectKeyPhrasesItemResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchDetectKeyPhrasesItemResult ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDetectSentimentResult = ( output , context ) : BatchDetectSentimentItemResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchDetectSentimentItemResult ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDetectSyntaxResult = ( output , context ) : BatchDetectSyntaxItemResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BatchDetectSyntaxItemResult ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfDocumentReadFeatureTypes = ( output , context ) : ( DocumentReadFeatureTypes | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1ListOfDominantLanguages = ( output , context ) : DominantLanguage [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DominantLanguage ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfEntities = ( output , context ) : Entity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Entity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfEntityLabels = ( output , context ) : EntityLabel [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EntityLabel ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfKeyPhrases = ( output , context ) : KeyPhrase [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1KeyPhrase ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfLabels = ( output , context ) : DocumentLabel [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DocumentLabel ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfPiiEntities = ( output , context ) : PiiEntity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1PiiEntity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListOfPiiEntityTypes = ( output , context ) : ( PiiEntityType | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1ListOfSyntaxTokens = ( output , context ) : SyntaxToken [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SyntaxToken ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ListPiiEntitiesDetectionJobsResponse = ( output , context ) : ListPiiEntitiesDetectionJobsResponse => { return { NextToken : __expectString ( output . NextToken ) , PiiEntitiesDetectionJobPropertiesList : output . PiiEntitiesDetectionJobPropertiesList !== undefined && output . PiiEntitiesDetectionJobPropertiesList !== null ? deserializeAws_json1_1PiiEntitiesDetectionJobPropertiesList ( output . PiiEntitiesDetectionJobPropertiesList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListSentimentDetectionJobsResponse = ( output , context ) : ListSentimentDetectionJobsResponse => { return { NextToken : __expectString ( output . NextToken ) , SentimentDetectionJobPropertiesList : output . SentimentDetectionJobPropertiesList !== undefined && output . SentimentDetectionJobPropertiesList !== null ? deserializeAws_json1_1SentimentDetectionJobPropertiesList ( output . SentimentDetectionJobPropertiesList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListTagsForResourceResponse = ( output , context ) : ListTagsForResourceResponse => { return { ResourceArn : __expectString ( output . ResourceArn ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_json1_1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListTopicsDetectionJobsResponse = ( output , context ) : ListTopicsDetectionJobsResponse => { return { NextToken : __expectString ( output . NextToken ) , TopicsDetectionJobPropertiesList : output . TopicsDetectionJobPropertiesList !== undefined && output . TopicsDetectionJobPropertiesList !== null ? deserializeAws_json1_1TopicsDetectionJobPropertiesList ( output . TopicsDetectionJobPropertiesList , context ) : undefined , } as any ; } ; const deserializeAws_json1_1OutputDataConfig = ( output , context ) : OutputDataConfig => { return { KmsKeyId : __expectString ( output . KmsKeyId ) , S3Uri : __expectString ( output . S3Uri ) , } as any ; } ; const deserializeAws_json1_1PartOfSpeechTag = ( output , context ) : PartOfSpeechTag => { return { Score : __limitedParseFloat32 ( output . Score ) , Tag : __expectString ( output . Tag ) , } as any ; } ; const deserializeAws_json1_1PiiEntitiesDetectionJobProperties = ( output , context ) : PiiEntitiesDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , Mode : __expectString ( output . Mode ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1PiiOutputDataConfig ( output . OutputDataConfig , context ) : undefined , RedactionConfig : output . RedactionConfig !== undefined && output . RedactionConfig !== null ? deserializeAws_json1_1RedactionConfig ( output . RedactionConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1PiiEntitiesDetectionJobPropertiesList = ( output , context ) : PiiEntitiesDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1PiiEntitiesDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1PiiEntity = ( output , context ) : PiiEntity => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , EndOffset : __expectInt32 ( output . EndOffset ) , Score : __limitedParseFloat32 ( output . Score ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1PiiOutputDataConfig = ( output , context ) : PiiOutputDataConfig => { return { KmsKeyId : __expectString ( output . KmsKeyId ) , S3Uri : __expectString ( output . S3Uri ) , } as any ; } ; const deserializeAws_json1_1RedactionConfig = ( output , context ) : RedactionConfig => { return { MaskCharacter : __expectString ( output . MaskCharacter ) , MaskMode : __expectString ( output . MaskMode ) , PiiEntityTypes : output . PiiEntityTypes !== undefined && output . PiiEntityTypes !== null ? deserializeAws_json1_1ListOfPiiEntityTypes ( output . PiiEntityTypes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ResourceInUseException = ( output , context ) : ResourceInUseException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ResourceLimitExceededException = ( output , context ) : ResourceLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ResourceUnavailableException = ( output , context ) : ResourceUnavailableException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1SecurityGroupIds = ( 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_1SentimentDetectionJobProperties = ( output , context ) : SentimentDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , LanguageCode : __expectString ( output . LanguageCode ) , Message : __expectString ( output . Message ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1SentimentDetectionJobPropertiesList = ( output , context ) : SentimentDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SentimentDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1SentimentScore = ( output , context ) : SentimentScore => { return { Mixed : __limitedParseFloat32 ( output . Mixed ) , Negative : __limitedParseFloat32 ( output . Negative ) , Neutral : __limitedParseFloat32 ( output . Neutral ) , Positive : __limitedParseFloat32 ( output . Positive ) , } as any ; } ; const deserializeAws_json1_1StartDocumentClassificationJobResponse = ( output , context ) : StartDocumentClassificationJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartDominantLanguageDetectionJobResponse = ( output , context ) : StartDominantLanguageDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartEntitiesDetectionJobResponse = ( output , context ) : StartEntitiesDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartEventsDetectionJobResponse = ( output , context ) : StartEventsDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartKeyPhrasesDetectionJobResponse = ( output , context ) : StartKeyPhrasesDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartPiiEntitiesDetectionJobResponse = ( output , context ) : StartPiiEntitiesDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartSentimentDetectionJobResponse = ( output , context ) : StartSentimentDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StartTopicsDetectionJobResponse = ( output , context ) : StartTopicsDetectionJobResponse => { return { JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopDominantLanguageDetectionJobResponse = ( output , context ) : StopDominantLanguageDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopEntitiesDetectionJobResponse = ( output , context ) : StopEntitiesDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopEventsDetectionJobResponse = ( output , context ) : StopEventsDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopKeyPhrasesDetectionJobResponse = ( output , context ) : StopKeyPhrasesDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopPiiEntitiesDetectionJobResponse = ( output , context ) : StopPiiEntitiesDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopSentimentDetectionJobResponse = ( output , context ) : StopSentimentDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_json1_1StopTrainingDocumentClassifierResponse = ( output , context ) : StopTrainingDocumentClassifierResponse => { return { } as any ; } ; const deserializeAws_json1_1StopTrainingEntityRecognizerResponse = ( output , context ) : StopTrainingEntityRecognizerResponse => { return { } as any ; } ; const deserializeAws_json1_1Subnets = ( 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_1SyntaxToken = ( output , context ) : SyntaxToken => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , EndOffset : __expectInt32 ( output . EndOffset ) , PartOfSpeech : output . PartOfSpeech !== undefined && output . PartOfSpeech !== null ? deserializeAws_json1_1PartOfSpeechTag ( output . PartOfSpeech , context ) : undefined , Text : __expectString ( output . Text ) , TokenId : __expectInt32 ( output . TokenId ) , } as any ; } ; const deserializeAws_json1_1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1TagList = ( 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_1TagResourceResponse = ( output , context ) : TagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1TargetEventTypes = ( 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_1TextSizeLimitExceededException = ( output , context ) : TextSizeLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TooManyRequestsException = ( output , context ) : TooManyRequestsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TooManyTagKeysException = ( output , context ) : TooManyTagKeysException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TooManyTagsException = ( output , context ) : TooManyTagsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TopicsDetectionJobProperties = ( output , context ) : TopicsDetectionJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobArn : __expectString ( output . JobArn ) , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , Message : __expectString ( output . Message ) , NumberOfTopics : __expectInt32 ( output . NumberOfTopics ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , VolumeKmsKeyId : __expectString ( output . VolumeKmsKeyId ) , VpcConfig : output . VpcConfig !== undefined && output . VpcConfig !== null ? deserializeAws_json1_1VpcConfig ( output . VpcConfig , context ) : undefined , } as any ; } ; const deserializeAws_json1_1TopicsDetectionJobPropertiesList = ( output , context ) : TopicsDetectionJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1TopicsDetectionJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1UnsupportedLanguageException = ( output , context ) : UnsupportedLanguageException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1UntagResourceResponse = ( output , context ) : UntagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateEndpointResponse = ( output , context ) : UpdateEndpointResponse => { return { } as any ; } ; const deserializeAws_json1_1VpcConfig = ( output , context ) : VpcConfig => { return { SecurityGroupIds : output . SecurityGroupIds !== undefined && output . SecurityGroupIds !== null ? deserializeAws_json1_1SecurityGroupIds ( output . SecurityGroupIds , context ) : undefined , Subnets : output . Subnets !== undefined && output . Subnets !== null ? deserializeAws_json1_1Subnets ( output . Subnets , context ) : undefined , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const 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 "" ; } ;