import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { CreateConfigurationSetCommandInput , CreateConfigurationSetCommandOutput , } from "../commands/CreateConfigurationSetCommand" ; import { CreateConfigurationSetEventDestinationCommandInput , CreateConfigurationSetEventDestinationCommandOutput , } from "../commands/CreateConfigurationSetEventDestinationCommand" ; import { CreateContactCommandInput , CreateContactCommandOutput } from "../commands/CreateContactCommand" ; import { CreateContactListCommandInput , CreateContactListCommandOutput } from "../commands/CreateContactListCommand" ; import { CreateCustomVerificationEmailTemplateCommandInput , CreateCustomVerificationEmailTemplateCommandOutput , } from "../commands/CreateCustomVerificationEmailTemplateCommand" ; import { CreateDedicatedIpPoolCommandInput , CreateDedicatedIpPoolCommandOutput , } from "../commands/CreateDedicatedIpPoolCommand" ; import { CreateDeliverabilityTestReportCommandInput , CreateDeliverabilityTestReportCommandOutput , } from "../commands/CreateDeliverabilityTestReportCommand" ; import { CreateEmailIdentityCommandInput , CreateEmailIdentityCommandOutput , } from "../commands/CreateEmailIdentityCommand" ; import { CreateEmailIdentityPolicyCommandInput , CreateEmailIdentityPolicyCommandOutput , } from "../commands/CreateEmailIdentityPolicyCommand" ; import { CreateEmailTemplateCommandInput , CreateEmailTemplateCommandOutput , } from "../commands/CreateEmailTemplateCommand" ; import { CreateImportJobCommandInput , CreateImportJobCommandOutput } from "../commands/CreateImportJobCommand" ; import { DeleteConfigurationSetCommandInput , DeleteConfigurationSetCommandOutput , } from "../commands/DeleteConfigurationSetCommand" ; import { DeleteConfigurationSetEventDestinationCommandInput , DeleteConfigurationSetEventDestinationCommandOutput , } from "../commands/DeleteConfigurationSetEventDestinationCommand" ; import { DeleteContactCommandInput , DeleteContactCommandOutput } from "../commands/DeleteContactCommand" ; import { DeleteContactListCommandInput , DeleteContactListCommandOutput } from "../commands/DeleteContactListCommand" ; import { DeleteCustomVerificationEmailTemplateCommandInput , DeleteCustomVerificationEmailTemplateCommandOutput , } from "../commands/DeleteCustomVerificationEmailTemplateCommand" ; import { DeleteDedicatedIpPoolCommandInput , DeleteDedicatedIpPoolCommandOutput , } from "../commands/DeleteDedicatedIpPoolCommand" ; import { DeleteEmailIdentityCommandInput , DeleteEmailIdentityCommandOutput , } from "../commands/DeleteEmailIdentityCommand" ; import { DeleteEmailIdentityPolicyCommandInput , DeleteEmailIdentityPolicyCommandOutput , } from "../commands/DeleteEmailIdentityPolicyCommand" ; import { DeleteEmailTemplateCommandInput , DeleteEmailTemplateCommandOutput , } from "../commands/DeleteEmailTemplateCommand" ; import { DeleteSuppressedDestinationCommandInput , DeleteSuppressedDestinationCommandOutput , } from "../commands/DeleteSuppressedDestinationCommand" ; import { GetAccountCommandInput , GetAccountCommandOutput } from "../commands/GetAccountCommand" ; import { GetBlacklistReportsCommandInput , GetBlacklistReportsCommandOutput , } from "../commands/GetBlacklistReportsCommand" ; import { GetConfigurationSetCommandInput , GetConfigurationSetCommandOutput , } from "../commands/GetConfigurationSetCommand" ; import { GetConfigurationSetEventDestinationsCommandInput , GetConfigurationSetEventDestinationsCommandOutput , } from "../commands/GetConfigurationSetEventDestinationsCommand" ; import { GetContactCommandInput , GetContactCommandOutput } from "../commands/GetContactCommand" ; import { GetContactListCommandInput , GetContactListCommandOutput } from "../commands/GetContactListCommand" ; import { GetCustomVerificationEmailTemplateCommandInput , GetCustomVerificationEmailTemplateCommandOutput , } from "../commands/GetCustomVerificationEmailTemplateCommand" ; import { GetDedicatedIpCommandInput , GetDedicatedIpCommandOutput } from "../commands/GetDedicatedIpCommand" ; import { GetDedicatedIpsCommandInput , GetDedicatedIpsCommandOutput } from "../commands/GetDedicatedIpsCommand" ; import { GetDeliverabilityDashboardOptionsCommandInput , GetDeliverabilityDashboardOptionsCommandOutput , } from "../commands/GetDeliverabilityDashboardOptionsCommand" ; import { GetDeliverabilityTestReportCommandInput , GetDeliverabilityTestReportCommandOutput , } from "../commands/GetDeliverabilityTestReportCommand" ; import { GetDomainDeliverabilityCampaignCommandInput , GetDomainDeliverabilityCampaignCommandOutput , } from "../commands/GetDomainDeliverabilityCampaignCommand" ; import { GetDomainStatisticsReportCommandInput , GetDomainStatisticsReportCommandOutput , } from "../commands/GetDomainStatisticsReportCommand" ; import { GetEmailIdentityCommandInput , GetEmailIdentityCommandOutput } from "../commands/GetEmailIdentityCommand" ; import { GetEmailIdentityPoliciesCommandInput , GetEmailIdentityPoliciesCommandOutput , } from "../commands/GetEmailIdentityPoliciesCommand" ; import { GetEmailTemplateCommandInput , GetEmailTemplateCommandOutput } from "../commands/GetEmailTemplateCommand" ; import { GetImportJobCommandInput , GetImportJobCommandOutput } from "../commands/GetImportJobCommand" ; import { GetSuppressedDestinationCommandInput , GetSuppressedDestinationCommandOutput , } from "../commands/GetSuppressedDestinationCommand" ; import { ListConfigurationSetsCommandInput , ListConfigurationSetsCommandOutput , } from "../commands/ListConfigurationSetsCommand" ; import { ListContactListsCommandInput , ListContactListsCommandOutput } from "../commands/ListContactListsCommand" ; import { ListContactsCommandInput , ListContactsCommandOutput } from "../commands/ListContactsCommand" ; import { ListCustomVerificationEmailTemplatesCommandInput , ListCustomVerificationEmailTemplatesCommandOutput , } from "../commands/ListCustomVerificationEmailTemplatesCommand" ; import { ListDedicatedIpPoolsCommandInput , ListDedicatedIpPoolsCommandOutput , } from "../commands/ListDedicatedIpPoolsCommand" ; import { ListDeliverabilityTestReportsCommandInput , ListDeliverabilityTestReportsCommandOutput , } from "../commands/ListDeliverabilityTestReportsCommand" ; import { ListDomainDeliverabilityCampaignsCommandInput , ListDomainDeliverabilityCampaignsCommandOutput , } from "../commands/ListDomainDeliverabilityCampaignsCommand" ; import { ListEmailIdentitiesCommandInput , ListEmailIdentitiesCommandOutput , } from "../commands/ListEmailIdentitiesCommand" ; import { ListEmailTemplatesCommandInput , ListEmailTemplatesCommandOutput } from "../commands/ListEmailTemplatesCommand" ; import { ListImportJobsCommandInput , ListImportJobsCommandOutput } from "../commands/ListImportJobsCommand" ; import { ListSuppressedDestinationsCommandInput , ListSuppressedDestinationsCommandOutput , } from "../commands/ListSuppressedDestinationsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PutAccountDedicatedIpWarmupAttributesCommandInput , PutAccountDedicatedIpWarmupAttributesCommandOutput , } from "../commands/PutAccountDedicatedIpWarmupAttributesCommand" ; import { PutAccountDetailsCommandInput , PutAccountDetailsCommandOutput } from "../commands/PutAccountDetailsCommand" ; import { PutAccountSendingAttributesCommandInput , PutAccountSendingAttributesCommandOutput , } from "../commands/PutAccountSendingAttributesCommand" ; import { PutAccountSuppressionAttributesCommandInput , PutAccountSuppressionAttributesCommandOutput , } from "../commands/PutAccountSuppressionAttributesCommand" ; import { PutConfigurationSetDeliveryOptionsCommandInput , PutConfigurationSetDeliveryOptionsCommandOutput , } from "../commands/PutConfigurationSetDeliveryOptionsCommand" ; import { PutConfigurationSetReputationOptionsCommandInput , PutConfigurationSetReputationOptionsCommandOutput , } from "../commands/PutConfigurationSetReputationOptionsCommand" ; import { PutConfigurationSetSendingOptionsCommandInput , PutConfigurationSetSendingOptionsCommandOutput , } from "../commands/PutConfigurationSetSendingOptionsCommand" ; import { PutConfigurationSetSuppressionOptionsCommandInput , PutConfigurationSetSuppressionOptionsCommandOutput , } from "../commands/PutConfigurationSetSuppressionOptionsCommand" ; import { PutConfigurationSetTrackingOptionsCommandInput , PutConfigurationSetTrackingOptionsCommandOutput , } from "../commands/PutConfigurationSetTrackingOptionsCommand" ; import { PutDedicatedIpInPoolCommandInput , PutDedicatedIpInPoolCommandOutput , } from "../commands/PutDedicatedIpInPoolCommand" ; import { PutDedicatedIpWarmupAttributesCommandInput , PutDedicatedIpWarmupAttributesCommandOutput , } from "../commands/PutDedicatedIpWarmupAttributesCommand" ; import { PutDeliverabilityDashboardOptionCommandInput , PutDeliverabilityDashboardOptionCommandOutput , } from "../commands/PutDeliverabilityDashboardOptionCommand" ; import { PutEmailIdentityConfigurationSetAttributesCommandInput , PutEmailIdentityConfigurationSetAttributesCommandOutput , } from "../commands/PutEmailIdentityConfigurationSetAttributesCommand" ; import { PutEmailIdentityDkimAttributesCommandInput , PutEmailIdentityDkimAttributesCommandOutput , } from "../commands/PutEmailIdentityDkimAttributesCommand" ; import { PutEmailIdentityDkimSigningAttributesCommandInput , PutEmailIdentityDkimSigningAttributesCommandOutput , } from "../commands/PutEmailIdentityDkimSigningAttributesCommand" ; import { PutEmailIdentityFeedbackAttributesCommandInput , PutEmailIdentityFeedbackAttributesCommandOutput , } from "../commands/PutEmailIdentityFeedbackAttributesCommand" ; import { PutEmailIdentityMailFromAttributesCommandInput , PutEmailIdentityMailFromAttributesCommandOutput , } from "../commands/PutEmailIdentityMailFromAttributesCommand" ; import { PutSuppressedDestinationCommandInput , PutSuppressedDestinationCommandOutput , } from "../commands/PutSuppressedDestinationCommand" ; import { SendBulkEmailCommandInput , SendBulkEmailCommandOutput } from "../commands/SendBulkEmailCommand" ; import { SendCustomVerificationEmailCommandInput , SendCustomVerificationEmailCommandOutput , } from "../commands/SendCustomVerificationEmailCommand" ; import { SendEmailCommandInput , SendEmailCommandOutput } from "../commands/SendEmailCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { TestRenderEmailTemplateCommandInput , TestRenderEmailTemplateCommandOutput , } from "../commands/TestRenderEmailTemplateCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateConfigurationSetEventDestinationCommandInput , UpdateConfigurationSetEventDestinationCommandOutput , } from "../commands/UpdateConfigurationSetEventDestinationCommand" ; import { UpdateContactCommandInput , UpdateContactCommandOutput } from "../commands/UpdateContactCommand" ; import { UpdateContactListCommandInput , UpdateContactListCommandOutput } from "../commands/UpdateContactListCommand" ; import { UpdateCustomVerificationEmailTemplateCommandInput , UpdateCustomVerificationEmailTemplateCommandOutput , } from "../commands/UpdateCustomVerificationEmailTemplateCommand" ; import { UpdateEmailIdentityPolicyCommandInput , UpdateEmailIdentityPolicyCommandOutput , } from "../commands/UpdateEmailIdentityPolicyCommand" ; import { UpdateEmailTemplateCommandInput , UpdateEmailTemplateCommandOutput , } from "../commands/UpdateEmailTemplateCommand" ; import { AccountDetails , AccountSuspendedException , AlreadyExistsException , BadRequestException , BlacklistEntry , Body , BulkEmailContent , BulkEmailEntry , BulkEmailEntryResult , CloudWatchDestination , CloudWatchDimensionConfiguration , ConcurrentModificationException , ConflictException , Contact , ContactList , ContactListDestination , Content , CustomVerificationEmailTemplateMetadata , DailyVolume , DedicatedIp , DeliverabilityTestReport , DeliveryOptions , Destination , DkimAttributes , DkimSigningAttributes , DomainDeliverabilityCampaign , DomainDeliverabilityTrackingOption , DomainIspPlacement , EmailContent , EmailTemplateContent , EmailTemplateMetadata , EventDestination , EventDestinationDefinition , EventType , FailureInfo , IdentityInfo , ImportDataSource , ImportDestination , ImportJobSummary , InboxPlacementTrackingOption , InvalidNextTokenException , IspPlacement , KinesisFirehoseDestination , LimitExceededException , ListContactsFilter , ListManagementOptions , MailFromAttributes , MailFromDomainNotVerifiedException , Message , MessageRejected , MessageTag , NotFoundException , OverallVolume , PinpointDestination , PlacementStatistics , RawMessage , ReplacementEmailContent , ReplacementTemplate , ReputationOptions , ReviewDetails , SendingOptions , SendingPausedException , SendQuota , SnsDestination , SuppressedDestination , SuppressedDestinationAttributes , SuppressedDestinationSummary , SuppressionAttributes , SuppressionListDestination , SuppressionListReason , SuppressionOptions , Tag , Template , TooManyRequestsException , Topic , TopicFilter , TopicPreference , TrackingOptions , VolumeStatistics , } from "../models/models_0" ; export const serializeAws_restJson1CreateConfigurationSetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets" ; let body ; body = JSON . stringify ( { ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , ... ( input . DeliveryOptions !== undefined && input . DeliveryOptions !== null && { DeliveryOptions : serializeAws_restJson1DeliveryOptions ( input . DeliveryOptions , context ) , } ) , ... ( input . ReputationOptions !== undefined && input . ReputationOptions !== null && { ReputationOptions : serializeAws_restJson1ReputationOptions ( input . ReputationOptions , context ) , } ) , ... ( input . SendingOptions !== undefined && input . SendingOptions !== null && { SendingOptions : serializeAws_restJson1SendingOptions ( input . SendingOptions , context ) , } ) , ... ( input . SuppressionOptions !== undefined && input . SuppressionOptions !== null && { SuppressionOptions : serializeAws_restJson1SuppressionOptions ( input . SuppressionOptions , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . TrackingOptions !== undefined && input . TrackingOptions !== null && { TrackingOptions : serializeAws_restJson1TrackingOptions ( input . TrackingOptions , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . EventDestination !== undefined && input . EventDestination !== null && { EventDestination : serializeAws_restJson1EventDestinationDefinition ( input . EventDestination , context ) , } ) , ... ( input . EventDestinationName !== undefined && input . EventDestinationName !== null && { EventDestinationName : input . EventDestinationName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateContactCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}/contacts" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } let body ; body = JSON . stringify ( { ... ( input . AttributesData !== undefined && input . AttributesData !== null && { AttributesData : input . AttributesData } ) , ... ( input . EmailAddress !== undefined && input . EmailAddress !== null && { EmailAddress : input . EmailAddress } ) , ... ( input . TopicPreferences !== undefined && input . TopicPreferences !== null && { TopicPreferences : serializeAws_restJson1TopicPreferenceList ( input . TopicPreferences , context ) , } ) , ... ( input . UnsubscribeAll !== undefined && input . UnsubscribeAll !== null && { UnsubscribeAll : input . UnsubscribeAll } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateContactListCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists" ; let body ; body = JSON . stringify ( { ... ( input . ContactListName !== undefined && input . ContactListName !== null && { ContactListName : input . ContactListName } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . Topics !== undefined && input . Topics !== null && { Topics : serializeAws_restJson1Topics ( input . Topics , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateCustomVerificationEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/custom-verification-email-templates" ; let body ; body = JSON . stringify ( { ... ( input . FailureRedirectionURL !== undefined && input . FailureRedirectionURL !== null && { FailureRedirectionURL : input . FailureRedirectionURL } ) , ... ( input . FromEmailAddress !== undefined && input . FromEmailAddress !== null && { FromEmailAddress : input . FromEmailAddress } ) , ... ( input . SuccessRedirectionURL !== undefined && input . SuccessRedirectionURL !== null && { SuccessRedirectionURL : input . SuccessRedirectionURL } ) , ... ( input . TemplateContent !== undefined && input . TemplateContent !== null && { TemplateContent : input . TemplateContent } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , ... ( input . TemplateSubject !== undefined && input . TemplateSubject !== null && { TemplateSubject : input . TemplateSubject } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDedicatedIpPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ip-pools" ; let body ; body = JSON . stringify ( { ... ( input . PoolName !== undefined && input . PoolName !== null && { PoolName : input . PoolName } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDeliverabilityTestReportCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/test" ; let body ; body = JSON . stringify ( { ... ( input . Content !== undefined && input . Content !== null && { Content : serializeAws_restJson1EmailContent ( input . Content , context ) } ) , ... ( input . FromEmailAddress !== undefined && input . FromEmailAddress !== null && { FromEmailAddress : input . FromEmailAddress } ) , ... ( input . ReportName !== undefined && input . ReportName !== null && { ReportName : input . ReportName } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEmailIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities" ; let body ; body = JSON . stringify ( { ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , ... ( input . DkimSigningAttributes !== undefined && input . DkimSigningAttributes !== null && { DkimSigningAttributes : serializeAws_restJson1DkimSigningAttributes ( input . DkimSigningAttributes , context ) , } ) , ... ( input . EmailIdentity !== undefined && input . EmailIdentity !== null && { EmailIdentity : input . EmailIdentity } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEmailIdentityPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } if ( input . PolicyName !== undefined ) { const labelValue = input . PolicyName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyName." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Policy !== undefined && input . Policy !== null && { Policy : input . Policy } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates" ; let body ; body = JSON . stringify ( { ... ( input . TemplateContent !== undefined && input . TemplateContent !== null && { TemplateContent : serializeAws_restJson1EmailTemplateContent ( input . TemplateContent , context ) , } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateImportJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/import-jobs" ; let body ; body = JSON . stringify ( { ... ( input . ImportDataSource !== undefined && input . ImportDataSource !== null && { ImportDataSource : serializeAws_restJson1ImportDataSource ( input . ImportDataSource , context ) , } ) , ... ( input . ImportDestination !== undefined && input . ImportDestination !== null && { ImportDestination : serializeAws_restJson1ImportDestination ( input . ImportDestination , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } if ( input . EventDestinationName !== undefined ) { const labelValue = input . EventDestinationName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EventDestinationName." ) ; } resolvedPath = resolvedPath . replace ( "{EventDestinationName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EventDestinationName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteContactCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } if ( input . EmailAddress !== undefined ) { const labelValue = input . EmailAddress ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailAddress." ) ; } resolvedPath = resolvedPath . replace ( "{EmailAddress}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailAddress." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteContactListCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCustomVerificationEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/custom-verification-email-templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ip-pools/{PoolName}" ; if ( input . PoolName !== undefined ) { const labelValue = input . PoolName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PoolName." ) ; } resolvedPath = resolvedPath . replace ( "{PoolName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PoolName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEmailIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEmailIdentityPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } if ( input . PolicyName !== undefined ) { const labelValue = input . PolicyName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyName." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSuppressedDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/suppression/addresses/{EmailAddress}" ; if ( input . EmailAddress !== undefined ) { const labelValue = input . EmailAddress ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailAddress." ) ; } resolvedPath = resolvedPath . replace ( "{EmailAddress}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailAddress." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAccountCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/account" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBlacklistReportsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/blacklist-report" ; const query = { ... ( input . BlacklistItemNames !== undefined && { BlacklistItemNames : ( input . BlacklistItemNames || [ ] ) . map ( ( _entry ) => _entry as any ) , } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetConfigurationSetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetContactCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } if ( input . EmailAddress !== undefined ) { const labelValue = input . EmailAddress ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailAddress." ) ; } resolvedPath = resolvedPath . replace ( "{EmailAddress}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailAddress." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetContactListCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCustomVerificationEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/custom-verification-email-templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDedicatedIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ips/{Ip}" ; if ( input . Ip !== undefined ) { const labelValue = input . Ip ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Ip." ) ; } resolvedPath = resolvedPath . replace ( "{Ip}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Ip." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDedicatedIpsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ips" ; const query = { ... ( input . PoolName !== undefined && { PoolName : input . PoolName } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDeliverabilityDashboardOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDeliverabilityTestReportCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/test-reports/{ReportId}" ; if ( input . ReportId !== undefined ) { const labelValue = input . ReportId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ReportId." ) ; } resolvedPath = resolvedPath . replace ( "{ReportId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ReportId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/campaigns/{CampaignId}" ; if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDomainStatisticsReportCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/statistics-report/{Domain}" ; if ( input . Domain !== undefined ) { const labelValue = input . Domain ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Domain." ) ; } resolvedPath = resolvedPath . replace ( "{Domain}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Domain." ) ; } const query = { ... ( input . StartDate !== undefined && { StartDate : ( input . StartDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . EndDate !== undefined && { EndDate : ( input . EndDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetEmailIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEmailIdentityPoliciesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/policies" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetImportJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/import-jobs/{JobId}" ; if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSuppressedDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/suppression/addresses/{EmailAddress}" ; if ( input . EmailAddress !== undefined ) { const labelValue = input . EmailAddress ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailAddress." ) ; } resolvedPath = resolvedPath . replace ( "{EmailAddress}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailAddress." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListConfigurationSetsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListContactListsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists" ; const query = { ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListContactsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}/contacts" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } const query = { ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , } ; let body ; body = JSON . stringify ( { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_restJson1ListContactsFilter ( input . Filter , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListCustomVerificationEmailTemplatesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/custom-verification-email-templates" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDedicatedIpPoolsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ip-pools" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDeliverabilityTestReportsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/test-reports" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns" ; if ( input . SubscribedDomain !== undefined ) { const labelValue = input . SubscribedDomain ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SubscribedDomain." ) ; } resolvedPath = resolvedPath . replace ( "{SubscribedDomain}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SubscribedDomain." ) ; } const query = { ... ( input . StartDate !== undefined && { StartDate : ( input . StartDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . EndDate !== undefined && { EndDate : ( input . EndDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListEmailIdentitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListEmailTemplatesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListImportJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/import-jobs" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; body = JSON . stringify ( { ... ( input . ImportDestinationType !== undefined && input . ImportDestinationType !== null && { ImportDestinationType : input . ImportDestinationType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListSuppressedDestinationsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/suppression/addresses" ; const query = { ... ( input . Reasons !== undefined && { Reason : ( input . Reasons || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , ... ( input . StartDate !== undefined && { StartDate : ( input . StartDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . EndDate !== undefined && { EndDate : ( input . EndDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . PageSize !== undefined && { PageSize : input . PageSize . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/tags" ; const query = { ... ( input . ResourceArn !== undefined && { ResourceArn : input . ResourceArn } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/account/dedicated-ips/warmup" ; let body ; body = JSON . stringify ( { ... ( input . AutoWarmupEnabled !== undefined && input . AutoWarmupEnabled !== null && { AutoWarmupEnabled : input . AutoWarmupEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutAccountDetailsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/account/details" ; let body ; body = JSON . stringify ( { ... ( input . AdditionalContactEmailAddresses !== undefined && input . AdditionalContactEmailAddresses !== null && { AdditionalContactEmailAddresses : serializeAws_restJson1AdditionalContactEmailAddresses ( input . AdditionalContactEmailAddresses , context ) , } ) , ... ( input . ContactLanguage !== undefined && input . ContactLanguage !== null && { ContactLanguage : input . ContactLanguage } ) , ... ( input . MailType !== undefined && input . MailType !== null && { MailType : input . MailType } ) , ... ( input . ProductionAccessEnabled !== undefined && input . ProductionAccessEnabled !== null && { ProductionAccessEnabled : input . ProductionAccessEnabled } ) , ... ( input . UseCaseDescription !== undefined && input . UseCaseDescription !== null && { UseCaseDescription : input . UseCaseDescription } ) , ... ( input . WebsiteURL !== undefined && input . WebsiteURL !== null && { WebsiteURL : input . WebsiteURL } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutAccountSendingAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/account/sending" ; let body ; body = JSON . stringify ( { ... ( input . SendingEnabled !== undefined && input . SendingEnabled !== null && { SendingEnabled : input . SendingEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutAccountSuppressionAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/account/suppression" ; let body ; body = JSON . stringify ( { ... ( input . SuppressedReasons !== undefined && input . SuppressedReasons !== null && { SuppressedReasons : serializeAws_restJson1SuppressionListReasons ( input . SuppressedReasons , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/delivery-options" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . SendingPoolName !== undefined && input . SendingPoolName !== null && { SendingPoolName : input . SendingPoolName } ) , ... ( input . TlsPolicy !== undefined && input . TlsPolicy !== null && { TlsPolicy : input . TlsPolicy } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/reputation-options" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . ReputationMetricsEnabled !== undefined && input . ReputationMetricsEnabled !== null && { ReputationMetricsEnabled : input . ReputationMetricsEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/sending" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . SendingEnabled !== undefined && input . SendingEnabled !== null && { SendingEnabled : input . SendingEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutConfigurationSetSuppressionOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/suppression-options" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . SuppressedReasons !== undefined && input . SuppressedReasons !== null && { SuppressedReasons : serializeAws_restJson1SuppressionListReasons ( input . SuppressedReasons , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/tracking-options" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } let body ; body = JSON . stringify ( { ... ( input . CustomRedirectDomain !== undefined && input . CustomRedirectDomain !== null && { CustomRedirectDomain : input . CustomRedirectDomain } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutDedicatedIpInPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ips/{Ip}/pool" ; if ( input . Ip !== undefined ) { const labelValue = input . Ip ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Ip." ) ; } resolvedPath = resolvedPath . replace ( "{Ip}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Ip." ) ; } let body ; body = JSON . stringify ( { ... ( input . DestinationPoolName !== undefined && input . DestinationPoolName !== null && { DestinationPoolName : input . DestinationPoolName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/dedicated-ips/{Ip}/warmup" ; if ( input . Ip !== undefined ) { const labelValue = input . Ip ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Ip." ) ; } resolvedPath = resolvedPath . replace ( "{Ip}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Ip." ) ; } let body ; body = JSON . stringify ( { ... ( input . WarmupPercentage !== undefined && input . WarmupPercentage !== null && { WarmupPercentage : input . WarmupPercentage } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutDeliverabilityDashboardOptionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/deliverability-dashboard" ; let body ; body = JSON . stringify ( { ... ( input . DashboardEnabled !== undefined && input . DashboardEnabled !== null && { DashboardEnabled : input . DashboardEnabled } ) , ... ( input . SubscribedDomains !== undefined && input . SubscribedDomains !== null && { SubscribedDomains : serializeAws_restJson1DomainDeliverabilityTrackingOptions ( input . SubscribedDomains , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEmailIdentityConfigurationSetAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/configuration-set" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; body = JSON . stringify ( { ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/dkim" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; body = JSON . stringify ( { ... ( input . SigningEnabled !== undefined && input . SigningEnabled !== null && { SigningEnabled : input . SigningEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEmailIdentityDkimSigningAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/email/identities/{EmailIdentity}/dkim/signing" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; body = JSON . stringify ( { ... ( input . SigningAttributes !== undefined && input . SigningAttributes !== null && { SigningAttributes : serializeAws_restJson1DkimSigningAttributes ( input . SigningAttributes , context ) , } ) , ... ( input . SigningAttributesOrigin !== undefined && input . SigningAttributesOrigin !== null && { SigningAttributesOrigin : input . SigningAttributesOrigin } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/feedback" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; body = JSON . stringify ( { ... ( input . EmailForwardingEnabled !== undefined && input . EmailForwardingEnabled !== null && { EmailForwardingEnabled : input . EmailForwardingEnabled } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/mail-from" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } let body ; body = JSON . stringify ( { ... ( input . BehaviorOnMxFailure !== undefined && input . BehaviorOnMxFailure !== null && { BehaviorOnMxFailure : input . BehaviorOnMxFailure } ) , ... ( input . MailFromDomain !== undefined && input . MailFromDomain !== null && { MailFromDomain : input . MailFromDomain } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutSuppressedDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/suppression/addresses" ; let body ; body = JSON . stringify ( { ... ( input . EmailAddress !== undefined && input . EmailAddress !== null && { EmailAddress : input . EmailAddress } ) , ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendBulkEmailCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/outbound-bulk-emails" ; let body ; body = JSON . stringify ( { ... ( input . BulkEmailEntries !== undefined && input . BulkEmailEntries !== null && { BulkEmailEntries : serializeAws_restJson1BulkEmailEntryList ( input . BulkEmailEntries , context ) , } ) , ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , ... ( input . DefaultContent !== undefined && input . DefaultContent !== null && { DefaultContent : serializeAws_restJson1BulkEmailContent ( input . DefaultContent , context ) , } ) , ... ( input . DefaultEmailTags !== undefined && input . DefaultEmailTags !== null && { DefaultEmailTags : serializeAws_restJson1MessageTagList ( input . DefaultEmailTags , context ) , } ) , ... ( input . FeedbackForwardingEmailAddress !== undefined && input . FeedbackForwardingEmailAddress !== null && { FeedbackForwardingEmailAddress : input . FeedbackForwardingEmailAddress , } ) , ... ( input . FeedbackForwardingEmailAddressIdentityArn !== undefined && input . FeedbackForwardingEmailAddressIdentityArn !== null && { FeedbackForwardingEmailAddressIdentityArn : input . FeedbackForwardingEmailAddressIdentityArn , } ) , ... ( input . FromEmailAddress !== undefined && input . FromEmailAddress !== null && { FromEmailAddress : input . FromEmailAddress } ) , ... ( input . FromEmailAddressIdentityArn !== undefined && input . FromEmailAddressIdentityArn !== null && { FromEmailAddressIdentityArn : input . FromEmailAddressIdentityArn } ) , ... ( input . ReplyToAddresses !== undefined && input . ReplyToAddresses !== null && { ReplyToAddresses : serializeAws_restJson1EmailAddressList ( input . ReplyToAddresses , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendCustomVerificationEmailCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/outbound-custom-verification-emails" ; let body ; body = JSON . stringify ( { ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , ... ( input . EmailAddress !== undefined && input . EmailAddress !== null && { EmailAddress : input . EmailAddress } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendEmailCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/outbound-emails" ; let body ; body = JSON . stringify ( { ... ( input . ConfigurationSetName !== undefined && input . ConfigurationSetName !== null && { ConfigurationSetName : input . ConfigurationSetName } ) , ... ( input . Content !== undefined && input . Content !== null && { Content : serializeAws_restJson1EmailContent ( input . Content , context ) } ) , ... ( input . Destination !== undefined && input . Destination !== null && { Destination : serializeAws_restJson1Destination ( input . Destination , context ) } ) , ... ( input . EmailTags !== undefined && input . EmailTags !== null && { EmailTags : serializeAws_restJson1MessageTagList ( input . EmailTags , context ) } ) , ... ( input . FeedbackForwardingEmailAddress !== undefined && input . FeedbackForwardingEmailAddress !== null && { FeedbackForwardingEmailAddress : input . FeedbackForwardingEmailAddress , } ) , ... ( input . FeedbackForwardingEmailAddressIdentityArn !== undefined && input . FeedbackForwardingEmailAddressIdentityArn !== null && { FeedbackForwardingEmailAddressIdentityArn : input . FeedbackForwardingEmailAddressIdentityArn , } ) , ... ( input . FromEmailAddress !== undefined && input . FromEmailAddress !== null && { FromEmailAddress : input . FromEmailAddress } ) , ... ( input . FromEmailAddressIdentityArn !== undefined && input . FromEmailAddressIdentityArn !== null && { FromEmailAddressIdentityArn : input . FromEmailAddressIdentityArn } ) , ... ( input . ListManagementOptions !== undefined && input . ListManagementOptions !== null && { ListManagementOptions : serializeAws_restJson1ListManagementOptions ( input . ListManagementOptions , context ) , } ) , ... ( input . ReplyToAddresses !== undefined && input . ReplyToAddresses !== null && { ReplyToAddresses : serializeAws_restJson1EmailAddressList ( input . ReplyToAddresses , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/tags" ; let body ; body = JSON . stringify ( { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TestRenderEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates/{TemplateName}/render" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; body = JSON . stringify ( { ... ( input . TemplateData !== undefined && input . TemplateData !== null && { TemplateData : input . TemplateData } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/tags" ; const query = { ... ( input . ResourceArn !== undefined && { ResourceArn : input . ResourceArn } ) , ... ( input . TagKeys !== undefined && { TagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}" ; if ( input . ConfigurationSetName !== undefined ) { const labelValue = input . ConfigurationSetName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConfigurationSetName." ) ; } resolvedPath = resolvedPath . replace ( "{ConfigurationSetName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConfigurationSetName." ) ; } if ( input . EventDestinationName !== undefined ) { const labelValue = input . EventDestinationName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EventDestinationName." ) ; } resolvedPath = resolvedPath . replace ( "{EventDestinationName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EventDestinationName." ) ; } let body ; body = JSON . stringify ( { ... ( input . EventDestination !== undefined && input . EventDestination !== null && { EventDestination : serializeAws_restJson1EventDestinationDefinition ( input . EventDestination , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateContactCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } if ( input . EmailAddress !== undefined ) { const labelValue = input . EmailAddress ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailAddress." ) ; } resolvedPath = resolvedPath . replace ( "{EmailAddress}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailAddress." ) ; } let body ; body = JSON . stringify ( { ... ( input . AttributesData !== undefined && input . AttributesData !== null && { AttributesData : input . AttributesData } ) , ... ( input . TopicPreferences !== undefined && input . TopicPreferences !== null && { TopicPreferences : serializeAws_restJson1TopicPreferenceList ( input . TopicPreferences , context ) , } ) , ... ( input . UnsubscribeAll !== undefined && input . UnsubscribeAll !== null && { UnsubscribeAll : input . UnsubscribeAll } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateContactListCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/contact-lists/{ContactListName}" ; if ( input . ContactListName !== undefined ) { const labelValue = input . ContactListName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ContactListName." ) ; } resolvedPath = resolvedPath . replace ( "{ContactListName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ContactListName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Topics !== undefined && input . Topics !== null && { Topics : serializeAws_restJson1Topics ( input . Topics , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateCustomVerificationEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/custom-verification-email-templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; body = JSON . stringify ( { ... ( input . FailureRedirectionURL !== undefined && input . FailureRedirectionURL !== null && { FailureRedirectionURL : input . FailureRedirectionURL } ) , ... ( input . FromEmailAddress !== undefined && input . FromEmailAddress !== null && { FromEmailAddress : input . FromEmailAddress } ) , ... ( input . SuccessRedirectionURL !== undefined && input . SuccessRedirectionURL !== null && { SuccessRedirectionURL : input . SuccessRedirectionURL } ) , ... ( input . TemplateContent !== undefined && input . TemplateContent !== null && { TemplateContent : input . TemplateContent } ) , ... ( input . TemplateSubject !== undefined && input . TemplateSubject !== null && { TemplateSubject : input . TemplateSubject } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEmailIdentityPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}" ; if ( input . EmailIdentity !== undefined ) { const labelValue = input . EmailIdentity ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EmailIdentity." ) ; } resolvedPath = resolvedPath . replace ( "{EmailIdentity}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EmailIdentity." ) ; } if ( input . PolicyName !== undefined ) { const labelValue = input . PolicyName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: PolicyName." ) ; } resolvedPath = resolvedPath . replace ( "{PolicyName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: PolicyName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Policy !== undefined && input . Policy !== null && { Policy : input . Policy } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEmailTemplateCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v2/email/templates/{TemplateName}" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; body = JSON . stringify ( { ... ( input . TemplateContent !== undefined && input . TemplateContent !== null && { TemplateContent : serializeAws_restJson1EmailTemplateContent ( input . TemplateContent , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateConfigurationSetCommand = async ( output , context ) : Promise < CreateConfigurationSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateConfigurationSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateConfigurationSetCommandError = async ( output , context ) : Promise < CreateConfigurationSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateConfigurationSetEventDestinationCommand = async ( output , context ) : Promise < CreateConfigurationSetEventDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError = async ( output , context ) : Promise < CreateConfigurationSetEventDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateContactCommand = async ( output , context ) : Promise < CreateContactCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateContactCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateContactCommandError = async ( output , context ) : Promise < CreateContactCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateContactListCommand = async ( output , context ) : Promise < CreateContactListCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateContactListCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateContactListCommandError = async ( output , context ) : Promise < CreateContactListCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateCustomVerificationEmailTemplateCommand = async ( output , context ) : Promise < CreateCustomVerificationEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCustomVerificationEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCustomVerificationEmailTemplateCommandError = async ( output , context ) : Promise < CreateCustomVerificationEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateDedicatedIpPoolCommand = async ( output , context ) : Promise < CreateDedicatedIpPoolCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDedicatedIpPoolCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDedicatedIpPoolCommandError = async ( output , context ) : Promise < CreateDedicatedIpPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateDeliverabilityTestReportCommand = async ( output , context ) : Promise < CreateDeliverabilityTestReportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDeliverabilityTestReportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DeliverabilityTestStatus : undefined , ReportId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DeliverabilityTestStatus !== undefined && data . DeliverabilityTestStatus !== null ) { contents . DeliverabilityTestStatus = __expectString ( data . DeliverabilityTestStatus ) ; } if ( data . ReportId !== undefined && data . ReportId !== null ) { contents . ReportId = __expectString ( data . ReportId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDeliverabilityTestReportCommandError = async ( output , context ) : Promise < CreateDeliverabilityTestReportCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccountSuspendedException" : case "com.amazonaws.sesv2#AccountSuspendedException" : response = { ... ( await deserializeAws_restJson1AccountSuspendedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MailFromDomainNotVerifiedException" : case "com.amazonaws.sesv2#MailFromDomainNotVerifiedException" : response = { ... ( await deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MessageRejected" : case "com.amazonaws.sesv2#MessageRejected" : response = { ... ( await deserializeAws_restJson1MessageRejectedResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SendingPausedException" : case "com.amazonaws.sesv2#SendingPausedException" : response = { ... ( await deserializeAws_restJson1SendingPausedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateEmailIdentityCommand = async ( output , context ) : Promise < CreateEmailIdentityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEmailIdentityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DkimAttributes : undefined , IdentityType : undefined , VerifiedForSendingStatus : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DkimAttributes !== undefined && data . DkimAttributes !== null ) { contents . DkimAttributes = deserializeAws_restJson1DkimAttributes ( data . DkimAttributes , context ) ; } if ( data . IdentityType !== undefined && data . IdentityType !== null ) { contents . IdentityType = __expectString ( data . IdentityType ) ; } if ( data . VerifiedForSendingStatus !== undefined && data . VerifiedForSendingStatus !== null ) { contents . VerifiedForSendingStatus = __expectBoolean ( data . VerifiedForSendingStatus ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEmailIdentityCommandError = async ( output , context ) : Promise < CreateEmailIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateEmailIdentityPolicyCommand = async ( output , context ) : Promise < CreateEmailIdentityPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEmailIdentityPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEmailIdentityPolicyCommandError = async ( output , context ) : Promise < CreateEmailIdentityPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateEmailTemplateCommand = async ( output , context ) : Promise < CreateEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEmailTemplateCommandError = async ( output , context ) : Promise < CreateEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateImportJobCommand = async ( output , context ) : Promise < CreateImportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateImportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JobId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . JobId !== undefined && data . JobId !== null ) { contents . JobId = __expectString ( data . JobId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateImportJobCommandError = async ( output , context ) : Promise < CreateImportJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteConfigurationSetCommand = async ( output , context ) : Promise < DeleteConfigurationSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteConfigurationSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteConfigurationSetCommandError = async ( output , context ) : Promise < DeleteConfigurationSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteConfigurationSetEventDestinationCommand = async ( output , context ) : Promise < DeleteConfigurationSetEventDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError = async ( output , context ) : Promise < DeleteConfigurationSetEventDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteContactCommand = async ( output , context ) : Promise < DeleteContactCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteContactCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteContactCommandError = async ( output , context ) : Promise < DeleteContactCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteContactListCommand = async ( output , context ) : Promise < DeleteContactListCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteContactListCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteContactListCommandError = async ( output , context ) : Promise < DeleteContactListCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteCustomVerificationEmailTemplateCommand = async ( output , context ) : Promise < DeleteCustomVerificationEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCustomVerificationEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCustomVerificationEmailTemplateCommandError = async ( output , context ) : Promise < DeleteCustomVerificationEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteDedicatedIpPoolCommand = async ( output , context ) : Promise < DeleteDedicatedIpPoolCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDedicatedIpPoolCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDedicatedIpPoolCommandError = async ( output , context ) : Promise < DeleteDedicatedIpPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEmailIdentityCommand = async ( output , context ) : Promise < DeleteEmailIdentityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEmailIdentityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEmailIdentityCommandError = async ( output , context ) : Promise < DeleteEmailIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEmailIdentityPolicyCommand = async ( output , context ) : Promise < DeleteEmailIdentityPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEmailIdentityPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEmailIdentityPolicyCommandError = async ( output , context ) : Promise < DeleteEmailIdentityPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEmailTemplateCommand = async ( output , context ) : Promise < DeleteEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEmailTemplateCommandError = async ( output , context ) : Promise < DeleteEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteSuppressedDestinationCommand = async ( output , context ) : Promise < DeleteSuppressedDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSuppressedDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSuppressedDestinationCommandError = async ( output , context ) : Promise < DeleteSuppressedDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetAccountCommand = async ( output , context ) : Promise < GetAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DedicatedIpAutoWarmupEnabled : undefined , Details : undefined , EnforcementStatus : undefined , ProductionAccessEnabled : undefined , SendQuota : undefined , SendingEnabled : undefined , SuppressionAttributes : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DedicatedIpAutoWarmupEnabled !== undefined && data . DedicatedIpAutoWarmupEnabled !== null ) { contents . DedicatedIpAutoWarmupEnabled = __expectBoolean ( data . DedicatedIpAutoWarmupEnabled ) ; } if ( data . Details !== undefined && data . Details !== null ) { contents . Details = deserializeAws_restJson1AccountDetails ( data . Details , context ) ; } if ( data . EnforcementStatus !== undefined && data . EnforcementStatus !== null ) { contents . EnforcementStatus = __expectString ( data . EnforcementStatus ) ; } if ( data . ProductionAccessEnabled !== undefined && data . ProductionAccessEnabled !== null ) { contents . ProductionAccessEnabled = __expectBoolean ( data . ProductionAccessEnabled ) ; } if ( data . SendQuota !== undefined && data . SendQuota !== null ) { contents . SendQuota = deserializeAws_restJson1SendQuota ( data . SendQuota , context ) ; } if ( data . SendingEnabled !== undefined && data . SendingEnabled !== null ) { contents . SendingEnabled = __expectBoolean ( data . SendingEnabled ) ; } if ( data . SuppressionAttributes !== undefined && data . SuppressionAttributes !== null ) { contents . SuppressionAttributes = deserializeAws_restJson1SuppressionAttributes ( data . SuppressionAttributes , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAccountCommandError = async ( output , context ) : Promise < GetAccountCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetBlacklistReportsCommand = async ( output , context ) : Promise < GetBlacklistReportsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBlacklistReportsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BlacklistReport : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BlacklistReport !== undefined && data . BlacklistReport !== null ) { contents . BlacklistReport = deserializeAws_restJson1BlacklistReport ( data . BlacklistReport , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBlacklistReportsCommandError = async ( output , context ) : Promise < GetBlacklistReportsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetConfigurationSetCommand = async ( output , context ) : Promise < GetConfigurationSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConfigurationSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConfigurationSetName : undefined , DeliveryOptions : undefined , ReputationOptions : undefined , SendingOptions : undefined , SuppressionOptions : undefined , Tags : undefined , TrackingOptions : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConfigurationSetName !== undefined && data . ConfigurationSetName !== null ) { contents . ConfigurationSetName = __expectString ( data . ConfigurationSetName ) ; } if ( data . DeliveryOptions !== undefined && data . DeliveryOptions !== null ) { contents . DeliveryOptions = deserializeAws_restJson1DeliveryOptions ( data . DeliveryOptions , context ) ; } if ( data . ReputationOptions !== undefined && data . ReputationOptions !== null ) { contents . ReputationOptions = deserializeAws_restJson1ReputationOptions ( data . ReputationOptions , context ) ; } if ( data . SendingOptions !== undefined && data . SendingOptions !== null ) { contents . SendingOptions = deserializeAws_restJson1SendingOptions ( data . SendingOptions , context ) ; } if ( data . SuppressionOptions !== undefined && data . SuppressionOptions !== null ) { contents . SuppressionOptions = deserializeAws_restJson1SuppressionOptions ( data . SuppressionOptions , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagList ( data . Tags , context ) ; } if ( data . TrackingOptions !== undefined && data . TrackingOptions !== null ) { contents . TrackingOptions = deserializeAws_restJson1TrackingOptions ( data . TrackingOptions , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConfigurationSetCommandError = async ( output , context ) : Promise < GetConfigurationSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetConfigurationSetEventDestinationsCommand = async ( output , context ) : Promise < GetConfigurationSetEventDestinationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventDestinations : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . EventDestinations !== undefined && data . EventDestinations !== null ) { contents . EventDestinations = deserializeAws_restJson1EventDestinations ( data . EventDestinations , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError = async ( output , context ) : Promise < GetConfigurationSetEventDestinationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetContactCommand = async ( output , context ) : Promise < GetContactCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetContactCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AttributesData : undefined , ContactListName : undefined , CreatedTimestamp : undefined , EmailAddress : undefined , LastUpdatedTimestamp : undefined , TopicDefaultPreferences : undefined , TopicPreferences : undefined , UnsubscribeAll : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AttributesData !== undefined && data . AttributesData !== null ) { contents . AttributesData = __expectString ( data . AttributesData ) ; } if ( data . ContactListName !== undefined && data . ContactListName !== null ) { contents . ContactListName = __expectString ( data . ContactListName ) ; } if ( data . CreatedTimestamp !== undefined && data . CreatedTimestamp !== null ) { contents . CreatedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTimestamp ) ) ) ; } if ( data . EmailAddress !== undefined && data . EmailAddress !== null ) { contents . EmailAddress = __expectString ( data . EmailAddress ) ; } if ( data . LastUpdatedTimestamp !== undefined && data . LastUpdatedTimestamp !== null ) { contents . LastUpdatedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTimestamp ) ) ) ; } if ( data . TopicDefaultPreferences !== undefined && data . TopicDefaultPreferences !== null ) { contents . TopicDefaultPreferences = deserializeAws_restJson1TopicPreferenceList ( data . TopicDefaultPreferences , context ) ; } if ( data . TopicPreferences !== undefined && data . TopicPreferences !== null ) { contents . TopicPreferences = deserializeAws_restJson1TopicPreferenceList ( data . TopicPreferences , context ) ; } if ( data . UnsubscribeAll !== undefined && data . UnsubscribeAll !== null ) { contents . UnsubscribeAll = __expectBoolean ( data . UnsubscribeAll ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetContactCommandError = async ( output , context ) : Promise < GetContactCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetContactListCommand = async ( output , context ) : Promise < GetContactListCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetContactListCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ContactListName : undefined , CreatedTimestamp : undefined , Description : undefined , LastUpdatedTimestamp : undefined , Tags : undefined , Topics : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ContactListName !== undefined && data . ContactListName !== null ) { contents . ContactListName = __expectString ( data . ContactListName ) ; } if ( data . CreatedTimestamp !== undefined && data . CreatedTimestamp !== null ) { contents . CreatedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTimestamp ) ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . LastUpdatedTimestamp !== undefined && data . LastUpdatedTimestamp !== null ) { contents . LastUpdatedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . LastUpdatedTimestamp ) ) ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagList ( data . Tags , context ) ; } if ( data . Topics !== undefined && data . Topics !== null ) { contents . Topics = deserializeAws_restJson1Topics ( data . Topics , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetContactListCommandError = async ( output , context ) : Promise < GetContactListCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCustomVerificationEmailTemplateCommand = async ( output , context ) : Promise < GetCustomVerificationEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCustomVerificationEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FailureRedirectionURL : undefined , FromEmailAddress : undefined , SuccessRedirectionURL : undefined , TemplateContent : undefined , TemplateName : undefined , TemplateSubject : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . FailureRedirectionURL !== undefined && data . FailureRedirectionURL !== null ) { contents . FailureRedirectionURL = __expectString ( data . FailureRedirectionURL ) ; } if ( data . FromEmailAddress !== undefined && data . FromEmailAddress !== null ) { contents . FromEmailAddress = __expectString ( data . FromEmailAddress ) ; } if ( data . SuccessRedirectionURL !== undefined && data . SuccessRedirectionURL !== null ) { contents . SuccessRedirectionURL = __expectString ( data . SuccessRedirectionURL ) ; } if ( data . TemplateContent !== undefined && data . TemplateContent !== null ) { contents . TemplateContent = __expectString ( data . TemplateContent ) ; } if ( data . TemplateName !== undefined && data . TemplateName !== null ) { contents . TemplateName = __expectString ( data . TemplateName ) ; } if ( data . TemplateSubject !== undefined && data . TemplateSubject !== null ) { contents . TemplateSubject = __expectString ( data . TemplateSubject ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCustomVerificationEmailTemplateCommandError = async ( output , context ) : Promise < GetCustomVerificationEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDedicatedIpCommand = async ( output , context ) : Promise < GetDedicatedIpCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDedicatedIpCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DedicatedIp : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DedicatedIp !== undefined && data . DedicatedIp !== null ) { contents . DedicatedIp = deserializeAws_restJson1DedicatedIp ( data . DedicatedIp , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDedicatedIpCommandError = async ( output , context ) : Promise < GetDedicatedIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDedicatedIpsCommand = async ( output , context ) : Promise < GetDedicatedIpsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDedicatedIpsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DedicatedIps : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DedicatedIps !== undefined && data . DedicatedIps !== null ) { contents . DedicatedIps = deserializeAws_restJson1DedicatedIpList ( data . DedicatedIps , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDedicatedIpsCommandError = async ( output , context ) : Promise < GetDedicatedIpsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDeliverabilityDashboardOptionsCommand = async ( output , context ) : Promise < GetDeliverabilityDashboardOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AccountStatus : undefined , ActiveSubscribedDomains : undefined , DashboardEnabled : undefined , PendingExpirationSubscribedDomains : undefined , SubscriptionExpiryDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AccountStatus !== undefined && data . AccountStatus !== null ) { contents . AccountStatus = __expectString ( data . AccountStatus ) ; } if ( data . ActiveSubscribedDomains !== undefined && data . ActiveSubscribedDomains !== null ) { contents . ActiveSubscribedDomains = deserializeAws_restJson1DomainDeliverabilityTrackingOptions ( data . ActiveSubscribedDomains , context ) ; } if ( data . DashboardEnabled !== undefined && data . DashboardEnabled !== null ) { contents . DashboardEnabled = __expectBoolean ( data . DashboardEnabled ) ; } if ( data . PendingExpirationSubscribedDomains !== undefined && data . PendingExpirationSubscribedDomains !== null ) { contents . PendingExpirationSubscribedDomains = deserializeAws_restJson1DomainDeliverabilityTrackingOptions ( data . PendingExpirationSubscribedDomains , context ) ; } if ( data . SubscriptionExpiryDate !== undefined && data . SubscriptionExpiryDate !== null ) { contents . SubscriptionExpiryDate = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . SubscriptionExpiryDate ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError = async ( output , context ) : Promise < GetDeliverabilityDashboardOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDeliverabilityTestReportCommand = async ( output , context ) : Promise < GetDeliverabilityTestReportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDeliverabilityTestReportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DeliverabilityTestReport : undefined , IspPlacements : undefined , Message : undefined , OverallPlacement : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DeliverabilityTestReport !== undefined && data . DeliverabilityTestReport !== null ) { contents . DeliverabilityTestReport = deserializeAws_restJson1DeliverabilityTestReport ( data . DeliverabilityTestReport , context ) ; } if ( data . IspPlacements !== undefined && data . IspPlacements !== null ) { contents . IspPlacements = deserializeAws_restJson1IspPlacements ( data . IspPlacements , context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . OverallPlacement !== undefined && data . OverallPlacement !== null ) { contents . OverallPlacement = deserializeAws_restJson1PlacementStatistics ( data . OverallPlacement , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagList ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDeliverabilityTestReportCommandError = async ( output , context ) : Promise < GetDeliverabilityTestReportCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDomainDeliverabilityCampaignCommand = async ( output , context ) : Promise < GetDomainDeliverabilityCampaignCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DomainDeliverabilityCampaign : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DomainDeliverabilityCampaign !== undefined && data . DomainDeliverabilityCampaign !== null ) { contents . DomainDeliverabilityCampaign = deserializeAws_restJson1DomainDeliverabilityCampaign ( data . DomainDeliverabilityCampaign , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError = async ( output , context ) : Promise < GetDomainDeliverabilityCampaignCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDomainStatisticsReportCommand = async ( output , context ) : Promise < GetDomainStatisticsReportCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDomainStatisticsReportCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DailyVolumes : undefined , OverallVolume : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DailyVolumes !== undefined && data . DailyVolumes !== null ) { contents . DailyVolumes = deserializeAws_restJson1DailyVolumes ( data . DailyVolumes , context ) ; } if ( data . OverallVolume !== undefined && data . OverallVolume !== null ) { contents . OverallVolume = deserializeAws_restJson1OverallVolume ( data . OverallVolume , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDomainStatisticsReportCommandError = async ( output , context ) : Promise < GetDomainStatisticsReportCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEmailIdentityCommand = async ( output , context ) : Promise < GetEmailIdentityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEmailIdentityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConfigurationSetName : undefined , DkimAttributes : undefined , FeedbackForwardingStatus : undefined , IdentityType : undefined , MailFromAttributes : undefined , Policies : undefined , Tags : undefined , VerifiedForSendingStatus : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConfigurationSetName !== undefined && data . ConfigurationSetName !== null ) { contents . ConfigurationSetName = __expectString ( data . ConfigurationSetName ) ; } if ( data . DkimAttributes !== undefined && data . DkimAttributes !== null ) { contents . DkimAttributes = deserializeAws_restJson1DkimAttributes ( data . DkimAttributes , context ) ; } if ( data . FeedbackForwardingStatus !== undefined && data . FeedbackForwardingStatus !== null ) { contents . FeedbackForwardingStatus = __expectBoolean ( data . FeedbackForwardingStatus ) ; } if ( data . IdentityType !== undefined && data . IdentityType !== null ) { contents . IdentityType = __expectString ( data . IdentityType ) ; } if ( data . MailFromAttributes !== undefined && data . MailFromAttributes !== null ) { contents . MailFromAttributes = deserializeAws_restJson1MailFromAttributes ( data . MailFromAttributes , context ) ; } if ( data . Policies !== undefined && data . Policies !== null ) { contents . Policies = deserializeAws_restJson1PolicyMap ( data . Policies , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagList ( data . Tags , context ) ; } if ( data . VerifiedForSendingStatus !== undefined && data . VerifiedForSendingStatus !== null ) { contents . VerifiedForSendingStatus = __expectBoolean ( data . VerifiedForSendingStatus ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEmailIdentityCommandError = async ( output , context ) : Promise < GetEmailIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEmailIdentityPoliciesCommand = async ( output , context ) : Promise < GetEmailIdentityPoliciesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEmailIdentityPoliciesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Policies : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Policies !== undefined && data . Policies !== null ) { contents . Policies = deserializeAws_restJson1PolicyMap ( data . Policies , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEmailIdentityPoliciesCommandError = async ( output , context ) : Promise < GetEmailIdentityPoliciesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEmailTemplateCommand = async ( output , context ) : Promise < GetEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TemplateContent : undefined , TemplateName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TemplateContent !== undefined && data . TemplateContent !== null ) { contents . TemplateContent = deserializeAws_restJson1EmailTemplateContent ( data . TemplateContent , context ) ; } if ( data . TemplateName !== undefined && data . TemplateName !== null ) { contents . TemplateName = __expectString ( data . TemplateName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEmailTemplateCommandError = async ( output , context ) : Promise < GetEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetImportJobCommand = async ( output , context ) : Promise < GetImportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetImportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CompletedTimestamp : undefined , CreatedTimestamp : undefined , FailedRecordsCount : undefined , FailureInfo : undefined , ImportDataSource : undefined , ImportDestination : undefined , JobId : undefined , JobStatus : undefined , ProcessedRecordsCount : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CompletedTimestamp !== undefined && data . CompletedTimestamp !== null ) { contents . CompletedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CompletedTimestamp ) ) ) ; } if ( data . CreatedTimestamp !== undefined && data . CreatedTimestamp !== null ) { contents . CreatedTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreatedTimestamp ) ) ) ; } if ( data . FailedRecordsCount !== undefined && data . FailedRecordsCount !== null ) { contents . FailedRecordsCount = __expectInt32 ( data . FailedRecordsCount ) ; } if ( data . FailureInfo !== undefined && data . FailureInfo !== null ) { contents . FailureInfo = deserializeAws_restJson1FailureInfo ( data . FailureInfo , context ) ; } if ( data . ImportDataSource !== undefined && data . ImportDataSource !== null ) { contents . ImportDataSource = deserializeAws_restJson1ImportDataSource ( data . ImportDataSource , context ) ; } if ( data . ImportDestination !== undefined && data . ImportDestination !== null ) { contents . ImportDestination = deserializeAws_restJson1ImportDestination ( data . ImportDestination , context ) ; } if ( data . JobId !== undefined && data . JobId !== null ) { contents . JobId = __expectString ( data . JobId ) ; } if ( data . JobStatus !== undefined && data . JobStatus !== null ) { contents . JobStatus = __expectString ( data . JobStatus ) ; } if ( data . ProcessedRecordsCount !== undefined && data . ProcessedRecordsCount !== null ) { contents . ProcessedRecordsCount = __expectInt32 ( data . ProcessedRecordsCount ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetImportJobCommandError = async ( output , context ) : Promise < GetImportJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSuppressedDestinationCommand = async ( output , context ) : Promise < GetSuppressedDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSuppressedDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SuppressedDestination : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . SuppressedDestination !== undefined && data . SuppressedDestination !== null ) { contents . SuppressedDestination = deserializeAws_restJson1SuppressedDestination ( data . SuppressedDestination , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSuppressedDestinationCommandError = async ( output , context ) : Promise < GetSuppressedDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListConfigurationSetsCommand = async ( output , context ) : Promise < ListConfigurationSetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListConfigurationSetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConfigurationSets : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConfigurationSets !== undefined && data . ConfigurationSets !== null ) { contents . ConfigurationSets = deserializeAws_restJson1ConfigurationSetNameList ( data . ConfigurationSets , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListConfigurationSetsCommandError = async ( output , context ) : Promise < ListConfigurationSetsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListContactListsCommand = async ( output , context ) : Promise < ListContactListsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListContactListsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ContactLists : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ContactLists !== undefined && data . ContactLists !== null ) { contents . ContactLists = deserializeAws_restJson1ListOfContactLists ( data . ContactLists , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListContactListsCommandError = async ( output , context ) : Promise < ListContactListsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListContactsCommand = async ( output , context ) : Promise < ListContactsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListContactsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Contacts : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Contacts !== undefined && data . Contacts !== null ) { contents . Contacts = deserializeAws_restJson1ListOfContacts ( data . Contacts , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListContactsCommandError = async ( output , context ) : Promise < ListContactsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListCustomVerificationEmailTemplatesCommand = async ( output , context ) : Promise < ListCustomVerificationEmailTemplatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCustomVerificationEmailTemplatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CustomVerificationEmailTemplates : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CustomVerificationEmailTemplates !== undefined && data . CustomVerificationEmailTemplates !== null ) { contents . CustomVerificationEmailTemplates = deserializeAws_restJson1CustomVerificationEmailTemplatesList ( data . CustomVerificationEmailTemplates , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCustomVerificationEmailTemplatesCommandError = async ( output , context ) : Promise < ListCustomVerificationEmailTemplatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListDedicatedIpPoolsCommand = async ( output , context ) : Promise < ListDedicatedIpPoolsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDedicatedIpPoolsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DedicatedIpPools : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DedicatedIpPools !== undefined && data . DedicatedIpPools !== null ) { contents . DedicatedIpPools = deserializeAws_restJson1ListOfDedicatedIpPools ( data . DedicatedIpPools , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDedicatedIpPoolsCommandError = async ( output , context ) : Promise < ListDedicatedIpPoolsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListDeliverabilityTestReportsCommand = async ( output , context ) : Promise < ListDeliverabilityTestReportsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDeliverabilityTestReportsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DeliverabilityTestReports : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DeliverabilityTestReports !== undefined && data . DeliverabilityTestReports !== null ) { contents . DeliverabilityTestReports = deserializeAws_restJson1DeliverabilityTestReports ( data . DeliverabilityTestReports , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDeliverabilityTestReportsCommandError = async ( output , context ) : Promise < ListDeliverabilityTestReportsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListDomainDeliverabilityCampaignsCommand = async ( output , context ) : Promise < ListDomainDeliverabilityCampaignsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DomainDeliverabilityCampaigns : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DomainDeliverabilityCampaigns !== undefined && data . DomainDeliverabilityCampaigns !== null ) { contents . DomainDeliverabilityCampaigns = deserializeAws_restJson1DomainDeliverabilityCampaignList ( data . DomainDeliverabilityCampaigns , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError = async ( output , context ) : Promise < ListDomainDeliverabilityCampaignsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListEmailIdentitiesCommand = async ( output , context ) : Promise < ListEmailIdentitiesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEmailIdentitiesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EmailIdentities : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . EmailIdentities !== undefined && data . EmailIdentities !== null ) { contents . EmailIdentities = deserializeAws_restJson1IdentityInfoList ( data . EmailIdentities , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEmailIdentitiesCommandError = async ( output , context ) : Promise < ListEmailIdentitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListEmailTemplatesCommand = async ( output , context ) : Promise < ListEmailTemplatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEmailTemplatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , TemplatesMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . TemplatesMetadata !== undefined && data . TemplatesMetadata !== null ) { contents . TemplatesMetadata = deserializeAws_restJson1EmailTemplateMetadataList ( data . TemplatesMetadata , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEmailTemplatesCommandError = async ( output , context ) : Promise < ListEmailTemplatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListImportJobsCommand = async ( output , context ) : Promise < ListImportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListImportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ImportJobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ImportJobs !== undefined && data . ImportJobs !== null ) { contents . ImportJobs = deserializeAws_restJson1ImportJobSummaryList ( data . ImportJobs , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListImportJobsCommandError = async ( output , context ) : Promise < ListImportJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListSuppressedDestinationsCommand = async ( output , context ) : Promise < ListSuppressedDestinationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListSuppressedDestinationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , SuppressedDestinationSummaries : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . SuppressedDestinationSummaries !== undefined && data . SuppressedDestinationSummaries !== null ) { contents . SuppressedDestinationSummaries = deserializeAws_restJson1SuppressedDestinationSummaries ( data . SuppressedDestinationSummaries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListSuppressedDestinationsCommandError = async ( output , context ) : Promise < ListSuppressedDestinationsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidNextTokenException" : case "com.amazonaws.sesv2#InvalidNextTokenException" : response = { ... ( await deserializeAws_restJson1InvalidNextTokenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagList ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutAccountDedicatedIpWarmupAttributesCommand = async ( output , context ) : Promise < PutAccountDedicatedIpWarmupAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError = async ( output , context ) : Promise < PutAccountDedicatedIpWarmupAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutAccountDetailsCommand = async ( output , context ) : Promise < PutAccountDetailsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutAccountDetailsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutAccountDetailsCommandError = async ( output , context ) : Promise < PutAccountDetailsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.sesv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutAccountSendingAttributesCommand = async ( output , context ) : Promise < PutAccountSendingAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutAccountSendingAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutAccountSendingAttributesCommandError = async ( output , context ) : Promise < PutAccountSendingAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutAccountSuppressionAttributesCommand = async ( output , context ) : Promise < PutAccountSuppressionAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutAccountSuppressionAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutAccountSuppressionAttributesCommandError = async ( output , context ) : Promise < PutAccountSuppressionAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutConfigurationSetDeliveryOptionsCommand = async ( output , context ) : Promise < PutConfigurationSetDeliveryOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError = async ( output , context ) : Promise < PutConfigurationSetDeliveryOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutConfigurationSetReputationOptionsCommand = async ( output , context ) : Promise < PutConfigurationSetReputationOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError = async ( output , context ) : Promise < PutConfigurationSetReputationOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutConfigurationSetSendingOptionsCommand = async ( output , context ) : Promise < PutConfigurationSetSendingOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError = async ( output , context ) : Promise < PutConfigurationSetSendingOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutConfigurationSetSuppressionOptionsCommand = async ( output , context ) : Promise < PutConfigurationSetSuppressionOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutConfigurationSetSuppressionOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutConfigurationSetSuppressionOptionsCommandError = async ( output , context ) : Promise < PutConfigurationSetSuppressionOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutConfigurationSetTrackingOptionsCommand = async ( output , context ) : Promise < PutConfigurationSetTrackingOptionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError = async ( output , context ) : Promise < PutConfigurationSetTrackingOptionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutDedicatedIpInPoolCommand = async ( output , context ) : Promise < PutDedicatedIpInPoolCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutDedicatedIpInPoolCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutDedicatedIpInPoolCommandError = async ( output , context ) : Promise < PutDedicatedIpInPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutDedicatedIpWarmupAttributesCommand = async ( output , context ) : Promise < PutDedicatedIpWarmupAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError = async ( output , context ) : Promise < PutDedicatedIpWarmupAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutDeliverabilityDashboardOptionCommand = async ( output , context ) : Promise < PutDeliverabilityDashboardOptionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError = async ( output , context ) : Promise < PutDeliverabilityDashboardOptionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AlreadyExistsException" : case "com.amazonaws.sesv2#AlreadyExistsException" : response = { ... ( await deserializeAws_restJson1AlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEmailIdentityConfigurationSetAttributesCommand = async ( output , context ) : Promise < PutEmailIdentityConfigurationSetAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEmailIdentityConfigurationSetAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEmailIdentityConfigurationSetAttributesCommandError = async ( output , context ) : Promise < PutEmailIdentityConfigurationSetAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEmailIdentityDkimAttributesCommand = async ( output , context ) : Promise < PutEmailIdentityDkimAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError = async ( output , context ) : Promise < PutEmailIdentityDkimAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEmailIdentityDkimSigningAttributesCommand = async ( output , context ) : Promise < PutEmailIdentityDkimSigningAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEmailIdentityDkimSigningAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DkimStatus : undefined , DkimTokens : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DkimStatus !== undefined && data . DkimStatus !== null ) { contents . DkimStatus = __expectString ( data . DkimStatus ) ; } if ( data . DkimTokens !== undefined && data . DkimTokens !== null ) { contents . DkimTokens = deserializeAws_restJson1DnsTokenList ( data . DkimTokens , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEmailIdentityDkimSigningAttributesCommandError = async ( output , context ) : Promise < PutEmailIdentityDkimSigningAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEmailIdentityFeedbackAttributesCommand = async ( output , context ) : Promise < PutEmailIdentityFeedbackAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError = async ( output , context ) : Promise < PutEmailIdentityFeedbackAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEmailIdentityMailFromAttributesCommand = async ( output , context ) : Promise < PutEmailIdentityMailFromAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError = async ( output , context ) : Promise < PutEmailIdentityMailFromAttributesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutSuppressedDestinationCommand = async ( output , context ) : Promise < PutSuppressedDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutSuppressedDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutSuppressedDestinationCommandError = async ( output , context ) : Promise < PutSuppressedDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendBulkEmailCommand = async ( output , context ) : Promise < SendBulkEmailCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendBulkEmailCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BulkEmailEntryResults : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BulkEmailEntryResults !== undefined && data . BulkEmailEntryResults !== null ) { contents . BulkEmailEntryResults = deserializeAws_restJson1BulkEmailEntryResultList ( data . BulkEmailEntryResults , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendBulkEmailCommandError = async ( output , context ) : Promise < SendBulkEmailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccountSuspendedException" : case "com.amazonaws.sesv2#AccountSuspendedException" : response = { ... ( await deserializeAws_restJson1AccountSuspendedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MailFromDomainNotVerifiedException" : case "com.amazonaws.sesv2#MailFromDomainNotVerifiedException" : response = { ... ( await deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MessageRejected" : case "com.amazonaws.sesv2#MessageRejected" : response = { ... ( await deserializeAws_restJson1MessageRejectedResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SendingPausedException" : case "com.amazonaws.sesv2#SendingPausedException" : response = { ... ( await deserializeAws_restJson1SendingPausedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendCustomVerificationEmailCommand = async ( output , context ) : Promise < SendCustomVerificationEmailCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendCustomVerificationEmailCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . MessageId !== undefined && data . MessageId !== null ) { contents . MessageId = __expectString ( data . MessageId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendCustomVerificationEmailCommandError = async ( output , context ) : Promise < SendCustomVerificationEmailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MailFromDomainNotVerifiedException" : case "com.amazonaws.sesv2#MailFromDomainNotVerifiedException" : response = { ... ( await deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MessageRejected" : case "com.amazonaws.sesv2#MessageRejected" : response = { ... ( await deserializeAws_restJson1MessageRejectedResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SendingPausedException" : case "com.amazonaws.sesv2#SendingPausedException" : response = { ... ( await deserializeAws_restJson1SendingPausedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendEmailCommand = async ( output , context ) : Promise < SendEmailCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendEmailCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . MessageId !== undefined && data . MessageId !== null ) { contents . MessageId = __expectString ( data . MessageId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendEmailCommandError = async ( output , context ) : Promise < SendEmailCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccountSuspendedException" : case "com.amazonaws.sesv2#AccountSuspendedException" : response = { ... ( await deserializeAws_restJson1AccountSuspendedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.sesv2#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MailFromDomainNotVerifiedException" : case "com.amazonaws.sesv2#MailFromDomainNotVerifiedException" : response = { ... ( await deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MessageRejected" : case "com.amazonaws.sesv2#MessageRejected" : response = { ... ( await deserializeAws_restJson1MessageRejectedResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SendingPausedException" : case "com.amazonaws.sesv2#SendingPausedException" : response = { ... ( await deserializeAws_restJson1SendingPausedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1TestRenderEmailTemplateCommand = async ( output , context ) : Promise < TestRenderEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TestRenderEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RenderedTemplate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . RenderedTemplate !== undefined && data . RenderedTemplate !== null ) { contents . RenderedTemplate = __expectString ( data . RenderedTemplate ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TestRenderEmailTemplateCommandError = async ( output , context ) : Promise < TestRenderEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateConfigurationSetEventDestinationCommand = async ( output , context ) : Promise < UpdateConfigurationSetEventDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError = async ( output , context ) : Promise < UpdateConfigurationSetEventDestinationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateContactCommand = async ( output , context ) : Promise < UpdateContactCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateContactCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateContactCommandError = async ( output , context ) : Promise < UpdateContactCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateContactListCommand = async ( output , context ) : Promise < UpdateContactListCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateContactListCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateContactListCommandError = async ( output , context ) : Promise < UpdateContactListCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentModificationException" : case "com.amazonaws.sesv2#ConcurrentModificationException" : response = { ... ( await deserializeAws_restJson1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateCustomVerificationEmailTemplateCommand = async ( output , context ) : Promise < UpdateCustomVerificationEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateCustomVerificationEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateCustomVerificationEmailTemplateCommandError = async ( output , context ) : Promise < UpdateCustomVerificationEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEmailIdentityPolicyCommand = async ( output , context ) : Promise < UpdateEmailIdentityPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEmailIdentityPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEmailIdentityPolicyCommandError = async ( output , context ) : Promise < UpdateEmailIdentityPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEmailTemplateCommand = async ( output , context ) : Promise < UpdateEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEmailTemplateCommandError = async ( output , context ) : Promise < UpdateEmailTemplateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.sesv2#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.sesv2#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.sesv2#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1AccountSuspendedExceptionResponse = async ( parsedOutput , context ) : Promise < AccountSuspendedException > => { const contents = { name : "AccountSuspendedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1AlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < AlreadyExistsException > => { const contents = { name : "AlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async ( parsedOutput , context ) : Promise < ConcurrentModificationException > => { const contents = { name : "ConcurrentModificationException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidNextTokenException > => { const contents = { name : "InvalidNextTokenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse = async ( parsedOutput , context ) : Promise < MailFromDomainNotVerifiedException > => { const contents = { name : "MailFromDomainNotVerifiedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1MessageRejectedResponse = async ( parsedOutput , context ) : Promise < MessageRejected > => { const contents = { name : "MessageRejected" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const contents = { name : "NotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1SendingPausedExceptionResponse = async ( parsedOutput , context ) : Promise < SendingPausedException > => { const contents = { name : "SendingPausedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1AdditionalContactEmailAddresses = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Body = ( input , context ) : any => { return { ... ( input . Html !== undefined && input . Html !== null && { Html : serializeAws_restJson1Content ( input . Html , context ) } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : serializeAws_restJson1Content ( input . Text , context ) } ) , } ; } ; const serializeAws_restJson1BulkEmailContent = ( input , context ) : any => { return { ... ( input . Template !== undefined && input . Template !== null && { Template : serializeAws_restJson1Template ( input . Template , context ) } ) , } ; } ; const serializeAws_restJson1BulkEmailEntry = ( input , context ) : any => { return { ... ( input . Destination !== undefined && input . Destination !== null && { Destination : serializeAws_restJson1Destination ( input . Destination , context ) } ) , ... ( input . ReplacementEmailContent !== undefined && input . ReplacementEmailContent !== null && { ReplacementEmailContent : serializeAws_restJson1ReplacementEmailContent ( input . ReplacementEmailContent , context ) , } ) , ... ( input . ReplacementTags !== undefined && input . ReplacementTags !== null && { ReplacementTags : serializeAws_restJson1MessageTagList ( input . ReplacementTags , context ) , } ) , } ; } ; const serializeAws_restJson1BulkEmailEntryList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1BulkEmailEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CloudWatchDestination = ( input , context ) : any => { return { ... ( input . DimensionConfigurations !== undefined && input . DimensionConfigurations !== null && { DimensionConfigurations : serializeAws_restJson1CloudWatchDimensionConfigurations ( input . DimensionConfigurations , context ) , } ) , } ; } ; const serializeAws_restJson1CloudWatchDimensionConfiguration = ( input , context ) : any => { return { ... ( input . DefaultDimensionValue !== undefined && input . DefaultDimensionValue !== null && { DefaultDimensionValue : input . DefaultDimensionValue } ) , ... ( input . DimensionName !== undefined && input . DimensionName !== null && { DimensionName : input . DimensionName } ) , ... ( input . DimensionValueSource !== undefined && input . DimensionValueSource !== null && { DimensionValueSource : input . DimensionValueSource } ) , } ; } ; const serializeAws_restJson1CloudWatchDimensionConfigurations = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CloudWatchDimensionConfiguration ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ContactListDestination = ( input , context ) : any => { return { ... ( input . ContactListImportAction !== undefined && input . ContactListImportAction !== null && { ContactListImportAction : input . ContactListImportAction } ) , ... ( input . ContactListName !== undefined && input . ContactListName !== null && { ContactListName : input . ContactListName } ) , } ; } ; const serializeAws_restJson1Content = ( input , context ) : any => { return { ... ( input . Charset !== undefined && input . Charset !== null && { Charset : input . Charset } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : input . Data } ) , } ; } ; const serializeAws_restJson1DeliveryOptions = ( input , context ) : any => { return { ... ( input . SendingPoolName !== undefined && input . SendingPoolName !== null && { SendingPoolName : input . SendingPoolName } ) , ... ( input . TlsPolicy !== undefined && input . TlsPolicy !== null && { TlsPolicy : input . TlsPolicy } ) , } ; } ; const serializeAws_restJson1Destination = ( input , context ) : any => { return { ... ( input . BccAddresses !== undefined && input . BccAddresses !== null && { BccAddresses : serializeAws_restJson1EmailAddressList ( input . BccAddresses , context ) , } ) , ... ( input . CcAddresses !== undefined && input . CcAddresses !== null && { CcAddresses : serializeAws_restJson1EmailAddressList ( input . CcAddresses , context ) , } ) , ... ( input . ToAddresses !== undefined && input . ToAddresses !== null && { ToAddresses : serializeAws_restJson1EmailAddressList ( input . ToAddresses , context ) , } ) , } ; } ; const serializeAws_restJson1DkimSigningAttributes = ( input , context ) : any => { return { ... ( input . DomainSigningPrivateKey !== undefined && input . DomainSigningPrivateKey !== null && { DomainSigningPrivateKey : input . DomainSigningPrivateKey } ) , ... ( input . DomainSigningSelector !== undefined && input . DomainSigningSelector !== null && { DomainSigningSelector : input . DomainSigningSelector } ) , ... ( input . NextSigningKeyLength !== undefined && input . NextSigningKeyLength !== null && { NextSigningKeyLength : input . NextSigningKeyLength } ) , } ; } ; const serializeAws_restJson1DomainDeliverabilityTrackingOption = ( input , context ) : any => { return { ... ( input . Domain !== undefined && input . Domain !== null && { Domain : input . Domain } ) , ... ( input . InboxPlacementTrackingOption !== undefined && input . InboxPlacementTrackingOption !== null && { InboxPlacementTrackingOption : serializeAws_restJson1InboxPlacementTrackingOption ( input . InboxPlacementTrackingOption , context ) , } ) , ... ( input . SubscriptionStartDate !== undefined && input . SubscriptionStartDate !== null && { SubscriptionStartDate : Math . round ( input . SubscriptionStartDate . getTime ( ) / 1000 ) , } ) , } ; } ; const serializeAws_restJson1DomainDeliverabilityTrackingOptions = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1DomainDeliverabilityTrackingOption ( entry , context ) ; } ) ; } ; const serializeAws_restJson1EmailAddressList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1EmailContent = ( input , context ) : any => { return { ... ( input . Raw !== undefined && input . Raw !== null && { Raw : serializeAws_restJson1RawMessage ( input . Raw , context ) } ) , ... ( input . Simple !== undefined && input . Simple !== null && { Simple : serializeAws_restJson1Message ( input . Simple , context ) } ) , ... ( input . Template !== undefined && input . Template !== null && { Template : serializeAws_restJson1Template ( input . Template , context ) } ) , } ; } ; const serializeAws_restJson1EmailTemplateContent = ( input , context ) : any => { return { ... ( input . Html !== undefined && input . Html !== null && { Html : input . Html } ) , ... ( input . Subject !== undefined && input . Subject !== null && { Subject : input . Subject } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_restJson1EventDestinationDefinition = ( input , context ) : any => { return { ... ( input . CloudWatchDestination !== undefined && input . CloudWatchDestination !== null && { CloudWatchDestination : serializeAws_restJson1CloudWatchDestination ( input . CloudWatchDestination , context ) , } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . KinesisFirehoseDestination !== undefined && input . KinesisFirehoseDestination !== null && { KinesisFirehoseDestination : serializeAws_restJson1KinesisFirehoseDestination ( input . KinesisFirehoseDestination , context ) , } ) , ... ( input . MatchingEventTypes !== undefined && input . MatchingEventTypes !== null && { MatchingEventTypes : serializeAws_restJson1EventTypes ( input . MatchingEventTypes , context ) , } ) , ... ( input . PinpointDestination !== undefined && input . PinpointDestination !== null && { PinpointDestination : serializeAws_restJson1PinpointDestination ( input . PinpointDestination , context ) , } ) , ... ( input . SnsDestination !== undefined && input . SnsDestination !== null && { SnsDestination : serializeAws_restJson1SnsDestination ( input . SnsDestination , context ) , } ) , } ; } ; const serializeAws_restJson1EventTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ImportDataSource = ( input , context ) : any => { return { ... ( input . DataFormat !== undefined && input . DataFormat !== null && { DataFormat : input . DataFormat } ) , ... ( input . S3Url !== undefined && input . S3Url !== null && { S3Url : input . S3Url } ) , } ; } ; const serializeAws_restJson1ImportDestination = ( input , context ) : any => { return { ... ( input . ContactListDestination !== undefined && input . ContactListDestination !== null && { ContactListDestination : serializeAws_restJson1ContactListDestination ( input . ContactListDestination , context ) , } ) , ... ( input . SuppressionListDestination !== undefined && input . SuppressionListDestination !== null && { SuppressionListDestination : serializeAws_restJson1SuppressionListDestination ( input . SuppressionListDestination , context ) , } ) , } ; } ; const serializeAws_restJson1InboxPlacementTrackingOption = ( input , context ) : any => { return { ... ( input . Global !== undefined && input . Global !== null && { Global : input . Global } ) , ... ( input . TrackedIsps !== undefined && input . TrackedIsps !== null && { TrackedIsps : serializeAws_restJson1IspNameList ( input . TrackedIsps , context ) } ) , } ; } ; const serializeAws_restJson1IspNameList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1KinesisFirehoseDestination = ( input , context ) : any => { return { ... ( input . DeliveryStreamArn !== undefined && input . DeliveryStreamArn !== null && { DeliveryStreamArn : input . DeliveryStreamArn } ) , ... ( input . IamRoleArn !== undefined && input . IamRoleArn !== null && { IamRoleArn : input . IamRoleArn } ) , } ; } ; const serializeAws_restJson1ListContactsFilter = ( input , context ) : any => { return { ... ( input . FilteredStatus !== undefined && input . FilteredStatus !== null && { FilteredStatus : input . FilteredStatus } ) , ... ( input . TopicFilter !== undefined && input . TopicFilter !== null && { TopicFilter : serializeAws_restJson1TopicFilter ( input . TopicFilter , context ) } ) , } ; } ; const serializeAws_restJson1ListManagementOptions = ( input , context ) : any => { return { ... ( input . ContactListName !== undefined && input . ContactListName !== null && { ContactListName : input . ContactListName } ) , ... ( input . TopicName !== undefined && input . TopicName !== null && { TopicName : input . TopicName } ) , } ; } ; const serializeAws_restJson1Message = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : serializeAws_restJson1Body ( input . Body , context ) } ) , ... ( input . Subject !== undefined && input . Subject !== null && { Subject : serializeAws_restJson1Content ( input . Subject , context ) } ) , } ; } ; const serializeAws_restJson1MessageTag = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1MessageTagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1MessageTag ( entry , context ) ; } ) ; } ; const serializeAws_restJson1PinpointDestination = ( input , context ) : any => { return { ... ( input . ApplicationArn !== undefined && input . ApplicationArn !== null && { ApplicationArn : input . ApplicationArn } ) , } ; } ; const serializeAws_restJson1RawMessage = ( input , context ) : any => { return { ... ( input . Data !== undefined && input . Data !== null && { Data : context . base64Encoder ( input . Data ) } ) , } ; } ; const serializeAws_restJson1ReplacementEmailContent = ( input , context ) : any => { return { ... ( input . ReplacementTemplate !== undefined && input . ReplacementTemplate !== null && { ReplacementTemplate : serializeAws_restJson1ReplacementTemplate ( input . ReplacementTemplate , context ) , } ) , } ; } ; const serializeAws_restJson1ReplacementTemplate = ( input , context ) : any => { return { ... ( input . ReplacementTemplateData !== undefined && input . ReplacementTemplateData !== null && { ReplacementTemplateData : input . ReplacementTemplateData } ) , } ; } ; const serializeAws_restJson1ReputationOptions = ( input , context ) : any => { return { ... ( input . LastFreshStart !== undefined && input . LastFreshStart !== null && { LastFreshStart : Math . round ( input . LastFreshStart . getTime ( ) / 1000 ) } ) , ... ( input . ReputationMetricsEnabled !== undefined && input . ReputationMetricsEnabled !== null && { ReputationMetricsEnabled : input . ReputationMetricsEnabled } ) , } ; } ; const serializeAws_restJson1SendingOptions = ( input , context ) : any => { return { ... ( input . SendingEnabled !== undefined && input . SendingEnabled !== null && { SendingEnabled : input . SendingEnabled } ) , } ; } ; const serializeAws_restJson1SnsDestination = ( input , context ) : any => { return { ... ( input . TopicArn !== undefined && input . TopicArn !== null && { TopicArn : input . TopicArn } ) , } ; } ; const serializeAws_restJson1SuppressionListDestination = ( input , context ) : any => { return { ... ( input . SuppressionListImportAction !== undefined && input . SuppressionListImportAction !== null && { SuppressionListImportAction : input . SuppressionListImportAction } ) , } ; } ; const serializeAws_restJson1SuppressionListReasons = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SuppressionOptions = ( input , context ) : any => { return { ... ( input . SuppressedReasons !== undefined && input . SuppressedReasons !== null && { SuppressedReasons : serializeAws_restJson1SuppressionListReasons ( input . SuppressedReasons , context ) , } ) , } ; } ; const serializeAws_restJson1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1TagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Template = ( input , context ) : any => { return { ... ( input . TemplateArn !== undefined && input . TemplateArn !== null && { TemplateArn : input . TemplateArn } ) , ... ( input . TemplateData !== undefined && input . TemplateData !== null && { TemplateData : input . TemplateData } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , } ; } ; const serializeAws_restJson1Topic = ( input , context ) : any => { return { ... ( input . DefaultSubscriptionStatus !== undefined && input . DefaultSubscriptionStatus !== null && { DefaultSubscriptionStatus : input . DefaultSubscriptionStatus } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . DisplayName !== undefined && input . DisplayName !== null && { DisplayName : input . DisplayName } ) , ... ( input . TopicName !== undefined && input . TopicName !== null && { TopicName : input . TopicName } ) , } ; } ; const serializeAws_restJson1TopicFilter = ( input , context ) : any => { return { ... ( input . TopicName !== undefined && input . TopicName !== null && { TopicName : input . TopicName } ) , ... ( input . UseDefaultIfPreferenceUnavailable !== undefined && input . UseDefaultIfPreferenceUnavailable !== null && { UseDefaultIfPreferenceUnavailable : input . UseDefaultIfPreferenceUnavailable , } ) , } ; } ; const serializeAws_restJson1TopicPreference = ( input , context ) : any => { return { ... ( input . SubscriptionStatus !== undefined && input . SubscriptionStatus !== null && { SubscriptionStatus : input . SubscriptionStatus } ) , ... ( input . TopicName !== undefined && input . TopicName !== null && { TopicName : input . TopicName } ) , } ; } ; const serializeAws_restJson1TopicPreferenceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1TopicPreference ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Topics = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Topic ( entry , context ) ; } ) ; } ; const serializeAws_restJson1TrackingOptions = ( input , context ) : any => { return { ... ( input . CustomRedirectDomain !== undefined && input . CustomRedirectDomain !== null && { CustomRedirectDomain : input . CustomRedirectDomain } ) , } ; } ; const deserializeAws_restJson1AccountDetails = ( output , context ) : AccountDetails => { return { AdditionalContactEmailAddresses : output . AdditionalContactEmailAddresses !== undefined && output . AdditionalContactEmailAddresses !== null ? deserializeAws_restJson1AdditionalContactEmailAddresses ( output . AdditionalContactEmailAddresses , context ) : undefined , ContactLanguage : __expectString ( output . ContactLanguage ) , MailType : __expectString ( output . MailType ) , ReviewDetails : output . ReviewDetails !== undefined && output . ReviewDetails !== null ? deserializeAws_restJson1ReviewDetails ( output . ReviewDetails , context ) : undefined , UseCaseDescription : __expectString ( output . UseCaseDescription ) , WebsiteURL : __expectString ( output . WebsiteURL ) , } as any ; } ; const deserializeAws_restJson1AdditionalContactEmailAddresses = ( 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_restJson1BlacklistEntries = ( output , context ) : BlacklistEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BlacklistEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BlacklistEntry = ( output , context ) : BlacklistEntry => { return { Description : __expectString ( output . Description ) , ListingTime : output . ListingTime !== undefined && output . ListingTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ListingTime ) ) ) : undefined , RblName : __expectString ( output . RblName ) , } as any ; } ; const deserializeAws_restJson1BlacklistReport = ( output , context ) : { [ key ] : BlacklistEntry [ ] ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1BlacklistEntries ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1BulkEmailEntryResult = ( output , context ) : BulkEmailEntryResult => { return { Error : __expectString ( output . Error ) , MessageId : __expectString ( output . MessageId ) , Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_restJson1BulkEmailEntryResultList = ( output , context ) : BulkEmailEntryResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BulkEmailEntryResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CloudWatchDestination = ( output , context ) : CloudWatchDestination => { return { DimensionConfigurations : output . DimensionConfigurations !== undefined && output . DimensionConfigurations !== null ? deserializeAws_restJson1CloudWatchDimensionConfigurations ( output . DimensionConfigurations , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CloudWatchDimensionConfiguration = ( output , context ) : CloudWatchDimensionConfiguration => { return { DefaultDimensionValue : __expectString ( output . DefaultDimensionValue ) , DimensionName : __expectString ( output . DimensionName ) , DimensionValueSource : __expectString ( output . DimensionValueSource ) , } as any ; } ; const deserializeAws_restJson1CloudWatchDimensionConfigurations = ( output , context ) : CloudWatchDimensionConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CloudWatchDimensionConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ConfigurationSetNameList = ( 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_restJson1Contact = ( output , context ) : Contact => { return { EmailAddress : __expectString ( output . EmailAddress ) , LastUpdatedTimestamp : output . LastUpdatedTimestamp !== undefined && output . LastUpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTimestamp ) ) ) : undefined , TopicDefaultPreferences : output . TopicDefaultPreferences !== undefined && output . TopicDefaultPreferences !== null ? deserializeAws_restJson1TopicPreferenceList ( output . TopicDefaultPreferences , context ) : undefined , TopicPreferences : output . TopicPreferences !== undefined && output . TopicPreferences !== null ? deserializeAws_restJson1TopicPreferenceList ( output . TopicPreferences , context ) : undefined , UnsubscribeAll : __expectBoolean ( output . UnsubscribeAll ) , } as any ; } ; const deserializeAws_restJson1ContactList = ( output , context ) : ContactList => { return { ContactListName : __expectString ( output . ContactListName ) , LastUpdatedTimestamp : output . LastUpdatedTimestamp !== undefined && output . LastUpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTimestamp ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ContactListDestination = ( output , context ) : ContactListDestination => { return { ContactListImportAction : __expectString ( output . ContactListImportAction ) , ContactListName : __expectString ( output . ContactListName ) , } as any ; } ; const deserializeAws_restJson1CustomVerificationEmailTemplateMetadata = ( output , context ) : CustomVerificationEmailTemplateMetadata => { return { FailureRedirectionURL : __expectString ( output . FailureRedirectionURL ) , FromEmailAddress : __expectString ( output . FromEmailAddress ) , SuccessRedirectionURL : __expectString ( output . SuccessRedirectionURL ) , TemplateName : __expectString ( output . TemplateName ) , TemplateSubject : __expectString ( output . TemplateSubject ) , } as any ; } ; const deserializeAws_restJson1CustomVerificationEmailTemplatesList = ( output , context ) : CustomVerificationEmailTemplateMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CustomVerificationEmailTemplateMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DailyVolume = ( output , context ) : DailyVolume => { return { DomainIspPlacements : output . DomainIspPlacements !== undefined && output . DomainIspPlacements !== null ? deserializeAws_restJson1DomainIspPlacements ( output . DomainIspPlacements , context ) : undefined , StartDate : output . StartDate !== undefined && output . StartDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . StartDate ) ) ) : undefined , VolumeStatistics : output . VolumeStatistics !== undefined && output . VolumeStatistics !== null ? deserializeAws_restJson1VolumeStatistics ( output . VolumeStatistics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DailyVolumes = ( output , context ) : DailyVolume [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DailyVolume ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DedicatedIp = ( output , context ) : DedicatedIp => { return { Ip : __expectString ( output . Ip ) , PoolName : __expectString ( output . PoolName ) , WarmupPercentage : __expectInt32 ( output . WarmupPercentage ) , WarmupStatus : __expectString ( output . WarmupStatus ) , } as any ; } ; const deserializeAws_restJson1DedicatedIpList = ( output , context ) : DedicatedIp [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DedicatedIp ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DeliverabilityTestReport = ( output , context ) : DeliverabilityTestReport => { return { CreateDate : output . CreateDate !== undefined && output . CreateDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreateDate ) ) ) : undefined , DeliverabilityTestStatus : __expectString ( output . DeliverabilityTestStatus ) , FromEmailAddress : __expectString ( output . FromEmailAddress ) , ReportId : __expectString ( output . ReportId ) , ReportName : __expectString ( output . ReportName ) , Subject : __expectString ( output . Subject ) , } as any ; } ; const deserializeAws_restJson1DeliverabilityTestReports = ( output , context ) : DeliverabilityTestReport [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DeliverabilityTestReport ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DeliveryOptions = ( output , context ) : DeliveryOptions => { return { SendingPoolName : __expectString ( output . SendingPoolName ) , TlsPolicy : __expectString ( output . TlsPolicy ) , } as any ; } ; const deserializeAws_restJson1DkimAttributes = ( output , context ) : DkimAttributes => { return { CurrentSigningKeyLength : __expectString ( output . CurrentSigningKeyLength ) , LastKeyGenerationTimestamp : output . LastKeyGenerationTimestamp !== undefined && output . LastKeyGenerationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastKeyGenerationTimestamp ) ) ) : undefined , NextSigningKeyLength : __expectString ( output . NextSigningKeyLength ) , SigningAttributesOrigin : __expectString ( output . SigningAttributesOrigin ) , SigningEnabled : __expectBoolean ( output . SigningEnabled ) , Status : __expectString ( output . Status ) , Tokens : output . Tokens !== undefined && output . Tokens !== null ? deserializeAws_restJson1DnsTokenList ( output . Tokens , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DnsTokenList = ( 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_restJson1DomainDeliverabilityCampaign = ( output , context ) : DomainDeliverabilityCampaign => { return { CampaignId : __expectString ( output . CampaignId ) , DeleteRate : __limitedParseDouble ( output . DeleteRate ) , Esps : output . Esps !== undefined && output . Esps !== null ? deserializeAws_restJson1Esps ( output . Esps , context ) : undefined , FirstSeenDateTime : output . FirstSeenDateTime !== undefined && output . FirstSeenDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . FirstSeenDateTime ) ) ) : undefined , FromAddress : __expectString ( output . FromAddress ) , ImageUrl : __expectString ( output . ImageUrl ) , InboxCount : __expectLong ( output . InboxCount ) , LastSeenDateTime : output . LastSeenDateTime !== undefined && output . LastSeenDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastSeenDateTime ) ) ) : undefined , ProjectedVolume : __expectLong ( output . ProjectedVolume ) , ReadDeleteRate : __limitedParseDouble ( output . ReadDeleteRate ) , ReadRate : __limitedParseDouble ( output . ReadRate ) , SendingIps : output . SendingIps !== undefined && output . SendingIps !== null ? deserializeAws_restJson1IpList ( output . SendingIps , context ) : undefined , SpamCount : __expectLong ( output . SpamCount ) , Subject : __expectString ( output . Subject ) , } as any ; } ; const deserializeAws_restJson1DomainDeliverabilityCampaignList = ( output , context ) : DomainDeliverabilityCampaign [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DomainDeliverabilityCampaign ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DomainDeliverabilityTrackingOption = ( output , context ) : DomainDeliverabilityTrackingOption => { return { Domain : __expectString ( output . Domain ) , InboxPlacementTrackingOption : output . InboxPlacementTrackingOption !== undefined && output . InboxPlacementTrackingOption !== null ? deserializeAws_restJson1InboxPlacementTrackingOption ( output . InboxPlacementTrackingOption , context ) : undefined , SubscriptionStartDate : output . SubscriptionStartDate !== undefined && output . SubscriptionStartDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubscriptionStartDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1DomainDeliverabilityTrackingOptions = ( output , context ) : DomainDeliverabilityTrackingOption [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DomainDeliverabilityTrackingOption ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DomainIspPlacement = ( output , context ) : DomainIspPlacement => { return { InboxPercentage : __limitedParseDouble ( output . InboxPercentage ) , InboxRawCount : __expectLong ( output . InboxRawCount ) , IspName : __expectString ( output . IspName ) , SpamPercentage : __limitedParseDouble ( output . SpamPercentage ) , SpamRawCount : __expectLong ( output . SpamRawCount ) , } as any ; } ; const deserializeAws_restJson1DomainIspPlacements = ( output , context ) : DomainIspPlacement [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DomainIspPlacement ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EmailTemplateContent = ( output , context ) : EmailTemplateContent => { return { Html : __expectString ( output . Html ) , Subject : __expectString ( output . Subject ) , Text : __expectString ( output . Text ) , } as any ; } ; const deserializeAws_restJson1EmailTemplateMetadata = ( output , context ) : EmailTemplateMetadata => { return { CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , TemplateName : __expectString ( output . TemplateName ) , } as any ; } ; const deserializeAws_restJson1EmailTemplateMetadataList = ( output , context ) : EmailTemplateMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EmailTemplateMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Esps = ( 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_restJson1EventDestination = ( output , context ) : EventDestination => { return { CloudWatchDestination : output . CloudWatchDestination !== undefined && output . CloudWatchDestination !== null ? deserializeAws_restJson1CloudWatchDestination ( output . CloudWatchDestination , context ) : undefined , Enabled : __expectBoolean ( output . Enabled ) , KinesisFirehoseDestination : output . KinesisFirehoseDestination !== undefined && output . KinesisFirehoseDestination !== null ? deserializeAws_restJson1KinesisFirehoseDestination ( output . KinesisFirehoseDestination , context ) : undefined , MatchingEventTypes : output . MatchingEventTypes !== undefined && output . MatchingEventTypes !== null ? deserializeAws_restJson1EventTypes ( output . MatchingEventTypes , context ) : undefined , Name : __expectString ( output . Name ) , PinpointDestination : output . PinpointDestination !== undefined && output . PinpointDestination !== null ? deserializeAws_restJson1PinpointDestination ( output . PinpointDestination , context ) : undefined , SnsDestination : output . SnsDestination !== undefined && output . SnsDestination !== null ? deserializeAws_restJson1SnsDestination ( output . SnsDestination , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EventDestinations = ( output , context ) : EventDestination [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EventDestination ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EventTypes = ( output , context ) : ( EventType | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1FailureInfo = ( output , context ) : FailureInfo => { return { ErrorMessage : __expectString ( output . ErrorMessage ) , FailedRecordsS3Url : __expectString ( output . FailedRecordsS3Url ) , } as any ; } ; const deserializeAws_restJson1IdentityInfo = ( output , context ) : IdentityInfo => { return { IdentityName : __expectString ( output . IdentityName ) , IdentityType : __expectString ( output . IdentityType ) , SendingEnabled : __expectBoolean ( output . SendingEnabled ) , } as any ; } ; const deserializeAws_restJson1IdentityInfoList = ( output , context ) : IdentityInfo [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1IdentityInfo ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ImportDataSource = ( output , context ) : ImportDataSource => { return { DataFormat : __expectString ( output . DataFormat ) , S3Url : __expectString ( output . S3Url ) , } as any ; } ; const deserializeAws_restJson1ImportDestination = ( output , context ) : ImportDestination => { return { ContactListDestination : output . ContactListDestination !== undefined && output . ContactListDestination !== null ? deserializeAws_restJson1ContactListDestination ( output . ContactListDestination , context ) : undefined , SuppressionListDestination : output . SuppressionListDestination !== undefined && output . SuppressionListDestination !== null ? deserializeAws_restJson1SuppressionListDestination ( output . SuppressionListDestination , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ImportJobSummary = ( output , context ) : ImportJobSummary => { return { CreatedTimestamp : output . CreatedTimestamp !== undefined && output . CreatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedTimestamp ) ) ) : undefined , ImportDestination : output . ImportDestination !== undefined && output . ImportDestination !== null ? deserializeAws_restJson1ImportDestination ( output . ImportDestination , context ) : undefined , JobId : __expectString ( output . JobId ) , JobStatus : __expectString ( output . JobStatus ) , } as any ; } ; const deserializeAws_restJson1ImportJobSummaryList = ( output , context ) : ImportJobSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ImportJobSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1InboxPlacementTrackingOption = ( output , context ) : InboxPlacementTrackingOption => { return { Global : __expectBoolean ( output . Global ) , TrackedIsps : output . TrackedIsps !== undefined && output . TrackedIsps !== null ? deserializeAws_restJson1IspNameList ( output . TrackedIsps , context ) : undefined , } as any ; } ; const deserializeAws_restJson1IpList = ( 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_restJson1IspNameList = ( 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_restJson1IspPlacement = ( output , context ) : IspPlacement => { return { IspName : __expectString ( output . IspName ) , PlacementStatistics : output . PlacementStatistics !== undefined && output . PlacementStatistics !== null ? deserializeAws_restJson1PlacementStatistics ( output . PlacementStatistics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1IspPlacements = ( output , context ) : IspPlacement [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1IspPlacement ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1KinesisFirehoseDestination = ( output , context ) : KinesisFirehoseDestination => { return { DeliveryStreamArn : __expectString ( output . DeliveryStreamArn ) , IamRoleArn : __expectString ( output . IamRoleArn ) , } as any ; } ; const deserializeAws_restJson1ListOfContactLists = ( output , context ) : ContactList [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ContactList ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfContacts = ( output , context ) : Contact [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Contact ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDedicatedIpPools = ( 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_restJson1MailFromAttributes = ( output , context ) : MailFromAttributes => { return { BehaviorOnMxFailure : __expectString ( output . BehaviorOnMxFailure ) , MailFromDomain : __expectString ( output . MailFromDomain ) , MailFromDomainStatus : __expectString ( output . MailFromDomainStatus ) , } as any ; } ; const deserializeAws_restJson1OverallVolume = ( output , context ) : OverallVolume => { return { DomainIspPlacements : output . DomainIspPlacements !== undefined && output . DomainIspPlacements !== null ? deserializeAws_restJson1DomainIspPlacements ( output . DomainIspPlacements , context ) : undefined , ReadRatePercent : __limitedParseDouble ( output . ReadRatePercent ) , VolumeStatistics : output . VolumeStatistics !== undefined && output . VolumeStatistics !== null ? deserializeAws_restJson1VolumeStatistics ( output . VolumeStatistics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PinpointDestination = ( output , context ) : PinpointDestination => { return { ApplicationArn : __expectString ( output . ApplicationArn ) , } as any ; } ; const deserializeAws_restJson1PlacementStatistics = ( output , context ) : PlacementStatistics => { return { DkimPercentage : __limitedParseDouble ( output . DkimPercentage ) , InboxPercentage : __limitedParseDouble ( output . InboxPercentage ) , MissingPercentage : __limitedParseDouble ( output . MissingPercentage ) , SpamPercentage : __limitedParseDouble ( output . SpamPercentage ) , SpfPercentage : __limitedParseDouble ( output . SpfPercentage ) , } as any ; } ; const deserializeAws_restJson1PolicyMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1ReputationOptions = ( output , context ) : ReputationOptions => { return { LastFreshStart : output . LastFreshStart !== undefined && output . LastFreshStart !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastFreshStart ) ) ) : undefined , ReputationMetricsEnabled : __expectBoolean ( output . ReputationMetricsEnabled ) , } as any ; } ; const deserializeAws_restJson1ReviewDetails = ( output , context ) : ReviewDetails => { return { CaseId : __expectString ( output . CaseId ) , Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_restJson1SendingOptions = ( output , context ) : SendingOptions => { return { SendingEnabled : __expectBoolean ( output . SendingEnabled ) , } as any ; } ; const deserializeAws_restJson1SendQuota = ( output , context ) : SendQuota => { return { Max24HourSend : __limitedParseDouble ( output . Max24HourSend ) , MaxSendRate : __limitedParseDouble ( output . MaxSendRate ) , SentLast24Hours : __limitedParseDouble ( output . SentLast24Hours ) , } as any ; } ; const deserializeAws_restJson1SnsDestination = ( output , context ) : SnsDestination => { return { TopicArn : __expectString ( output . TopicArn ) , } as any ; } ; const deserializeAws_restJson1SuppressedDestination = ( output , context ) : SuppressedDestination => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1SuppressedDestinationAttributes ( output . Attributes , context ) : undefined , EmailAddress : __expectString ( output . EmailAddress ) , LastUpdateTime : output . LastUpdateTime !== undefined && output . LastUpdateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdateTime ) ) ) : undefined , Reason : __expectString ( output . Reason ) , } as any ; } ; const deserializeAws_restJson1SuppressedDestinationAttributes = ( output , context ) : SuppressedDestinationAttributes => { return { FeedbackId : __expectString ( output . FeedbackId ) , MessageId : __expectString ( output . MessageId ) , } as any ; } ; const deserializeAws_restJson1SuppressedDestinationSummaries = ( output , context ) : SuppressedDestinationSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SuppressedDestinationSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SuppressedDestinationSummary = ( output , context ) : SuppressedDestinationSummary => { return { EmailAddress : __expectString ( output . EmailAddress ) , LastUpdateTime : output . LastUpdateTime !== undefined && output . LastUpdateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdateTime ) ) ) : undefined , Reason : __expectString ( output . Reason ) , } as any ; } ; const deserializeAws_restJson1SuppressionAttributes = ( output , context ) : SuppressionAttributes => { return { SuppressedReasons : output . SuppressedReasons !== undefined && output . SuppressedReasons !== null ? deserializeAws_restJson1SuppressionListReasons ( output . SuppressedReasons , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SuppressionListDestination = ( output , context ) : SuppressionListDestination => { return { SuppressionListImportAction : __expectString ( output . SuppressionListImportAction ) , } as any ; } ; const deserializeAws_restJson1SuppressionListReasons = ( output , context ) : ( SuppressionListReason | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1SuppressionOptions = ( output , context ) : SuppressionOptions => { return { SuppressedReasons : output . SuppressedReasons !== undefined && output . SuppressedReasons !== null ? deserializeAws_restJson1SuppressionListReasons ( output . SuppressedReasons , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_restJson1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Topic = ( output , context ) : Topic => { return { DefaultSubscriptionStatus : __expectString ( output . DefaultSubscriptionStatus ) , Description : __expectString ( output . Description ) , DisplayName : __expectString ( output . DisplayName ) , TopicName : __expectString ( output . TopicName ) , } as any ; } ; const deserializeAws_restJson1TopicPreference = ( output , context ) : TopicPreference => { return { SubscriptionStatus : __expectString ( output . SubscriptionStatus ) , TopicName : __expectString ( output . TopicName ) , } as any ; } ; const deserializeAws_restJson1TopicPreferenceList = ( output , context ) : TopicPreference [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TopicPreference ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Topics = ( output , context ) : Topic [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Topic ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TrackingOptions = ( output , context ) : TrackingOptions => { return { CustomRedirectDomain : __expectString ( output . CustomRedirectDomain ) , } as any ; } ; const deserializeAws_restJson1VolumeStatistics = ( output , context ) : VolumeStatistics => { return { InboxRawCount : __expectLong ( output . InboxRawCount ) , ProjectedInbox : __expectLong ( output . ProjectedInbox ) , ProjectedSpam : __expectLong ( output . ProjectedSpam ) , SpamRawCount : __expectLong ( output . SpamRawCount ) , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;