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 , 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 { AddTagsToCertificateCommandInput , AddTagsToCertificateCommandOutput , } from "../commands/AddTagsToCertificateCommand" ; import { DeleteCertificateCommandInput , DeleteCertificateCommandOutput } from "../commands/DeleteCertificateCommand" ; import { DescribeCertificateCommandInput , DescribeCertificateCommandOutput , } from "../commands/DescribeCertificateCommand" ; import { ExportCertificateCommandInput , ExportCertificateCommandOutput } from "../commands/ExportCertificateCommand" ; import { GetAccountConfigurationCommandInput , GetAccountConfigurationCommandOutput , } from "../commands/GetAccountConfigurationCommand" ; import { GetCertificateCommandInput , GetCertificateCommandOutput } from "../commands/GetCertificateCommand" ; import { ImportCertificateCommandInput , ImportCertificateCommandOutput } from "../commands/ImportCertificateCommand" ; import { ListCertificatesCommandInput , ListCertificatesCommandOutput } from "../commands/ListCertificatesCommand" ; import { ListTagsForCertificateCommandInput , ListTagsForCertificateCommandOutput , } from "../commands/ListTagsForCertificateCommand" ; import { PutAccountConfigurationCommandInput , PutAccountConfigurationCommandOutput , } from "../commands/PutAccountConfigurationCommand" ; import { RemoveTagsFromCertificateCommandInput , RemoveTagsFromCertificateCommandOutput , } from "../commands/RemoveTagsFromCertificateCommand" ; import { RenewCertificateCommandInput , RenewCertificateCommandOutput } from "../commands/RenewCertificateCommand" ; import { RequestCertificateCommandInput , RequestCertificateCommandOutput } from "../commands/RequestCertificateCommand" ; import { ResendValidationEmailCommandInput , ResendValidationEmailCommandOutput , } from "../commands/ResendValidationEmailCommand" ; import { UpdateCertificateOptionsCommandInput , UpdateCertificateOptionsCommandOutput , } from "../commands/UpdateCertificateOptionsCommand" ; import { AccessDeniedException , AddTagsToCertificateRequest , CertificateDetail , CertificateOptions , CertificateStatus , CertificateSummary , ConflictException , DeleteCertificateRequest , DescribeCertificateRequest , DescribeCertificateResponse , DomainValidation , DomainValidationOption , ExpiryEventsConfiguration , ExportCertificateRequest , ExportCertificateResponse , ExtendedKeyUsage , ExtendedKeyUsageName , Filters , GetAccountConfigurationResponse , GetCertificateRequest , GetCertificateResponse , ImportCertificateRequest , ImportCertificateResponse , InvalidArgsException , InvalidArnException , InvalidDomainValidationOptionsException , InvalidParameterException , InvalidStateException , InvalidTagException , KeyAlgorithm , KeyUsage , KeyUsageName , LimitExceededException , ListCertificatesRequest , ListCertificatesResponse , ListTagsForCertificateRequest , ListTagsForCertificateResponse , PutAccountConfigurationRequest , RemoveTagsFromCertificateRequest , RenewalSummary , RenewCertificateRequest , RequestCertificateRequest , RequestCertificateResponse , RequestInProgressException , ResendValidationEmailRequest , ResourceInUseException , ResourceNotFoundException , ResourceRecord , Tag , TagPolicyException , ThrottlingException , TooManyTagsException , UpdateCertificateOptionsRequest , ValidationException , } from "../models/models_0" ; export const serializeAws_json1_1AddTagsToCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.AddTagsToCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AddTagsToCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.DeleteCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.DescribeCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ExportCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.ExportCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ExportCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetAccountConfigurationCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.GetAccountConfiguration" , } ; const body = "{}" ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.GetCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ImportCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.ImportCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ImportCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListCertificatesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.ListCertificates" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListCertificatesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsForCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.ListTagsForCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsForCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutAccountConfigurationCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.PutAccountConfiguration" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutAccountConfigurationRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RemoveTagsFromCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.RemoveTagsFromCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RemoveTagsFromCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RenewCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.RenewCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RenewCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RequestCertificateCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.RequestCertificate" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RequestCertificateRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ResendValidationEmailCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.ResendValidationEmail" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ResendValidationEmailRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateCertificateOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "CertificateManager.UpdateCertificateOptions" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateCertificateOptionsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1AddTagsToCertificateCommand = async ( output , context ) : Promise < AddTagsToCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AddTagsToCertificateCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AddTagsToCertificateCommandError = async ( output , context ) : Promise < AddTagsToCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.acm#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagException" : case "com.amazonaws.acm#InvalidTagException" : response = { ... ( await deserializeAws_json1_1InvalidTagExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TagPolicyException" : case "com.amazonaws.acm#TagPolicyException" : response = { ... ( await deserializeAws_json1_1TagPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.acm#ThrottlingException" : response = { ... ( await deserializeAws_json1_1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.acm#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_1DeleteCertificateCommand = async ( output , context ) : Promise < DeleteCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteCertificateCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteCertificateCommandError = async ( output , context ) : Promise < DeleteCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceInUseException" : case "com.amazonaws.acm#ResourceInUseException" : response = { ... ( await deserializeAws_json1_1ResourceInUseExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1DescribeCertificateCommand = async ( output , context ) : Promise < DescribeCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeCertificateCommandError = async ( output , context ) : Promise < DescribeCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1ExportCertificateCommand = async ( output , context ) : Promise < ExportCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ExportCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ExportCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ExportCertificateCommandError = async ( output , context ) : Promise < ExportCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RequestInProgressException" : case "com.amazonaws.acm#RequestInProgressException" : response = { ... ( await deserializeAws_json1_1RequestInProgressExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1GetAccountConfigurationCommand = async ( output , context ) : Promise < GetAccountConfigurationCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetAccountConfigurationCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetAccountConfigurationResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetAccountConfigurationCommandError = async ( output , context ) : Promise < GetAccountConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.acm#AccessDeniedException" : response = { ... ( await deserializeAws_json1_1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.acm#ThrottlingException" : response = { ... ( await deserializeAws_json1_1ThrottlingExceptionResponse ( 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_1GetCertificateCommand = async ( output , context ) : Promise < GetCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetCertificateCommandError = async ( output , context ) : Promise < GetCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RequestInProgressException" : case "com.amazonaws.acm#RequestInProgressException" : response = { ... ( await deserializeAws_json1_1RequestInProgressExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1ImportCertificateCommand = async ( output , context ) : Promise < ImportCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ImportCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ImportCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ImportCertificateCommandError = async ( output , context ) : Promise < ImportCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.acm#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagException" : case "com.amazonaws.acm#InvalidTagException" : response = { ... ( await deserializeAws_json1_1InvalidTagExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.acm#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TagPolicyException" : case "com.amazonaws.acm#TagPolicyException" : response = { ... ( await deserializeAws_json1_1TagPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.acm#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_1ListCertificatesCommand = async ( output , context ) : Promise < ListCertificatesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListCertificatesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListCertificatesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListCertificatesCommandError = async ( output , context ) : Promise < ListCertificatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArgsException" : case "com.amazonaws.acm#InvalidArgsException" : response = { ... ( await deserializeAws_json1_1InvalidArgsExceptionResponse ( 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_1ListTagsForCertificateCommand = async ( output , context ) : Promise < ListTagsForCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsForCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsForCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsForCertificateCommandError = async ( output , context ) : Promise < ListTagsForCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1PutAccountConfigurationCommand = async ( output , context ) : Promise < PutAccountConfigurationCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutAccountConfigurationCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutAccountConfigurationCommandError = async ( output , context ) : Promise < PutAccountConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.acm#AccessDeniedException" : response = { ... ( await deserializeAws_json1_1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.acm#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.acm#ThrottlingException" : response = { ... ( await deserializeAws_json1_1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.acm#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( 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_1RemoveTagsFromCertificateCommand = async ( output , context ) : Promise < RemoveTagsFromCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RemoveTagsFromCertificateCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RemoveTagsFromCertificateCommandError = async ( output , context ) : Promise < RemoveTagsFromCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.acm#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagException" : case "com.amazonaws.acm#InvalidTagException" : response = { ... ( await deserializeAws_json1_1InvalidTagExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TagPolicyException" : case "com.amazonaws.acm#TagPolicyException" : response = { ... ( await deserializeAws_json1_1TagPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.acm#ThrottlingException" : response = { ... ( await deserializeAws_json1_1ThrottlingExceptionResponse ( 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_1RenewCertificateCommand = async ( output , context ) : Promise < RenewCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RenewCertificateCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RenewCertificateCommandError = async ( output , context ) : Promise < RenewCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1RequestCertificateCommand = async ( output , context ) : Promise < RequestCertificateCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RequestCertificateCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RequestCertificateResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RequestCertificateCommandError = async ( output , context ) : Promise < RequestCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidDomainValidationOptionsException" : case "com.amazonaws.acm#InvalidDomainValidationOptionsException" : response = { ... ( await deserializeAws_json1_1InvalidDomainValidationOptionsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.acm#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagException" : case "com.amazonaws.acm#InvalidTagException" : response = { ... ( await deserializeAws_json1_1InvalidTagExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.acm#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TagPolicyException" : case "com.amazonaws.acm#TagPolicyException" : response = { ... ( await deserializeAws_json1_1TagPolicyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.acm#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_1ResendValidationEmailCommand = async ( output , context ) : Promise < ResendValidationEmailCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ResendValidationEmailCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ResendValidationEmailCommandError = async ( output , context ) : Promise < ResendValidationEmailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidDomainValidationOptionsException" : case "com.amazonaws.acm#InvalidDomainValidationOptionsException" : response = { ... ( await deserializeAws_json1_1InvalidDomainValidationOptionsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidStateException" : case "com.amazonaws.acm#InvalidStateException" : response = { ... ( await deserializeAws_json1_1InvalidStateExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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_1UpdateCertificateOptionsCommand = async ( output , context ) : Promise < UpdateCertificateOptionsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateCertificateOptionsCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateCertificateOptionsCommandError = async ( output , context ) : Promise < UpdateCertificateOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidArnException" : case "com.amazonaws.acm#InvalidArnException" : response = { ... ( await deserializeAws_json1_1InvalidArnExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidStateException" : case "com.amazonaws.acm#InvalidStateException" : response = { ... ( await deserializeAws_json1_1InvalidStateExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.acm#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.acm#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 ) ) ; } ; const deserializeAws_json1_1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1AccessDeniedException ( body , context ) ; const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConflictException ( body , context ) ; const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidArgsExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidArgsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidArgsException ( body , context ) ; const contents = { name : "InvalidArgsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidArnExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidArnException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidArnException ( body , context ) ; const contents = { name : "InvalidArnException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidDomainValidationOptionsExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidDomainValidationOptionsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidDomainValidationOptionsException ( body , context ) ; const contents = { name : "InvalidDomainValidationOptionsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidParameterException ( body , context ) ; const contents = { name : "InvalidParameterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidStateExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidStateException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidStateException ( body , context ) ; const contents = { name : "InvalidStateException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTagExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTagException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTagException ( body , context ) ; const contents = { name : "InvalidTagException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LimitExceededException ( body , context ) ; const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RequestInProgressExceptionResponse = async ( parsedOutput , context ) : Promise < RequestInProgressException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RequestInProgressException ( body , context ) ; const contents = { name : "RequestInProgressException" , $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_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_1TagPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < TagPolicyException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TagPolicyException ( body , context ) ; const contents = { name : "TagPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ThrottlingException ( body , context ) ; const contents = { name : "ThrottlingException" , $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_1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ValidationException ( body , context ) ; const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1AddTagsToCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1CertificateOptions = ( input , context ) : any => { return { ... ( input . CertificateTransparencyLoggingPreference !== undefined && input . CertificateTransparencyLoggingPreference !== null && { CertificateTransparencyLoggingPreference : input . CertificateTransparencyLoggingPreference , } ) , } ; } ; const serializeAws_json1_1CertificateStatuses = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1DeleteCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , } ; } ; const serializeAws_json1_1DescribeCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , } ; } ; const serializeAws_json1_1DomainList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1DomainValidationOption = ( input , context ) : any => { return { ... ( input . DomainName !== undefined && input . DomainName !== null && { DomainName : input . DomainName } ) , ... ( input . ValidationDomain !== undefined && input . ValidationDomain !== null && { ValidationDomain : input . ValidationDomain } ) , } ; } ; const serializeAws_json1_1DomainValidationOptionList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1DomainValidationOption ( entry , context ) ; } ) ; } ; const serializeAws_json1_1ExpiryEventsConfiguration = ( input , context ) : any => { return { ... ( input . DaysBeforeExpiry !== undefined && input . DaysBeforeExpiry !== null && { DaysBeforeExpiry : input . DaysBeforeExpiry } ) , } ; } ; const serializeAws_json1_1ExportCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . Passphrase !== undefined && input . Passphrase !== null && { Passphrase : context . base64Encoder ( input . Passphrase ) } ) , } ; } ; const serializeAws_json1_1ExtendedKeyUsageFilterList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1Filters = ( input , context ) : any => { return { ... ( input . extendedKeyUsage !== undefined && input . extendedKeyUsage !== null && { extendedKeyUsage : serializeAws_json1_1ExtendedKeyUsageFilterList ( input . extendedKeyUsage , context ) , } ) , ... ( input . keyTypes !== undefined && input . keyTypes !== null && { keyTypes : serializeAws_json1_1KeyAlgorithmList ( input . keyTypes , context ) } ) , ... ( input . keyUsage !== undefined && input . keyUsage !== null && { keyUsage : serializeAws_json1_1KeyUsageFilterList ( input . keyUsage , context ) } ) , } ; } ; const serializeAws_json1_1GetCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , } ; } ; const serializeAws_json1_1ImportCertificateRequest = ( input , context ) : any => { return { ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : context . base64Encoder ( input . Certificate ) } ) , ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . CertificateChain !== undefined && input . CertificateChain !== null && { CertificateChain : context . base64Encoder ( input . CertificateChain ) } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : context . base64Encoder ( input . PrivateKey ) } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1KeyAlgorithmList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1KeyUsageFilterList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1ListCertificatesRequest = ( input , context ) : any => { return { ... ( input . CertificateStatuses !== undefined && input . CertificateStatuses !== null && { CertificateStatuses : serializeAws_json1_1CertificateStatuses ( input . CertificateStatuses , context ) , } ) , ... ( input . Includes !== undefined && input . Includes !== null && { Includes : serializeAws_json1_1Filters ( input . Includes , context ) } ) , ... ( input . MaxItems !== undefined && input . MaxItems !== null && { MaxItems : input . MaxItems } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListTagsForCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , } ; } ; const serializeAws_json1_1PutAccountConfigurationRequest = ( input , context ) : any => { return { ... ( input . ExpiryEvents !== undefined && input . ExpiryEvents !== null && { ExpiryEvents : serializeAws_json1_1ExpiryEventsConfiguration ( input . ExpiryEvents , context ) , } ) , ... ( input . IdempotencyToken !== undefined && input . IdempotencyToken !== null && { IdempotencyToken : input . IdempotencyToken } ) , } ; } ; const serializeAws_json1_1RemoveTagsFromCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1RenewCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , } ; } ; const serializeAws_json1_1RequestCertificateRequest = ( input , context ) : any => { return { ... ( input . CertificateAuthorityArn !== undefined && input . CertificateAuthorityArn !== null && { CertificateAuthorityArn : input . CertificateAuthorityArn } ) , ... ( input . DomainName !== undefined && input . DomainName !== null && { DomainName : input . DomainName } ) , ... ( input . DomainValidationOptions !== undefined && input . DomainValidationOptions !== null && { DomainValidationOptions : serializeAws_json1_1DomainValidationOptionList ( input . DomainValidationOptions , context ) , } ) , ... ( input . IdempotencyToken !== undefined && input . IdempotencyToken !== null && { IdempotencyToken : input . IdempotencyToken } ) , ... ( input . Options !== undefined && input . Options !== null && { Options : serializeAws_json1_1CertificateOptions ( input . Options , context ) } ) , ... ( input . SubjectAlternativeNames !== undefined && input . SubjectAlternativeNames !== null && { SubjectAlternativeNames : serializeAws_json1_1DomainList ( input . SubjectAlternativeNames , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , ... ( input . ValidationMethod !== undefined && input . ValidationMethod !== null && { ValidationMethod : input . ValidationMethod } ) , } ; } ; const serializeAws_json1_1ResendValidationEmailRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . Domain !== undefined && input . Domain !== null && { Domain : input . Domain } ) , ... ( input . ValidationDomain !== undefined && input . ValidationDomain !== null && { ValidationDomain : input . ValidationDomain } ) , } ; } ; 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_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_1UpdateCertificateOptionsRequest = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { CertificateArn : input . CertificateArn } ) , ... ( input . Options !== undefined && input . Options !== null && { Options : serializeAws_json1_1CertificateOptions ( input . Options , context ) } ) , } ; } ; const deserializeAws_json1_1AccessDeniedException = ( output , context ) : AccessDeniedException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1CertificateDetail = ( output , context ) : CertificateDetail => { return { CertificateArn : __expectString ( output . CertificateArn ) , CertificateAuthorityArn : __expectString ( output . CertificateAuthorityArn ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , DomainName : __expectString ( output . DomainName ) , DomainValidationOptions : output . DomainValidationOptions !== undefined && output . DomainValidationOptions !== null ? deserializeAws_json1_1DomainValidationList ( output . DomainValidationOptions , context ) : undefined , ExtendedKeyUsages : output . ExtendedKeyUsages !== undefined && output . ExtendedKeyUsages !== null ? deserializeAws_json1_1ExtendedKeyUsageList ( output . ExtendedKeyUsages , context ) : undefined , FailureReason : __expectString ( output . FailureReason ) , ImportedAt : output . ImportedAt !== undefined && output . ImportedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ImportedAt ) ) ) : undefined , InUseBy : output . InUseBy !== undefined && output . InUseBy !== null ? deserializeAws_json1_1InUseList ( output . InUseBy , context ) : undefined , IssuedAt : output . IssuedAt !== undefined && output . IssuedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . IssuedAt ) ) ) : undefined , Issuer : __expectString ( output . Issuer ) , KeyAlgorithm : __expectString ( output . KeyAlgorithm ) , KeyUsages : output . KeyUsages !== undefined && output . KeyUsages !== null ? deserializeAws_json1_1KeyUsageList ( output . KeyUsages , context ) : undefined , NotAfter : output . NotAfter !== undefined && output . NotAfter !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . NotAfter ) ) ) : undefined , NotBefore : output . NotBefore !== undefined && output . NotBefore !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . NotBefore ) ) ) : undefined , Options : output . Options !== undefined && output . Options !== null ? deserializeAws_json1_1CertificateOptions ( output . Options , context ) : undefined , RenewalEligibility : __expectString ( output . RenewalEligibility ) , RenewalSummary : output . RenewalSummary !== undefined && output . RenewalSummary !== null ? deserializeAws_json1_1RenewalSummary ( output . RenewalSummary , context ) : undefined , RevocationReason : __expectString ( output . RevocationReason ) , RevokedAt : output . RevokedAt !== undefined && output . RevokedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . RevokedAt ) ) ) : undefined , Serial : __expectString ( output . Serial ) , SignatureAlgorithm : __expectString ( output . SignatureAlgorithm ) , Status : __expectString ( output . Status ) , Subject : __expectString ( output . Subject ) , SubjectAlternativeNames : output . SubjectAlternativeNames !== undefined && output . SubjectAlternativeNames !== null ? deserializeAws_json1_1DomainList ( output . SubjectAlternativeNames , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1CertificateOptions = ( output , context ) : CertificateOptions => { return { CertificateTransparencyLoggingPreference : __expectString ( output . CertificateTransparencyLoggingPreference ) , } as any ; } ; const deserializeAws_json1_1CertificateSummary = ( output , context ) : CertificateSummary => { return { CertificateArn : __expectString ( output . CertificateArn ) , DomainName : __expectString ( output . DomainName ) , } as any ; } ; const deserializeAws_json1_1CertificateSummaryList = ( output , context ) : CertificateSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1CertificateSummary ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ConflictException = ( output , context ) : ConflictException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1DescribeCertificateResponse = ( output , context ) : DescribeCertificateResponse => { return { Certificate : output . Certificate !== undefined && output . Certificate !== null ? deserializeAws_json1_1CertificateDetail ( output . Certificate , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DomainList = ( 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_1DomainValidation = ( output , context ) : DomainValidation => { return { DomainName : __expectString ( output . DomainName ) , ResourceRecord : output . ResourceRecord !== undefined && output . ResourceRecord !== null ? deserializeAws_json1_1ResourceRecord ( output . ResourceRecord , context ) : undefined , ValidationDomain : __expectString ( output . ValidationDomain ) , ValidationEmails : output . ValidationEmails !== undefined && output . ValidationEmails !== null ? deserializeAws_json1_1ValidationEmailList ( output . ValidationEmails , context ) : undefined , ValidationMethod : __expectString ( output . ValidationMethod ) , ValidationStatus : __expectString ( output . ValidationStatus ) , } as any ; } ; const deserializeAws_json1_1DomainValidationList = ( output , context ) : DomainValidation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DomainValidation ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ExpiryEventsConfiguration = ( output , context ) : ExpiryEventsConfiguration => { return { DaysBeforeExpiry : __expectInt32 ( output . DaysBeforeExpiry ) , } as any ; } ; const deserializeAws_json1_1ExportCertificateResponse = ( output , context ) : ExportCertificateResponse => { return { Certificate : __expectString ( output . Certificate ) , CertificateChain : __expectString ( output . CertificateChain ) , PrivateKey : __expectString ( output . PrivateKey ) , } as any ; } ; const deserializeAws_json1_1ExtendedKeyUsage = ( output , context ) : ExtendedKeyUsage => { return { Name : __expectString ( output . Name ) , OID : __expectString ( output . OID ) , } as any ; } ; const deserializeAws_json1_1ExtendedKeyUsageList = ( output , context ) : ExtendedKeyUsage [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ExtendedKeyUsage ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1GetAccountConfigurationResponse = ( output , context ) : GetAccountConfigurationResponse => { return { ExpiryEvents : output . ExpiryEvents !== undefined && output . ExpiryEvents !== null ? deserializeAws_json1_1ExpiryEventsConfiguration ( output . ExpiryEvents , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetCertificateResponse = ( output , context ) : GetCertificateResponse => { return { Certificate : __expectString ( output . Certificate ) , CertificateChain : __expectString ( output . CertificateChain ) , } as any ; } ; const deserializeAws_json1_1ImportCertificateResponse = ( output , context ) : ImportCertificateResponse => { return { CertificateArn : __expectString ( output . CertificateArn ) , } as any ; } ; const deserializeAws_json1_1InUseList = ( 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_1InvalidArgsException = ( output , context ) : InvalidArgsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidArnException = ( output , context ) : InvalidArnException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidDomainValidationOptionsException = ( output , context ) : InvalidDomainValidationOptionsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidParameterException = ( output , context ) : InvalidParameterException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidStateException = ( output , context ) : InvalidStateException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidTagException = ( output , context ) : InvalidTagException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1KeyUsage = ( output , context ) : KeyUsage => { return { Name : __expectString ( output . Name ) , } as any ; } ; const deserializeAws_json1_1KeyUsageList = ( output , context ) : KeyUsage [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1KeyUsage ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1LimitExceededException = ( output , context ) : LimitExceededException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ListCertificatesResponse = ( output , context ) : ListCertificatesResponse => { return { CertificateSummaryList : output . CertificateSummaryList !== undefined && output . CertificateSummaryList !== null ? deserializeAws_json1_1CertificateSummaryList ( output . CertificateSummaryList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListTagsForCertificateResponse = ( output , context ) : ListTagsForCertificateResponse => { return { Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_json1_1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1RenewalSummary = ( output , context ) : RenewalSummary => { return { DomainValidationOptions : output . DomainValidationOptions !== undefined && output . DomainValidationOptions !== null ? deserializeAws_json1_1DomainValidationList ( output . DomainValidationOptions , context ) : undefined , RenewalStatus : __expectString ( output . RenewalStatus ) , RenewalStatusReason : __expectString ( output . RenewalStatusReason ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . UpdatedAt ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1RequestCertificateResponse = ( output , context ) : RequestCertificateResponse => { return { CertificateArn : __expectString ( output . CertificateArn ) , } as any ; } ; const deserializeAws_json1_1RequestInProgressException = ( output , context ) : RequestInProgressException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ResourceInUseException = ( output , context ) : ResourceInUseException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ResourceRecord = ( output , context ) : ResourceRecord => { return { Name : __expectString ( output . Name ) , Type : __expectString ( output . Type ) , Value : __expectString ( output . Value ) , } 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_1TagPolicyException = ( output , context ) : TagPolicyException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ThrottlingException = ( output , context ) : ThrottlingException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1TooManyTagsException = ( output , context ) : TooManyTagsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ValidationEmailList = ( 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_1ValidationException = ( output , context ) : ValidationException => { return { message : __expectString ( output . message ) , } 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 "" ; } ;