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 { v4 as generateIdempotencyToken } from "uuid" ; import { AcceptInvitationCommandInput , AcceptInvitationCommandOutput } from "../commands/AcceptInvitationCommand" ; import { ArchiveFindingsCommandInput , ArchiveFindingsCommandOutput } from "../commands/ArchiveFindingsCommand" ; import { CreateDetectorCommandInput , CreateDetectorCommandOutput } from "../commands/CreateDetectorCommand" ; import { CreateFilterCommandInput , CreateFilterCommandOutput } from "../commands/CreateFilterCommand" ; import { CreateIPSetCommandInput , CreateIPSetCommandOutput } from "../commands/CreateIPSetCommand" ; import { CreateMembersCommandInput , CreateMembersCommandOutput } from "../commands/CreateMembersCommand" ; import { CreatePublishingDestinationCommandInput , CreatePublishingDestinationCommandOutput , } from "../commands/CreatePublishingDestinationCommand" ; import { CreateSampleFindingsCommandInput , CreateSampleFindingsCommandOutput , } from "../commands/CreateSampleFindingsCommand" ; import { CreateThreatIntelSetCommandInput , CreateThreatIntelSetCommandOutput , } from "../commands/CreateThreatIntelSetCommand" ; import { DeclineInvitationsCommandInput , DeclineInvitationsCommandOutput } from "../commands/DeclineInvitationsCommand" ; import { DeleteDetectorCommandInput , DeleteDetectorCommandOutput } from "../commands/DeleteDetectorCommand" ; import { DeleteFilterCommandInput , DeleteFilterCommandOutput } from "../commands/DeleteFilterCommand" ; import { DeleteInvitationsCommandInput , DeleteInvitationsCommandOutput } from "../commands/DeleteInvitationsCommand" ; import { DeleteIPSetCommandInput , DeleteIPSetCommandOutput } from "../commands/DeleteIPSetCommand" ; import { DeleteMembersCommandInput , DeleteMembersCommandOutput } from "../commands/DeleteMembersCommand" ; import { DeletePublishingDestinationCommandInput , DeletePublishingDestinationCommandOutput , } from "../commands/DeletePublishingDestinationCommand" ; import { DeleteThreatIntelSetCommandInput , DeleteThreatIntelSetCommandOutput , } from "../commands/DeleteThreatIntelSetCommand" ; import { DescribeOrganizationConfigurationCommandInput , DescribeOrganizationConfigurationCommandOutput , } from "../commands/DescribeOrganizationConfigurationCommand" ; import { DescribePublishingDestinationCommandInput , DescribePublishingDestinationCommandOutput , } from "../commands/DescribePublishingDestinationCommand" ; import { DisableOrganizationAdminAccountCommandInput , DisableOrganizationAdminAccountCommandOutput , } from "../commands/DisableOrganizationAdminAccountCommand" ; import { DisassociateFromMasterAccountCommandInput , DisassociateFromMasterAccountCommandOutput , } from "../commands/DisassociateFromMasterAccountCommand" ; import { DisassociateMembersCommandInput , DisassociateMembersCommandOutput , } from "../commands/DisassociateMembersCommand" ; import { EnableOrganizationAdminAccountCommandInput , EnableOrganizationAdminAccountCommandOutput , } from "../commands/EnableOrganizationAdminAccountCommand" ; import { GetDetectorCommandInput , GetDetectorCommandOutput } from "../commands/GetDetectorCommand" ; import { GetFilterCommandInput , GetFilterCommandOutput } from "../commands/GetFilterCommand" ; import { GetFindingsCommandInput , GetFindingsCommandOutput } from "../commands/GetFindingsCommand" ; import { GetFindingsStatisticsCommandInput , GetFindingsStatisticsCommandOutput , } from "../commands/GetFindingsStatisticsCommand" ; import { GetInvitationsCountCommandInput , GetInvitationsCountCommandOutput , } from "../commands/GetInvitationsCountCommand" ; import { GetIPSetCommandInput , GetIPSetCommandOutput } from "../commands/GetIPSetCommand" ; import { GetMasterAccountCommandInput , GetMasterAccountCommandOutput } from "../commands/GetMasterAccountCommand" ; import { GetMemberDetectorsCommandInput , GetMemberDetectorsCommandOutput } from "../commands/GetMemberDetectorsCommand" ; import { GetMembersCommandInput , GetMembersCommandOutput } from "../commands/GetMembersCommand" ; import { GetThreatIntelSetCommandInput , GetThreatIntelSetCommandOutput } from "../commands/GetThreatIntelSetCommand" ; import { GetUsageStatisticsCommandInput , GetUsageStatisticsCommandOutput } from "../commands/GetUsageStatisticsCommand" ; import { InviteMembersCommandInput , InviteMembersCommandOutput } from "../commands/InviteMembersCommand" ; import { ListDetectorsCommandInput , ListDetectorsCommandOutput } from "../commands/ListDetectorsCommand" ; import { ListFiltersCommandInput , ListFiltersCommandOutput } from "../commands/ListFiltersCommand" ; import { ListFindingsCommandInput , ListFindingsCommandOutput } from "../commands/ListFindingsCommand" ; import { ListInvitationsCommandInput , ListInvitationsCommandOutput } from "../commands/ListInvitationsCommand" ; import { ListIPSetsCommandInput , ListIPSetsCommandOutput } from "../commands/ListIPSetsCommand" ; import { ListMembersCommandInput , ListMembersCommandOutput } from "../commands/ListMembersCommand" ; import { ListOrganizationAdminAccountsCommandInput , ListOrganizationAdminAccountsCommandOutput , } from "../commands/ListOrganizationAdminAccountsCommand" ; import { ListPublishingDestinationsCommandInput , ListPublishingDestinationsCommandOutput , } from "../commands/ListPublishingDestinationsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListThreatIntelSetsCommandInput , ListThreatIntelSetsCommandOutput , } from "../commands/ListThreatIntelSetsCommand" ; import { StartMonitoringMembersCommandInput , StartMonitoringMembersCommandOutput , } from "../commands/StartMonitoringMembersCommand" ; import { StopMonitoringMembersCommandInput , StopMonitoringMembersCommandOutput , } from "../commands/StopMonitoringMembersCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UnarchiveFindingsCommandInput , UnarchiveFindingsCommandOutput } from "../commands/UnarchiveFindingsCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateDetectorCommandInput , UpdateDetectorCommandOutput } from "../commands/UpdateDetectorCommand" ; import { UpdateFilterCommandInput , UpdateFilterCommandOutput } from "../commands/UpdateFilterCommand" ; import { UpdateFindingsFeedbackCommandInput , UpdateFindingsFeedbackCommandOutput , } from "../commands/UpdateFindingsFeedbackCommand" ; import { UpdateIPSetCommandInput , UpdateIPSetCommandOutput } from "../commands/UpdateIPSetCommand" ; import { UpdateMemberDetectorsCommandInput , UpdateMemberDetectorsCommandOutput , } from "../commands/UpdateMemberDetectorsCommand" ; import { UpdateOrganizationConfigurationCommandInput , UpdateOrganizationConfigurationCommandOutput , } from "../commands/UpdateOrganizationConfigurationCommand" ; import { UpdatePublishingDestinationCommandInput , UpdatePublishingDestinationCommandOutput , } from "../commands/UpdatePublishingDestinationCommand" ; import { UpdateThreatIntelSetCommandInput , UpdateThreatIntelSetCommandOutput , } from "../commands/UpdateThreatIntelSetCommand" ; import { AccessControlList , AccessKeyDetails , AccountDetail , AccountLevelPermissions , Action , AdminAccount , AwsApiCallAction , BadRequestException , BlockPublicAccess , BucketLevelPermissions , BucketPolicy , City , CloudTrailConfigurationResult , Condition , Country , DataSource , DataSourceConfigurations , DataSourceConfigurationsResult , DefaultServerSideEncryption , Destination , DestinationProperties , DNSLogsConfigurationResult , DnsRequestAction , DomainDetails , Evidence , Finding , FindingCriteria , FindingStatistics , FindingStatisticType , FlowLogsConfigurationResult , GeoLocation , IamInstanceProfile , InstanceDetails , InternalServerErrorException , Invitation , LocalIpDetails , LocalPortDetails , Master , Member , MemberDataSourceConfiguration , NetworkConnectionAction , NetworkInterface , Organization , OrganizationDataSourceConfigurations , OrganizationDataSourceConfigurationsResult , OrganizationS3LogsConfiguration , OrganizationS3LogsConfigurationResult , Owner , PermissionConfiguration , PortProbeAction , PortProbeDetail , PrivateIpAddressDetails , ProductCode , PublicAccess , RemoteIpDetails , RemotePortDetails , Resource , S3BucketDetail , S3LogsConfiguration , S3LogsConfigurationResult , SecurityGroup , Service , SortCriteria , Tag , ThreatIntelligenceDetail , Total , UnprocessedAccount , UsageAccountResult , UsageCriteria , UsageDataSourceResult , UsageResourceResult , UsageStatistics , } from "../models/models_0" ; export const serializeAws_restJson1AcceptInvitationCommand = 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 || "" }` + "/detector/{DetectorId}/master" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . InvitationId !== undefined && input . InvitationId !== null && { invitationId : input . InvitationId } ) , ... ( input . MasterId !== undefined && input . MasterId !== null && { masterId : input . MasterId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ArchiveFindingsCommand = 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 || "" }` + "/detector/{DetectorId}/findings/archive" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingIds !== undefined && input . FindingIds !== null && { findingIds : serializeAws_restJson1FindingIds ( input . FindingIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDetectorCommand = 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 || "" }` + "/detector" ; let body ; body = JSON . stringify ( { clientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { dataSources : serializeAws_restJson1DataSourceConfigurations ( input . DataSources , context ) , } ) , ... ( input . Enable !== undefined && input . Enable !== null && { enable : input . Enable } ) , ... ( input . FindingPublishingFrequency !== undefined && input . FindingPublishingFrequency !== null && { findingPublishingFrequency : input . FindingPublishingFrequency } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateFilterCommand = 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 || "" }` + "/detector/{DetectorId}/filter" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Action !== undefined && input . Action !== null && { action : input . Action } ) , clientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , ... ( input . FindingCriteria !== undefined && input . FindingCriteria !== null && { findingCriteria : serializeAws_restJson1FindingCriteria ( input . FindingCriteria , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { name : input . Name } ) , ... ( input . Rank !== undefined && input . Rank !== null && { rank : input . Rank } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateIPSetCommand = 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 || "" }` + "/detector/{DetectorId}/ipset" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Activate !== undefined && input . Activate !== null && { activate : input . Activate } ) , clientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Format !== undefined && input . Format !== null && { format : input . Format } ) , ... ( input . Location !== undefined && input . Location !== null && { location : input . Location } ) , ... ( input . Name !== undefined && input . Name !== null && { name : input . Name } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountDetails !== undefined && input . AccountDetails !== null && { accountDetails : serializeAws_restJson1AccountDetails ( input . AccountDetails , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreatePublishingDestinationCommand = 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 || "" }` + "/detector/{DetectorId}/publishingDestination" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { clientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . DestinationProperties !== undefined && input . DestinationProperties !== null && { destinationProperties : serializeAws_restJson1DestinationProperties ( input . DestinationProperties , context ) , } ) , ... ( input . DestinationType !== undefined && input . DestinationType !== null && { destinationType : input . DestinationType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSampleFindingsCommand = 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 || "" }` + "/detector/{DetectorId}/findings/create" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingTypes !== undefined && input . FindingTypes !== null && { findingTypes : serializeAws_restJson1FindingTypes ( input . FindingTypes , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateThreatIntelSetCommand = 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 || "" }` + "/detector/{DetectorId}/threatintelset" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Activate !== undefined && input . Activate !== null && { activate : input . Activate } ) , clientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . Format !== undefined && input . Format !== null && { format : input . Format } ) , ... ( input . Location !== undefined && input . Location !== null && { location : input . Location } ) , ... ( input . Name !== undefined && input . Name !== null && { name : input . Name } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeclineInvitationsCommand = 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 || "" }` + "/invitation/decline" ; let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDetectorCommand = 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 || "" }` + "/detector/{DetectorId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteFilterCommand = 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 || "" }` + "/detector/{DetectorId}/filter/{FilterName}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . FilterName !== undefined ) { const labelValue = input . FilterName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FilterName." ) ; } resolvedPath = resolvedPath . replace ( "{FilterName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FilterName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteInvitationsCommand = 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 || "" }` + "/invitation/delete" ; let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteIPSetCommand = 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 || "" }` + "/detector/{DetectorId}/ipset/{IpSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . IpSetId !== undefined ) { const labelValue = input . IpSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IpSetId." ) ; } resolvedPath = resolvedPath . replace ( "{IpSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IpSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/delete" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeletePublishingDestinationCommand = 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 || "" }` + "/detector/{DetectorId}/publishingDestination/{DestinationId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . DestinationId !== undefined ) { const labelValue = input . DestinationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DestinationId." ) ; } resolvedPath = resolvedPath . replace ( "{DestinationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DestinationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteThreatIntelSetCommand = 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 || "" }` + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . ThreatIntelSetId !== undefined ) { const labelValue = input . ThreatIntelSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ThreatIntelSetId." ) ; } resolvedPath = resolvedPath . replace ( "{ThreatIntelSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ThreatIntelSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeOrganizationConfigurationCommand = 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 || "" }` + "/detector/{DetectorId}/admin" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribePublishingDestinationCommand = 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 || "" }` + "/detector/{DetectorId}/publishingDestination/{DestinationId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . DestinationId !== undefined ) { const labelValue = input . DestinationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DestinationId." ) ; } resolvedPath = resolvedPath . replace ( "{DestinationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DestinationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisableOrganizationAdminAccountCommand = 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 || "" }` + "/admin/disable" ; let body ; body = JSON . stringify ( { ... ( input . AdminAccountId !== undefined && input . AdminAccountId !== null && { adminAccountId : input . AdminAccountId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateFromMasterAccountCommand = 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 || "" }` + "/detector/{DetectorId}/master/disassociate" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/disassociate" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1EnableOrganizationAdminAccountCommand = 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 || "" }` + "/admin/enable" ; let body ; body = JSON . stringify ( { ... ( input . AdminAccountId !== undefined && input . AdminAccountId !== null && { adminAccountId : input . AdminAccountId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDetectorCommand = 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 || "" }` + "/detector/{DetectorId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetFilterCommand = 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 || "" }` + "/detector/{DetectorId}/filter/{FilterName}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . FilterName !== undefined ) { const labelValue = input . FilterName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FilterName." ) ; } resolvedPath = resolvedPath . replace ( "{FilterName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FilterName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetFindingsCommand = 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 || "" }` + "/detector/{DetectorId}/findings/get" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingIds !== undefined && input . FindingIds !== null && { findingIds : serializeAws_restJson1FindingIds ( input . FindingIds , context ) } ) , ... ( input . SortCriteria !== undefined && input . SortCriteria !== null && { sortCriteria : serializeAws_restJson1SortCriteria ( input . SortCriteria , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetFindingsStatisticsCommand = 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 || "" }` + "/detector/{DetectorId}/findings/statistics" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingCriteria !== undefined && input . FindingCriteria !== null && { findingCriteria : serializeAws_restJson1FindingCriteria ( input . FindingCriteria , context ) , } ) , ... ( input . FindingStatisticTypes !== undefined && input . FindingStatisticTypes !== null && { findingStatisticTypes : serializeAws_restJson1FindingStatisticTypes ( input . FindingStatisticTypes , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetInvitationsCountCommand = 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 || "" }` + "/invitation/count" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetIPSetCommand = 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 || "" }` + "/detector/{DetectorId}/ipset/{IpSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . IpSetId !== undefined ) { const labelValue = input . IpSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IpSetId." ) ; } resolvedPath = resolvedPath . replace ( "{IpSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IpSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMasterAccountCommand = 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 || "" }` + "/detector/{DetectorId}/master" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMemberDetectorsCommand = 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 || "" }` + "/detector/{DetectorId}/member/detector/get" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/get" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetThreatIntelSetCommand = 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 || "" }` + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . ThreatIntelSetId !== undefined ) { const labelValue = input . ThreatIntelSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ThreatIntelSetId." ) ; } resolvedPath = resolvedPath . replace ( "{ThreatIntelSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ThreatIntelSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetUsageStatisticsCommand = 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 || "" }` + "/detector/{DetectorId}/usage/statistics" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { maxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { nextToken : input . NextToken } ) , ... ( input . Unit !== undefined && input . Unit !== null && { unit : input . Unit } ) , ... ( input . UsageCriteria !== undefined && input . UsageCriteria !== null && { usageCriteria : serializeAws_restJson1UsageCriteria ( input . UsageCriteria , context ) , } ) , ... ( input . UsageStatisticType !== undefined && input . UsageStatisticType !== null && { usageStatisticsType : input . UsageStatisticType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1InviteMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/invite" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , ... ( input . DisableEmailNotification !== undefined && input . DisableEmailNotification !== null && { disableEmailNotification : input . DisableEmailNotification } ) , ... ( input . Message !== undefined && input . Message !== null && { message : input . Message } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListDetectorsCommand = 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 || "" }` + "/detector" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListFiltersCommand = 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 || "" }` + "/detector/{DetectorId}/filter" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListFindingsCommand = 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 || "" }` + "/detector/{DetectorId}/findings" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingCriteria !== undefined && input . FindingCriteria !== null && { findingCriteria : serializeAws_restJson1FindingCriteria ( input . FindingCriteria , context ) , } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { maxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { nextToken : input . NextToken } ) , ... ( input . SortCriteria !== undefined && input . SortCriteria !== null && { sortCriteria : serializeAws_restJson1SortCriteria ( input . SortCriteria , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListInvitationsCommand = 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 || "" }` + "/invitation" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListIPSetsCommand = 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 || "" }` + "/detector/{DetectorId}/ipset" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . OnlyAssociated !== undefined && { onlyAssociated : input . OnlyAssociated } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListOrganizationAdminAccountsCommand = 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 || "" }` + "/admin" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListPublishingDestinationsCommand = 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 || "" }` + "/detector/{DetectorId}/publishingDestination" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListThreatIntelSetsCommand = 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 || "" }` + "/detector/{DetectorId}/threatintelset" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . 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_restJson1StartMonitoringMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/start" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StopMonitoringMembersCommand = 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 || "" }` + "/detector/{DetectorId}/member/stop" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , 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" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UnarchiveFindingsCommand = 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 || "" }` + "/detector/{DetectorId}/findings/unarchive" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . FindingIds !== undefined && input . FindingIds !== null && { findingIds : serializeAws_restJson1FindingIds ( input . FindingIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateDetectorCommand = 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 || "" }` + "/detector/{DetectorId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . DataSources !== undefined && input . DataSources !== null && { dataSources : serializeAws_restJson1DataSourceConfigurations ( input . DataSources , context ) , } ) , ... ( input . Enable !== undefined && input . Enable !== null && { enable : input . Enable } ) , ... ( input . FindingPublishingFrequency !== undefined && input . FindingPublishingFrequency !== null && { findingPublishingFrequency : input . FindingPublishingFrequency } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateFilterCommand = 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 || "" }` + "/detector/{DetectorId}/filter/{FilterName}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . FilterName !== undefined ) { const labelValue = input . FilterName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FilterName." ) ; } resolvedPath = resolvedPath . replace ( "{FilterName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FilterName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Action !== undefined && input . Action !== null && { action : input . Action } ) , ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , ... ( input . FindingCriteria !== undefined && input . FindingCriteria !== null && { findingCriteria : serializeAws_restJson1FindingCriteria ( input . FindingCriteria , context ) , } ) , ... ( input . Rank !== undefined && input . Rank !== null && { rank : input . Rank } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateFindingsFeedbackCommand = 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 || "" }` + "/detector/{DetectorId}/findings/feedback" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Comments !== undefined && input . Comments !== null && { comments : input . Comments } ) , ... ( input . Feedback !== undefined && input . Feedback !== null && { feedback : input . Feedback } ) , ... ( input . FindingIds !== undefined && input . FindingIds !== null && { findingIds : serializeAws_restJson1FindingIds ( input . FindingIds , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateIPSetCommand = 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 || "" }` + "/detector/{DetectorId}/ipset/{IpSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . IpSetId !== undefined ) { const labelValue = input . IpSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IpSetId." ) ; } resolvedPath = resolvedPath . replace ( "{IpSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IpSetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Activate !== undefined && input . Activate !== null && { activate : input . Activate } ) , ... ( input . Location !== undefined && input . Location !== null && { location : input . Location } ) , ... ( input . Name !== undefined && input . Name !== null && { name : input . Name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateMemberDetectorsCommand = 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 || "" }` + "/detector/{DetectorId}/member/detector/update" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { dataSources : serializeAws_restJson1DataSourceConfigurations ( input . DataSources , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateOrganizationConfigurationCommand = 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 || "" }` + "/detector/{DetectorId}/admin" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } let body ; body = JSON . stringify ( { ... ( input . AutoEnable !== undefined && input . AutoEnable !== null && { autoEnable : input . AutoEnable } ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { dataSources : serializeAws_restJson1OrganizationDataSourceConfigurations ( input . DataSources , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdatePublishingDestinationCommand = 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 || "" }` + "/detector/{DetectorId}/publishingDestination/{DestinationId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . DestinationId !== undefined ) { const labelValue = input . DestinationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DestinationId." ) ; } resolvedPath = resolvedPath . replace ( "{DestinationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DestinationId." ) ; } let body ; body = JSON . stringify ( { ... ( input . DestinationProperties !== undefined && input . DestinationProperties !== null && { destinationProperties : serializeAws_restJson1DestinationProperties ( input . DestinationProperties , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateThreatIntelSetCommand = 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 || "" }` + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}" ; if ( input . DetectorId !== undefined ) { const labelValue = input . DetectorId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DetectorId." ) ; } resolvedPath = resolvedPath . replace ( "{DetectorId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DetectorId." ) ; } if ( input . ThreatIntelSetId !== undefined ) { const labelValue = input . ThreatIntelSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ThreatIntelSetId." ) ; } resolvedPath = resolvedPath . replace ( "{ThreatIntelSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ThreatIntelSetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Activate !== undefined && input . Activate !== null && { activate : input . Activate } ) , ... ( input . Location !== undefined && input . Location !== null && { location : input . Location } ) , ... ( input . Name !== undefined && input . Name !== null && { name : input . Name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AcceptInvitationCommand = async ( output , context ) : Promise < AcceptInvitationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AcceptInvitationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AcceptInvitationCommandError = async ( output , context ) : Promise < AcceptInvitationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ArchiveFindingsCommand = async ( output , context ) : Promise < ArchiveFindingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ArchiveFindingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ArchiveFindingsCommandError = async ( output , context ) : Promise < ArchiveFindingsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateDetectorCommand = async ( output , context ) : Promise < CreateDetectorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDetectorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DetectorId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . detectorId !== undefined && data . detectorId !== null ) { contents . DetectorId = __expectString ( data . detectorId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDetectorCommandError = async ( output , context ) : Promise < CreateDetectorCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateFilterCommand = async ( output , context ) : Promise < CreateFilterCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateFilterCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Name : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . name !== undefined && data . name !== null ) { contents . Name = __expectString ( data . name ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateFilterCommandError = async ( output , context ) : Promise < CreateFilterCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateIPSetCommand = async ( output , context ) : Promise < CreateIPSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateIPSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , IpSetId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ipSetId !== undefined && data . ipSetId !== null ) { contents . IpSetId = __expectString ( data . ipSetId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateIPSetCommandError = async ( output , context ) : Promise < CreateIPSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateMembersCommand = async ( output , context ) : Promise < CreateMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateMembersCommandError = async ( output , context ) : Promise < CreateMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreatePublishingDestinationCommand = async ( output , context ) : Promise < CreatePublishingDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreatePublishingDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DestinationId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . destinationId !== undefined && data . destinationId !== null ) { contents . DestinationId = __expectString ( data . destinationId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreatePublishingDestinationCommandError = async ( output , context ) : Promise < CreatePublishingDestinationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateSampleFindingsCommand = async ( output , context ) : Promise < CreateSampleFindingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSampleFindingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSampleFindingsCommandError = async ( output , context ) : Promise < CreateSampleFindingsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1CreateThreatIntelSetCommand = async ( output , context ) : Promise < CreateThreatIntelSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateThreatIntelSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ThreatIntelSetId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . threatIntelSetId !== undefined && data . threatIntelSetId !== null ) { contents . ThreatIntelSetId = __expectString ( data . threatIntelSetId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateThreatIntelSetCommandError = async ( output , context ) : Promise < CreateThreatIntelSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeclineInvitationsCommand = async ( output , context ) : Promise < DeclineInvitationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeclineInvitationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeclineInvitationsCommandError = async ( output , context ) : Promise < DeclineInvitationsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteDetectorCommand = async ( output , context ) : Promise < DeleteDetectorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDetectorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDetectorCommandError = async ( output , context ) : Promise < DeleteDetectorCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteFilterCommand = async ( output , context ) : Promise < DeleteFilterCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteFilterCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteFilterCommandError = async ( output , context ) : Promise < DeleteFilterCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteInvitationsCommand = async ( output , context ) : Promise < DeleteInvitationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteInvitationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteInvitationsCommandError = async ( output , context ) : Promise < DeleteInvitationsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteIPSetCommand = async ( output , context ) : Promise < DeleteIPSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteIPSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteIPSetCommandError = async ( output , context ) : Promise < DeleteIPSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteMembersCommand = async ( output , context ) : Promise < DeleteMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMembersCommandError = async ( output , context ) : Promise < DeleteMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeletePublishingDestinationCommand = async ( output , context ) : Promise < DeletePublishingDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeletePublishingDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeletePublishingDestinationCommandError = async ( output , context ) : Promise < DeletePublishingDestinationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DeleteThreatIntelSetCommand = async ( output , context ) : Promise < DeleteThreatIntelSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteThreatIntelSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteThreatIntelSetCommandError = async ( output , context ) : Promise < DeleteThreatIntelSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DescribeOrganizationConfigurationCommand = async ( output , context ) : Promise < DescribeOrganizationConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeOrganizationConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AutoEnable : undefined , DataSources : undefined , MemberAccountLimitReached : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . autoEnable !== undefined && data . autoEnable !== null ) { contents . AutoEnable = __expectBoolean ( data . autoEnable ) ; } if ( data . dataSources !== undefined && data . dataSources !== null ) { contents . DataSources = deserializeAws_restJson1OrganizationDataSourceConfigurationsResult ( data . dataSources , context ) ; } if ( data . memberAccountLimitReached !== undefined && data . memberAccountLimitReached !== null ) { contents . MemberAccountLimitReached = __expectBoolean ( data . memberAccountLimitReached ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = async ( output , context ) : Promise < DescribeOrganizationConfigurationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DescribePublishingDestinationCommand = async ( output , context ) : Promise < DescribePublishingDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribePublishingDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DestinationId : undefined , DestinationProperties : undefined , DestinationType : undefined , PublishingFailureStartTimestamp : undefined , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . destinationId !== undefined && data . destinationId !== null ) { contents . DestinationId = __expectString ( data . destinationId ) ; } if ( data . destinationProperties !== undefined && data . destinationProperties !== null ) { contents . DestinationProperties = deserializeAws_restJson1DestinationProperties ( data . destinationProperties , context ) ; } if ( data . destinationType !== undefined && data . destinationType !== null ) { contents . DestinationType = __expectString ( data . destinationType ) ; } if ( data . publishingFailureStartTimestamp !== undefined && data . publishingFailureStartTimestamp !== null ) { contents . PublishingFailureStartTimestamp = __expectLong ( data . publishingFailureStartTimestamp ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribePublishingDestinationCommandError = async ( output , context ) : Promise < DescribePublishingDestinationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DisableOrganizationAdminAccountCommand = async ( output , context ) : Promise < DisableOrganizationAdminAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisableOrganizationAdminAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = async ( output , context ) : Promise < DisableOrganizationAdminAccountCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DisassociateFromMasterAccountCommand = async ( output , context ) : Promise < DisassociateFromMasterAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateFromMasterAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async ( output , context ) : Promise < DisassociateFromMasterAccountCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1DisassociateMembersCommand = async ( output , context ) : Promise < DisassociateMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateMembersCommandError = async ( output , context ) : Promise < DisassociateMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1EnableOrganizationAdminAccountCommand = async ( output , context ) : Promise < EnableOrganizationAdminAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1EnableOrganizationAdminAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async ( output , context ) : Promise < EnableOrganizationAdminAccountCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetDetectorCommand = async ( output , context ) : Promise < GetDetectorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDetectorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreatedAt : undefined , DataSources : undefined , FindingPublishingFrequency : undefined , ServiceRole : undefined , Status : undefined , Tags : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . createdAt !== undefined && data . createdAt !== null ) { contents . CreatedAt = __expectString ( data . createdAt ) ; } if ( data . dataSources !== undefined && data . dataSources !== null ) { contents . DataSources = deserializeAws_restJson1DataSourceConfigurationsResult ( data . dataSources , context ) ; } if ( data . findingPublishingFrequency !== undefined && data . findingPublishingFrequency !== null ) { contents . FindingPublishingFrequency = __expectString ( data . findingPublishingFrequency ) ; } if ( data . serviceRole !== undefined && data . serviceRole !== null ) { contents . ServiceRole = __expectString ( data . serviceRole ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } if ( data . updatedAt !== undefined && data . updatedAt !== null ) { contents . UpdatedAt = __expectString ( data . updatedAt ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDetectorCommandError = async ( output , context ) : Promise < GetDetectorCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetFilterCommand = async ( output , context ) : Promise < GetFilterCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetFilterCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Action : undefined , Description : undefined , FindingCriteria : undefined , Name : undefined , Rank : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . action !== undefined && data . action !== null ) { contents . Action = __expectString ( data . action ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . findingCriteria !== undefined && data . findingCriteria !== null ) { contents . FindingCriteria = deserializeAws_restJson1FindingCriteria ( data . findingCriteria , context ) ; } if ( data . name !== undefined && data . name !== null ) { contents . Name = __expectString ( data . name ) ; } if ( data . rank !== undefined && data . rank !== null ) { contents . Rank = __expectInt32 ( data . rank ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetFilterCommandError = async ( output , context ) : Promise < GetFilterCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetFindingsCommand = async ( output , context ) : Promise < GetFindingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetFindingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Findings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . findings !== undefined && data . findings !== null ) { contents . Findings = deserializeAws_restJson1Findings ( data . findings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetFindingsCommandError = async ( output , context ) : Promise < GetFindingsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetFindingsStatisticsCommand = async ( output , context ) : Promise < GetFindingsStatisticsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetFindingsStatisticsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FindingStatistics : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . findingStatistics !== undefined && data . findingStatistics !== null ) { contents . FindingStatistics = deserializeAws_restJson1FindingStatistics ( data . findingStatistics , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetFindingsStatisticsCommandError = async ( output , context ) : Promise < GetFindingsStatisticsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetInvitationsCountCommand = async ( output , context ) : Promise < GetInvitationsCountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetInvitationsCountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , InvitationsCount : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . invitationsCount !== undefined && data . invitationsCount !== null ) { contents . InvitationsCount = __expectInt32 ( data . invitationsCount ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetInvitationsCountCommandError = async ( output , context ) : Promise < GetInvitationsCountCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetIPSetCommand = async ( output , context ) : Promise < GetIPSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetIPSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Format : undefined , Location : undefined , Name : undefined , Status : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . format !== undefined && data . format !== null ) { contents . Format = __expectString ( data . format ) ; } if ( data . location !== undefined && data . location !== null ) { contents . Location = __expectString ( data . location ) ; } if ( data . name !== undefined && data . name !== null ) { contents . Name = __expectString ( data . name ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetIPSetCommandError = async ( output , context ) : Promise < GetIPSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetMasterAccountCommand = async ( output , context ) : Promise < GetMasterAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMasterAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Master : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . master !== undefined && data . master !== null ) { contents . Master = deserializeAws_restJson1Master ( data . master , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMasterAccountCommandError = async ( output , context ) : Promise < GetMasterAccountCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetMemberDetectorsCommand = async ( output , context ) : Promise < GetMemberDetectorsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMemberDetectorsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MemberDataSourceConfigurations : undefined , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . members !== undefined && data . members !== null ) { contents . MemberDataSourceConfigurations = deserializeAws_restJson1MemberDataSourceConfigurations ( data . members , context ) ; } if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMemberDetectorsCommandError = async ( output , context ) : Promise < GetMemberDetectorsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetMembersCommand = async ( output , context ) : Promise < GetMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Members : undefined , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . members !== undefined && data . members !== null ) { contents . Members = deserializeAws_restJson1Members ( data . members , context ) ; } if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMembersCommandError = async ( output , context ) : Promise < GetMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetThreatIntelSetCommand = async ( output , context ) : Promise < GetThreatIntelSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetThreatIntelSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Format : undefined , Location : undefined , Name : undefined , Status : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . format !== undefined && data . format !== null ) { contents . Format = __expectString ( data . format ) ; } if ( data . location !== undefined && data . location !== null ) { contents . Location = __expectString ( data . location ) ; } if ( data . name !== undefined && data . name !== null ) { contents . Name = __expectString ( data . name ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetThreatIntelSetCommandError = async ( output , context ) : Promise < GetThreatIntelSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1GetUsageStatisticsCommand = async ( output , context ) : Promise < GetUsageStatisticsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUsageStatisticsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , UsageStatistics : 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 . usageStatistics !== undefined && data . usageStatistics !== null ) { contents . UsageStatistics = deserializeAws_restJson1UsageStatistics ( data . usageStatistics , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUsageStatisticsCommandError = async ( output , context ) : Promise < GetUsageStatisticsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1InviteMembersCommand = async ( output , context ) : Promise < InviteMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1InviteMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1InviteMembersCommandError = async ( output , context ) : Promise < InviteMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListDetectorsCommand = async ( output , context ) : Promise < ListDetectorsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDetectorsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DetectorIds : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . detectorIds !== undefined && data . detectorIds !== null ) { contents . DetectorIds = deserializeAws_restJson1DetectorIds ( data . detectorIds , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDetectorsCommandError = async ( output , context ) : Promise < ListDetectorsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListFiltersCommand = async ( output , context ) : Promise < ListFiltersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListFiltersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FilterNames : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . filterNames !== undefined && data . filterNames !== null ) { contents . FilterNames = deserializeAws_restJson1FilterNames ( data . filterNames , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListFiltersCommandError = async ( output , context ) : Promise < ListFiltersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListFindingsCommand = async ( output , context ) : Promise < ListFindingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListFindingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FindingIds : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . findingIds !== undefined && data . findingIds !== null ) { contents . FindingIds = deserializeAws_restJson1FindingIds ( data . findingIds , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListFindingsCommandError = async ( output , context ) : Promise < ListFindingsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListInvitationsCommand = async ( output , context ) : Promise < ListInvitationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListInvitationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Invitations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . invitations !== undefined && data . invitations !== null ) { contents . Invitations = deserializeAws_restJson1Invitations ( data . invitations , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListInvitationsCommandError = async ( output , context ) : Promise < ListInvitationsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListIPSetsCommand = async ( output , context ) : Promise < ListIPSetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListIPSetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , IpSetIds : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ipSetIds !== undefined && data . ipSetIds !== null ) { contents . IpSetIds = deserializeAws_restJson1IpSetIds ( data . ipSetIds , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListIPSetsCommandError = async ( output , context ) : Promise < ListIPSetsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListMembersCommand = async ( output , context ) : Promise < ListMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Members : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . members !== undefined && data . members !== null ) { contents . Members = deserializeAws_restJson1Members ( data . members , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListMembersCommandError = async ( output , context ) : Promise < ListMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListOrganizationAdminAccountsCommand = async ( output , context ) : Promise < ListOrganizationAdminAccountsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListOrganizationAdminAccountsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AdminAccounts : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . adminAccounts !== undefined && data . adminAccounts !== null ) { contents . AdminAccounts = deserializeAws_restJson1AdminAccounts ( data . adminAccounts , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async ( output , context ) : Promise < ListOrganizationAdminAccountsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListPublishingDestinationsCommand = async ( output , context ) : Promise < ListPublishingDestinationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListPublishingDestinationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Destinations : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . destinations !== undefined && data . destinations !== null ) { contents . Destinations = deserializeAws_restJson1Destinations ( data . destinations , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListPublishingDestinationsCommandError = async ( output , context ) : Promise < ListPublishingDestinationsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1ListThreatIntelSetsCommand = async ( output , context ) : Promise < ListThreatIntelSetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListThreatIntelSetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ThreatIntelSetIds : 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 . threatIntelSetIds !== undefined && data . threatIntelSetIds !== null ) { contents . ThreatIntelSetIds = deserializeAws_restJson1ThreatIntelSetIds ( data . threatIntelSetIds , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListThreatIntelSetsCommandError = async ( output , context ) : Promise < ListThreatIntelSetsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1StartMonitoringMembersCommand = async ( output , context ) : Promise < StartMonitoringMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartMonitoringMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartMonitoringMembersCommandError = async ( output , context ) : Promise < StartMonitoringMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1StopMonitoringMembersCommand = async ( output , context ) : Promise < StopMonitoringMembersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StopMonitoringMembersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StopMonitoringMembersCommandError = async ( output , context ) : Promise < StopMonitoringMembersCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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 !== 204 && 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UnarchiveFindingsCommand = async ( output , context ) : Promise < UnarchiveFindingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UnarchiveFindingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UnarchiveFindingsCommandError = async ( output , context ) : Promise < UnarchiveFindingsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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 !== 204 && 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateDetectorCommand = async ( output , context ) : Promise < UpdateDetectorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDetectorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDetectorCommandError = async ( output , context ) : Promise < UpdateDetectorCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateFilterCommand = async ( output , context ) : Promise < UpdateFilterCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateFilterCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Name : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . name !== undefined && data . name !== null ) { contents . Name = __expectString ( data . name ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateFilterCommandError = async ( output , context ) : Promise < UpdateFilterCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateFindingsFeedbackCommand = async ( output , context ) : Promise < UpdateFindingsFeedbackCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateFindingsFeedbackCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateFindingsFeedbackCommandError = async ( output , context ) : Promise < UpdateFindingsFeedbackCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateIPSetCommand = async ( output , context ) : Promise < UpdateIPSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateIPSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateIPSetCommandError = async ( output , context ) : Promise < UpdateIPSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateMemberDetectorsCommand = async ( output , context ) : Promise < UpdateMemberDetectorsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateMemberDetectorsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , UnprocessedAccounts : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . unprocessedAccounts !== undefined && data . unprocessedAccounts !== null ) { contents . UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts ( data . unprocessedAccounts , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateMemberDetectorsCommandError = async ( output , context ) : Promise < UpdateMemberDetectorsCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateOrganizationConfigurationCommand = async ( output , context ) : Promise < UpdateOrganizationConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateOrganizationConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = async ( output , context ) : Promise < UpdateOrganizationConfigurationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdatePublishingDestinationCommand = async ( output , context ) : Promise < UpdatePublishingDestinationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdatePublishingDestinationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdatePublishingDestinationCommandError = async ( output , context ) : Promise < UpdatePublishingDestinationCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1UpdateThreatIntelSetCommand = async ( output , context ) : Promise < UpdateThreatIntelSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateThreatIntelSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateThreatIntelSetCommandError = async ( output , context ) : Promise < UpdateThreatIntelSetCommandOutput > => { 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.guardduty#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.guardduty#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( 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_restJson1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } if ( data . __type !== undefined && data . __type !== null ) { contents . Type = __expectString ( data . __type ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerErrorException > => { const contents = { name : "InternalServerErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , Type : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } if ( data . __type !== undefined && data . __type !== null ) { contents . Type = __expectString ( data . __type ) ; } return contents ; } ; const serializeAws_restJson1AccountDetail = ( input , context ) : any => { return { ... ( input . AccountId !== undefined && input . AccountId !== null && { accountId : input . AccountId } ) , ... ( input . Email !== undefined && input . Email !== null && { email : input . Email } ) , } ; } ; const serializeAws_restJson1AccountDetails = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AccountDetail ( entry , context ) ; } ) ; } ; const serializeAws_restJson1AccountIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Condition = ( input , context ) : any => { return { ... ( input . Eq !== undefined && input . Eq !== null && { eq : serializeAws_restJson1Eq ( input . Eq , context ) } ) , ... ( input . Equals !== undefined && input . Equals !== null && { equals : serializeAws_restJson1Equals ( input . Equals , context ) } ) , ... ( input . GreaterThan !== undefined && input . GreaterThan !== null && { greaterThan : input . GreaterThan } ) , ... ( input . GreaterThanOrEqual !== undefined && input . GreaterThanOrEqual !== null && { greaterThanOrEqual : input . GreaterThanOrEqual } ) , ... ( input . Gt !== undefined && input . Gt !== null && { gt : input . Gt } ) , ... ( input . Gte !== undefined && input . Gte !== null && { gte : input . Gte } ) , ... ( input . LessThan !== undefined && input . LessThan !== null && { lessThan : input . LessThan } ) , ... ( input . LessThanOrEqual !== undefined && input . LessThanOrEqual !== null && { lessThanOrEqual : input . LessThanOrEqual } ) , ... ( input . Lt !== undefined && input . Lt !== null && { lt : input . Lt } ) , ... ( input . Lte !== undefined && input . Lte !== null && { lte : input . Lte } ) , ... ( input . Neq !== undefined && input . Neq !== null && { neq : serializeAws_restJson1Neq ( input . Neq , context ) } ) , ... ( input . NotEquals !== undefined && input . NotEquals !== null && { notEquals : serializeAws_restJson1NotEquals ( input . NotEquals , context ) } ) , } ; } ; const serializeAws_restJson1Criterion = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1Condition ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1DataSourceConfigurations = ( input , context ) : any => { return { ... ( input . S3Logs !== undefined && input . S3Logs !== null && { s3Logs : serializeAws_restJson1S3LogsConfiguration ( input . S3Logs , context ) } ) , } ; } ; const serializeAws_restJson1DataSourceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1DestinationProperties = ( input , context ) : any => { return { ... ( input . DestinationArn !== undefined && input . DestinationArn !== null && { destinationArn : input . DestinationArn } ) , ... ( input . KmsKeyArn !== undefined && input . KmsKeyArn !== null && { kmsKeyArn : input . KmsKeyArn } ) , } ; } ; const serializeAws_restJson1Eq = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Equals = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1FindingCriteria = ( input , context ) : any => { return { ... ( input . Criterion !== undefined && input . Criterion !== null && { criterion : serializeAws_restJson1Criterion ( input . Criterion , context ) } ) , } ; } ; const serializeAws_restJson1FindingIds = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1FindingStatisticTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1FindingTypes = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Neq = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1NotEquals = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1OrganizationDataSourceConfigurations = ( input , context ) : any => { return { ... ( input . S3Logs !== undefined && input . S3Logs !== null && { s3Logs : serializeAws_restJson1OrganizationS3LogsConfiguration ( input . S3Logs , context ) , } ) , } ; } ; const serializeAws_restJson1OrganizationS3LogsConfiguration = ( input , context ) : any => { return { ... ( input . AutoEnable !== undefined && input . AutoEnable !== null && { autoEnable : input . AutoEnable } ) , } ; } ; const serializeAws_restJson1ResourceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1S3LogsConfiguration = ( input , context ) : any => { return { ... ( input . Enable !== undefined && input . Enable !== null && { enable : input . Enable } ) , } ; } ; const serializeAws_restJson1SortCriteria = ( input , context ) : any => { return { ... ( input . AttributeName !== undefined && input . AttributeName !== null && { attributeName : input . AttributeName } ) , ... ( input . OrderBy !== undefined && input . OrderBy !== null && { orderBy : input . OrderBy } ) , } ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1UsageCriteria = ( input , context ) : any => { return { ... ( input . AccountIds !== undefined && input . AccountIds !== null && { accountIds : serializeAws_restJson1AccountIds ( input . AccountIds , context ) } ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { dataSources : serializeAws_restJson1DataSourceList ( input . DataSources , context ) } ) , ... ( input . Resources !== undefined && input . Resources !== null && { resources : serializeAws_restJson1ResourceList ( input . Resources , context ) } ) , } ; } ; const deserializeAws_restJson1AccessControlList = ( output , context ) : AccessControlList => { return { AllowsPublicReadAccess : __expectBoolean ( output . allowsPublicReadAccess ) , AllowsPublicWriteAccess : __expectBoolean ( output . allowsPublicWriteAccess ) , } as any ; } ; const deserializeAws_restJson1AccessKeyDetails = ( output , context ) : AccessKeyDetails => { return { AccessKeyId : __expectString ( output . accessKeyId ) , PrincipalId : __expectString ( output . principalId ) , UserName : __expectString ( output . userName ) , UserType : __expectString ( output . userType ) , } as any ; } ; const deserializeAws_restJson1AccountLevelPermissions = ( output , context ) : AccountLevelPermissions => { return { BlockPublicAccess : output . blockPublicAccess !== undefined && output . blockPublicAccess !== null ? deserializeAws_restJson1BlockPublicAccess ( output . blockPublicAccess , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Action = ( output , context ) : Action => { return { ActionType : __expectString ( output . actionType ) , AwsApiCallAction : output . awsApiCallAction !== undefined && output . awsApiCallAction !== null ? deserializeAws_restJson1AwsApiCallAction ( output . awsApiCallAction , context ) : undefined , DnsRequestAction : output . dnsRequestAction !== undefined && output . dnsRequestAction !== null ? deserializeAws_restJson1DnsRequestAction ( output . dnsRequestAction , context ) : undefined , NetworkConnectionAction : output . networkConnectionAction !== undefined && output . networkConnectionAction !== null ? deserializeAws_restJson1NetworkConnectionAction ( output . networkConnectionAction , context ) : undefined , PortProbeAction : output . portProbeAction !== undefined && output . portProbeAction !== null ? deserializeAws_restJson1PortProbeAction ( output . portProbeAction , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AdminAccount = ( output , context ) : AdminAccount => { return { AdminAccountId : __expectString ( output . adminAccountId ) , AdminStatus : __expectString ( output . adminStatus ) , } as any ; } ; const deserializeAws_restJson1AdminAccounts = ( output , context ) : AdminAccount [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AdminAccount ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AwsApiCallAction = ( output , context ) : AwsApiCallAction => { return { Api : __expectString ( output . api ) , CallerType : __expectString ( output . callerType ) , DomainDetails : output . domainDetails !== undefined && output . domainDetails !== null ? deserializeAws_restJson1DomainDetails ( output . domainDetails , context ) : undefined , ErrorCode : __expectString ( output . errorCode ) , RemoteIpDetails : output . remoteIpDetails !== undefined && output . remoteIpDetails !== null ? deserializeAws_restJson1RemoteIpDetails ( output . remoteIpDetails , context ) : undefined , ServiceName : __expectString ( output . serviceName ) , } as any ; } ; const deserializeAws_restJson1BlockPublicAccess = ( output , context ) : BlockPublicAccess => { return { BlockPublicAcls : __expectBoolean ( output . blockPublicAcls ) , BlockPublicPolicy : __expectBoolean ( output . blockPublicPolicy ) , IgnorePublicAcls : __expectBoolean ( output . ignorePublicAcls ) , RestrictPublicBuckets : __expectBoolean ( output . restrictPublicBuckets ) , } as any ; } ; const deserializeAws_restJson1BucketLevelPermissions = ( output , context ) : BucketLevelPermissions => { return { AccessControlList : output . accessControlList !== undefined && output . accessControlList !== null ? deserializeAws_restJson1AccessControlList ( output . accessControlList , context ) : undefined , BlockPublicAccess : output . blockPublicAccess !== undefined && output . blockPublicAccess !== null ? deserializeAws_restJson1BlockPublicAccess ( output . blockPublicAccess , context ) : undefined , BucketPolicy : output . bucketPolicy !== undefined && output . bucketPolicy !== null ? deserializeAws_restJson1BucketPolicy ( output . bucketPolicy , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BucketPolicy = ( output , context ) : BucketPolicy => { return { AllowsPublicReadAccess : __expectBoolean ( output . allowsPublicReadAccess ) , AllowsPublicWriteAccess : __expectBoolean ( output . allowsPublicWriteAccess ) , } as any ; } ; const deserializeAws_restJson1City = ( output , context ) : City => { return { CityName : __expectString ( output . cityName ) , } as any ; } ; const deserializeAws_restJson1CloudTrailConfigurationResult = ( output , context ) : CloudTrailConfigurationResult => { return { Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1Condition = ( output , context ) : Condition => { return { Eq : output . eq !== undefined && output . eq !== null ? deserializeAws_restJson1Eq ( output . eq , context ) : undefined , Equals : output . equals !== undefined && output . equals !== null ? deserializeAws_restJson1Equals ( output . equals , context ) : undefined , GreaterThan : __expectLong ( output . greaterThan ) , GreaterThanOrEqual : __expectLong ( output . greaterThanOrEqual ) , Gt : __expectInt32 ( output . gt ) , Gte : __expectInt32 ( output . gte ) , LessThan : __expectLong ( output . lessThan ) , LessThanOrEqual : __expectLong ( output . lessThanOrEqual ) , Lt : __expectInt32 ( output . lt ) , Lte : __expectInt32 ( output . lte ) , Neq : output . neq !== undefined && output . neq !== null ? deserializeAws_restJson1Neq ( output . neq , context ) : undefined , NotEquals : output . notEquals !== undefined && output . notEquals !== null ? deserializeAws_restJson1NotEquals ( output . notEquals , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CountBySeverity = ( output , context ) : { [ key ] : number ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectInt32 ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1Country = ( output , context ) : Country => { return { CountryCode : __expectString ( output . countryCode ) , CountryName : __expectString ( output . countryName ) , } as any ; } ; const deserializeAws_restJson1Criterion = ( output , context ) : { [ key ] : Condition ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1Condition ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1DataSourceConfigurationsResult = ( output , context ) : DataSourceConfigurationsResult => { return { CloudTrail : output . cloudTrail !== undefined && output . cloudTrail !== null ? deserializeAws_restJson1CloudTrailConfigurationResult ( output . cloudTrail , context ) : undefined , DNSLogs : output . dnsLogs !== undefined && output . dnsLogs !== null ? deserializeAws_restJson1DNSLogsConfigurationResult ( output . dnsLogs , context ) : undefined , FlowLogs : output . flowLogs !== undefined && output . flowLogs !== null ? deserializeAws_restJson1FlowLogsConfigurationResult ( output . flowLogs , context ) : undefined , S3Logs : output . s3Logs !== undefined && output . s3Logs !== null ? deserializeAws_restJson1S3LogsConfigurationResult ( output . s3Logs , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DefaultServerSideEncryption = ( output , context ) : DefaultServerSideEncryption => { return { EncryptionType : __expectString ( output . encryptionType ) , KmsMasterKeyArn : __expectString ( output . kmsMasterKeyArn ) , } as any ; } ; const deserializeAws_restJson1Destination = ( output , context ) : Destination => { return { DestinationId : __expectString ( output . destinationId ) , DestinationType : __expectString ( output . destinationType ) , Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1DestinationProperties = ( output , context ) : DestinationProperties => { return { DestinationArn : __expectString ( output . destinationArn ) , KmsKeyArn : __expectString ( output . kmsKeyArn ) , } as any ; } ; const deserializeAws_restJson1Destinations = ( output , context ) : Destination [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Destination ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DetectorIds = ( 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_restJson1DNSLogsConfigurationResult = ( output , context ) : DNSLogsConfigurationResult => { return { Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1DnsRequestAction = ( output , context ) : DnsRequestAction => { return { Domain : __expectString ( output . domain ) , } as any ; } ; const deserializeAws_restJson1DomainDetails = ( output , context ) : DomainDetails => { return { Domain : __expectString ( output . domain ) , } as any ; } ; const deserializeAws_restJson1Eq = ( 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_restJson1Equals = ( 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_restJson1Evidence = ( output , context ) : Evidence => { return { ThreatIntelligenceDetails : output . threatIntelligenceDetails !== undefined && output . threatIntelligenceDetails !== null ? deserializeAws_restJson1ThreatIntelligenceDetails ( output . threatIntelligenceDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1FilterNames = ( 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_restJson1Finding = ( output , context ) : Finding => { return { AccountId : __expectString ( output . accountId ) , Arn : __expectString ( output . arn ) , Confidence : __limitedParseDouble ( output . confidence ) , CreatedAt : __expectString ( output . createdAt ) , Description : __expectString ( output . description ) , Id : __expectString ( output . id ) , Partition : __expectString ( output . partition ) , Region : __expectString ( output . region ) , Resource : output . resource !== undefined && output . resource !== null ? deserializeAws_restJson1Resource ( output . resource , context ) : undefined , SchemaVersion : __expectString ( output . schemaVersion ) , Service : output . service !== undefined && output . service !== null ? deserializeAws_restJson1Service ( output . service , context ) : undefined , Severity : __limitedParseDouble ( output . severity ) , Title : __expectString ( output . title ) , Type : __expectString ( output . type ) , UpdatedAt : __expectString ( output . updatedAt ) , } as any ; } ; const deserializeAws_restJson1FindingCriteria = ( output , context ) : FindingCriteria => { return { Criterion : output . criterion !== undefined && output . criterion !== null ? deserializeAws_restJson1Criterion ( output . criterion , context ) : undefined , } as any ; } ; const deserializeAws_restJson1FindingIds = ( 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_restJson1Findings = ( output , context ) : Finding [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Finding ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1FindingStatistics = ( output , context ) : FindingStatistics => { return { CountBySeverity : output . countBySeverity !== undefined && output . countBySeverity !== null ? deserializeAws_restJson1CountBySeverity ( output . countBySeverity , context ) : undefined , } as any ; } ; const deserializeAws_restJson1FlowLogsConfigurationResult = ( output , context ) : FlowLogsConfigurationResult => { return { Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1GeoLocation = ( output , context ) : GeoLocation => { return { Lat : __limitedParseDouble ( output . lat ) , Lon : __limitedParseDouble ( output . lon ) , } as any ; } ; const deserializeAws_restJson1IamInstanceProfile = ( output , context ) : IamInstanceProfile => { return { Arn : __expectString ( output . arn ) , Id : __expectString ( output . id ) , } as any ; } ; const deserializeAws_restJson1InstanceDetails = ( output , context ) : InstanceDetails => { return { AvailabilityZone : __expectString ( output . availabilityZone ) , IamInstanceProfile : output . iamInstanceProfile !== undefined && output . iamInstanceProfile !== null ? deserializeAws_restJson1IamInstanceProfile ( output . iamInstanceProfile , context ) : undefined , ImageDescription : __expectString ( output . imageDescription ) , ImageId : __expectString ( output . imageId ) , InstanceId : __expectString ( output . instanceId ) , InstanceState : __expectString ( output . instanceState ) , InstanceType : __expectString ( output . instanceType ) , LaunchTime : __expectString ( output . launchTime ) , NetworkInterfaces : output . networkInterfaces !== undefined && output . networkInterfaces !== null ? deserializeAws_restJson1NetworkInterfaces ( output . networkInterfaces , context ) : undefined , OutpostArn : __expectString ( output . outpostArn ) , Platform : __expectString ( output . platform ) , ProductCodes : output . productCodes !== undefined && output . productCodes !== null ? deserializeAws_restJson1ProductCodes ( output . productCodes , context ) : undefined , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Invitation = ( output , context ) : Invitation => { return { AccountId : __expectString ( output . accountId ) , InvitationId : __expectString ( output . invitationId ) , InvitedAt : __expectString ( output . invitedAt ) , RelationshipStatus : __expectString ( output . relationshipStatus ) , } as any ; } ; const deserializeAws_restJson1Invitations = ( output , context ) : Invitation [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Invitation ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IpSetIds = ( 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_restJson1Ipv6Addresses = ( 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_restJson1LocalIpDetails = ( output , context ) : LocalIpDetails => { return { IpAddressV4 : __expectString ( output . ipAddressV4 ) , } as any ; } ; const deserializeAws_restJson1LocalPortDetails = ( output , context ) : LocalPortDetails => { return { Port : __expectInt32 ( output . port ) , PortName : __expectString ( output . portName ) , } as any ; } ; const deserializeAws_restJson1Master = ( output , context ) : Master => { return { AccountId : __expectString ( output . accountId ) , InvitationId : __expectString ( output . invitationId ) , InvitedAt : __expectString ( output . invitedAt ) , RelationshipStatus : __expectString ( output . relationshipStatus ) , } as any ; } ; const deserializeAws_restJson1Member = ( output , context ) : Member => { return { AccountId : __expectString ( output . accountId ) , DetectorId : __expectString ( output . detectorId ) , Email : __expectString ( output . email ) , InvitedAt : __expectString ( output . invitedAt ) , MasterId : __expectString ( output . masterId ) , RelationshipStatus : __expectString ( output . relationshipStatus ) , UpdatedAt : __expectString ( output . updatedAt ) , } as any ; } ; const deserializeAws_restJson1MemberDataSourceConfiguration = ( output , context ) : MemberDataSourceConfiguration => { return { AccountId : __expectString ( output . accountId ) , DataSources : output . dataSources !== undefined && output . dataSources !== null ? deserializeAws_restJson1DataSourceConfigurationsResult ( output . dataSources , context ) : undefined , } as any ; } ; const deserializeAws_restJson1MemberDataSourceConfigurations = ( output , context ) : MemberDataSourceConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1MemberDataSourceConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Members = ( output , context ) : Member [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Member ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Neq = ( 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_restJson1NetworkConnectionAction = ( output , context ) : NetworkConnectionAction => { return { Blocked : __expectBoolean ( output . blocked ) , ConnectionDirection : __expectString ( output . connectionDirection ) , LocalIpDetails : output . localIpDetails !== undefined && output . localIpDetails !== null ? deserializeAws_restJson1LocalIpDetails ( output . localIpDetails , context ) : undefined , LocalPortDetails : output . localPortDetails !== undefined && output . localPortDetails !== null ? deserializeAws_restJson1LocalPortDetails ( output . localPortDetails , context ) : undefined , Protocol : __expectString ( output . protocol ) , RemoteIpDetails : output . remoteIpDetails !== undefined && output . remoteIpDetails !== null ? deserializeAws_restJson1RemoteIpDetails ( output . remoteIpDetails , context ) : undefined , RemotePortDetails : output . remotePortDetails !== undefined && output . remotePortDetails !== null ? deserializeAws_restJson1RemotePortDetails ( output . remotePortDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1NetworkInterface = ( output , context ) : NetworkInterface => { return { Ipv6Addresses : output . ipv6Addresses !== undefined && output . ipv6Addresses !== null ? deserializeAws_restJson1Ipv6Addresses ( output . ipv6Addresses , context ) : undefined , NetworkInterfaceId : __expectString ( output . networkInterfaceId ) , PrivateDnsName : __expectString ( output . privateDnsName ) , PrivateIpAddress : __expectString ( output . privateIpAddress ) , PrivateIpAddresses : output . privateIpAddresses !== undefined && output . privateIpAddresses !== null ? deserializeAws_restJson1PrivateIpAddresses ( output . privateIpAddresses , context ) : undefined , PublicDnsName : __expectString ( output . publicDnsName ) , PublicIp : __expectString ( output . publicIp ) , SecurityGroups : output . securityGroups !== undefined && output . securityGroups !== null ? deserializeAws_restJson1SecurityGroups ( output . securityGroups , context ) : undefined , SubnetId : __expectString ( output . subnetId ) , VpcId : __expectString ( output . vpcId ) , } as any ; } ; const deserializeAws_restJson1NetworkInterfaces = ( output , context ) : NetworkInterface [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkInterface ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NotEquals = ( 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_restJson1Organization = ( output , context ) : Organization => { return { Asn : __expectString ( output . asn ) , AsnOrg : __expectString ( output . asnOrg ) , Isp : __expectString ( output . isp ) , Org : __expectString ( output . org ) , } as any ; } ; const deserializeAws_restJson1OrganizationDataSourceConfigurationsResult = ( output , context ) : OrganizationDataSourceConfigurationsResult => { return { S3Logs : output . s3Logs !== undefined && output . s3Logs !== null ? deserializeAws_restJson1OrganizationS3LogsConfigurationResult ( output . s3Logs , context ) : undefined , } as any ; } ; const deserializeAws_restJson1OrganizationS3LogsConfigurationResult = ( output , context ) : OrganizationS3LogsConfigurationResult => { return { AutoEnable : __expectBoolean ( output . autoEnable ) , } as any ; } ; const deserializeAws_restJson1Owner = ( output , context ) : Owner => { return { Id : __expectString ( output . id ) , } as any ; } ; const deserializeAws_restJson1PermissionConfiguration = ( output , context ) : PermissionConfiguration => { return { AccountLevelPermissions : output . accountLevelPermissions !== undefined && output . accountLevelPermissions !== null ? deserializeAws_restJson1AccountLevelPermissions ( output . accountLevelPermissions , context ) : undefined , BucketLevelPermissions : output . bucketLevelPermissions !== undefined && output . bucketLevelPermissions !== null ? deserializeAws_restJson1BucketLevelPermissions ( output . bucketLevelPermissions , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PortProbeAction = ( output , context ) : PortProbeAction => { return { Blocked : __expectBoolean ( output . blocked ) , PortProbeDetails : output . portProbeDetails !== undefined && output . portProbeDetails !== null ? deserializeAws_restJson1PortProbeDetails ( output . portProbeDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PortProbeDetail = ( output , context ) : PortProbeDetail => { return { LocalIpDetails : output . localIpDetails !== undefined && output . localIpDetails !== null ? deserializeAws_restJson1LocalIpDetails ( output . localIpDetails , context ) : undefined , LocalPortDetails : output . localPortDetails !== undefined && output . localPortDetails !== null ? deserializeAws_restJson1LocalPortDetails ( output . localPortDetails , context ) : undefined , RemoteIpDetails : output . remoteIpDetails !== undefined && output . remoteIpDetails !== null ? deserializeAws_restJson1RemoteIpDetails ( output . remoteIpDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PortProbeDetails = ( output , context ) : PortProbeDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PortProbeDetail ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PrivateIpAddressDetails = ( output , context ) : PrivateIpAddressDetails => { return { PrivateDnsName : __expectString ( output . privateDnsName ) , PrivateIpAddress : __expectString ( output . privateIpAddress ) , } as any ; } ; const deserializeAws_restJson1PrivateIpAddresses = ( output , context ) : PrivateIpAddressDetails [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PrivateIpAddressDetails ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ProductCode = ( output , context ) : ProductCode => { return { Code : __expectString ( output . code ) , ProductType : __expectString ( output . productType ) , } as any ; } ; const deserializeAws_restJson1ProductCodes = ( output , context ) : ProductCode [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ProductCode ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PublicAccess = ( output , context ) : PublicAccess => { return { EffectivePermission : __expectString ( output . effectivePermission ) , PermissionConfiguration : output . permissionConfiguration !== undefined && output . permissionConfiguration !== null ? deserializeAws_restJson1PermissionConfiguration ( output . permissionConfiguration , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RemoteIpDetails = ( output , context ) : RemoteIpDetails => { return { City : output . city !== undefined && output . city !== null ? deserializeAws_restJson1City ( output . city , context ) : undefined , Country : output . country !== undefined && output . country !== null ? deserializeAws_restJson1Country ( output . country , context ) : undefined , GeoLocation : output . geoLocation !== undefined && output . geoLocation !== null ? deserializeAws_restJson1GeoLocation ( output . geoLocation , context ) : undefined , IpAddressV4 : __expectString ( output . ipAddressV4 ) , Organization : output . organization !== undefined && output . organization !== null ? deserializeAws_restJson1Organization ( output . organization , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RemotePortDetails = ( output , context ) : RemotePortDetails => { return { Port : __expectInt32 ( output . port ) , PortName : __expectString ( output . portName ) , } as any ; } ; const deserializeAws_restJson1Resource = ( output , context ) : Resource => { return { AccessKeyDetails : output . accessKeyDetails !== undefined && output . accessKeyDetails !== null ? deserializeAws_restJson1AccessKeyDetails ( output . accessKeyDetails , context ) : undefined , InstanceDetails : output . instanceDetails !== undefined && output . instanceDetails !== null ? deserializeAws_restJson1InstanceDetails ( output . instanceDetails , context ) : undefined , ResourceType : __expectString ( output . resourceType ) , S3BucketDetails : output . s3BucketDetails !== undefined && output . s3BucketDetails !== null ? deserializeAws_restJson1S3BucketDetails ( output . s3BucketDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1S3BucketDetail = ( output , context ) : S3BucketDetail => { return { Arn : __expectString ( output . arn ) , CreatedAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , DefaultServerSideEncryption : output . defaultServerSideEncryption !== undefined && output . defaultServerSideEncryption !== null ? deserializeAws_restJson1DefaultServerSideEncryption ( output . defaultServerSideEncryption , context ) : undefined , Name : __expectString ( output . name ) , Owner : output . owner !== undefined && output . owner !== null ? deserializeAws_restJson1Owner ( output . owner , context ) : undefined , PublicAccess : output . publicAccess !== undefined && output . publicAccess !== null ? deserializeAws_restJson1PublicAccess ( output . publicAccess , context ) : undefined , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , Type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_restJson1S3BucketDetails = ( output , context ) : S3BucketDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1S3BucketDetail ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1S3LogsConfigurationResult = ( output , context ) : S3LogsConfigurationResult => { return { Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1SecurityGroup = ( output , context ) : SecurityGroup => { return { GroupId : __expectString ( output . groupId ) , GroupName : __expectString ( output . groupName ) , } as any ; } ; const deserializeAws_restJson1SecurityGroups = ( output , context ) : SecurityGroup [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SecurityGroup ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Service = ( output , context ) : Service => { return { Action : output . action !== undefined && output . action !== null ? deserializeAws_restJson1Action ( output . action , context ) : undefined , Archived : __expectBoolean ( output . archived ) , Count : __expectInt32 ( output . count ) , DetectorId : __expectString ( output . detectorId ) , EventFirstSeen : __expectString ( output . eventFirstSeen ) , EventLastSeen : __expectString ( output . eventLastSeen ) , Evidence : output . evidence !== undefined && output . evidence !== null ? deserializeAws_restJson1Evidence ( output . evidence , context ) : undefined , ResourceRole : __expectString ( output . resourceRole ) , ServiceName : __expectString ( output . serviceName ) , UserFeedback : __expectString ( output . userFeedback ) , } as any ; } ; const deserializeAws_restJson1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . key ) , Value : __expectString ( output . value ) , } as any ; } ; const deserializeAws_restJson1TagMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1Tags = ( 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_restJson1ThreatIntelligenceDetail = ( output , context ) : ThreatIntelligenceDetail => { return { ThreatListName : __expectString ( output . threatListName ) , ThreatNames : output . threatNames !== undefined && output . threatNames !== null ? deserializeAws_restJson1ThreatNames ( output . threatNames , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ThreatIntelligenceDetails = ( output , context ) : ThreatIntelligenceDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ThreatIntelligenceDetail ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ThreatIntelSetIds = ( 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_restJson1ThreatNames = ( 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_restJson1Total = ( output , context ) : Total => { return { Amount : __expectString ( output . amount ) , Unit : __expectString ( output . unit ) , } as any ; } ; const deserializeAws_restJson1UnprocessedAccount = ( output , context ) : UnprocessedAccount => { return { AccountId : __expectString ( output . accountId ) , Result : __expectString ( output . result ) , } as any ; } ; const deserializeAws_restJson1UnprocessedAccounts = ( output , context ) : UnprocessedAccount [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UnprocessedAccount ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UsageAccountResult = ( output , context ) : UsageAccountResult => { return { AccountId : __expectString ( output . accountId ) , Total : output . total !== undefined && output . total !== null ? deserializeAws_restJson1Total ( output . total , context ) : undefined , } as any ; } ; const deserializeAws_restJson1UsageAccountResultList = ( output , context ) : UsageAccountResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UsageAccountResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UsageDataSourceResult = ( output , context ) : UsageDataSourceResult => { return { DataSource : __expectString ( output . dataSource ) , Total : output . total !== undefined && output . total !== null ? deserializeAws_restJson1Total ( output . total , context ) : undefined , } as any ; } ; const deserializeAws_restJson1UsageDataSourceResultList = ( output , context ) : UsageDataSourceResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UsageDataSourceResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UsageResourceResult = ( output , context ) : UsageResourceResult => { return { Resource : __expectString ( output . resource ) , Total : output . total !== undefined && output . total !== null ? deserializeAws_restJson1Total ( output . total , context ) : undefined , } as any ; } ; const deserializeAws_restJson1UsageResourceResultList = ( output , context ) : UsageResourceResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UsageResourceResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UsageStatistics = ( output , context ) : UsageStatistics => { return { SumByAccount : output . sumByAccount !== undefined && output . sumByAccount !== null ? deserializeAws_restJson1UsageAccountResultList ( output . sumByAccount , context ) : undefined , SumByDataSource : output . sumByDataSource !== undefined && output . sumByDataSource !== null ? deserializeAws_restJson1UsageDataSourceResultList ( output . sumByDataSource , context ) : undefined , SumByResource : output . sumByResource !== undefined && output . sumByResource !== null ? deserializeAws_restJson1UsageResourceResultList ( output . sumByResource , context ) : undefined , TopResources : output . topResources !== undefined && output . topResources !== null ? deserializeAws_restJson1UsageResourceResultList ( output . topResources , context ) : undefined , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const 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 "" ; } ;