import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse , isValidHostname as __isValidHostname , } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseRfc3339DateTime as __parseRfc3339DateTime , } 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 { CancelJobCommandInput , CancelJobCommandOutput } from "../commands/CancelJobCommand" ; import { CreateDataSetCommandInput , CreateDataSetCommandOutput } from "../commands/CreateDataSetCommand" ; import { CreateEventActionCommandInput , CreateEventActionCommandOutput } from "../commands/CreateEventActionCommand" ; import { CreateJobCommandInput , CreateJobCommandOutput } from "../commands/CreateJobCommand" ; import { CreateRevisionCommandInput , CreateRevisionCommandOutput } from "../commands/CreateRevisionCommand" ; import { DeleteAssetCommandInput , DeleteAssetCommandOutput } from "../commands/DeleteAssetCommand" ; import { DeleteDataSetCommandInput , DeleteDataSetCommandOutput } from "../commands/DeleteDataSetCommand" ; import { DeleteEventActionCommandInput , DeleteEventActionCommandOutput } from "../commands/DeleteEventActionCommand" ; import { DeleteRevisionCommandInput , DeleteRevisionCommandOutput } from "../commands/DeleteRevisionCommand" ; import { GetAssetCommandInput , GetAssetCommandOutput } from "../commands/GetAssetCommand" ; import { GetDataSetCommandInput , GetDataSetCommandOutput } from "../commands/GetDataSetCommand" ; import { GetEventActionCommandInput , GetEventActionCommandOutput } from "../commands/GetEventActionCommand" ; import { GetJobCommandInput , GetJobCommandOutput } from "../commands/GetJobCommand" ; import { GetRevisionCommandInput , GetRevisionCommandOutput } from "../commands/GetRevisionCommand" ; import { ListDataSetRevisionsCommandInput , ListDataSetRevisionsCommandOutput , } from "../commands/ListDataSetRevisionsCommand" ; import { ListDataSetsCommandInput , ListDataSetsCommandOutput } from "../commands/ListDataSetsCommand" ; import { ListEventActionsCommandInput , ListEventActionsCommandOutput } from "../commands/ListEventActionsCommand" ; import { ListJobsCommandInput , ListJobsCommandOutput } from "../commands/ListJobsCommand" ; import { ListRevisionAssetsCommandInput , ListRevisionAssetsCommandOutput } from "../commands/ListRevisionAssetsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { SendApiAssetCommandInput , SendApiAssetCommandOutput } from "../commands/SendApiAssetCommand" ; import { StartJobCommandInput , StartJobCommandOutput } from "../commands/StartJobCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateAssetCommandInput , UpdateAssetCommandOutput } from "../commands/UpdateAssetCommand" ; import { UpdateDataSetCommandInput , UpdateDataSetCommandOutput } from "../commands/UpdateDataSetCommand" ; import { UpdateEventActionCommandInput , UpdateEventActionCommandOutput } from "../commands/UpdateEventActionCommand" ; import { UpdateRevisionCommandInput , UpdateRevisionCommandOutput } from "../commands/UpdateRevisionCommand" ; import { AccessDeniedException , Action , ApiGatewayApiAsset , AssetDestinationEntry , AssetDetails , AssetEntry , AssetSourceEntry , AutoExportRevisionDestinationEntry , AutoExportRevisionToS3RequestDetails , ConflictException , DataSetEntry , Details , Event , EventActionEntry , ExportAssetsToS3RequestDetails , ExportAssetsToS3ResponseDetails , ExportAssetToSignedUrlRequestDetails , ExportAssetToSignedUrlResponseDetails , ExportRevisionsToS3RequestDetails , ExportRevisionsToS3ResponseDetails , ExportServerSideEncryption , ImportAssetFromApiGatewayApiRequestDetails , ImportAssetFromApiGatewayApiResponseDetails , ImportAssetFromSignedUrlJobErrorDetails , ImportAssetFromSignedUrlRequestDetails , ImportAssetFromSignedUrlResponseDetails , ImportAssetsFromRedshiftDataSharesRequestDetails , ImportAssetsFromRedshiftDataSharesResponseDetails , ImportAssetsFromS3RequestDetails , ImportAssetsFromS3ResponseDetails , InternalServerException , JobEntry , JobError , OriginDetails , RedshiftDataShareAsset , RedshiftDataShareAssetSourceEntry , RequestDetails , ResourceNotFoundException , ResponseDetails , RevisionDestinationEntry , RevisionEntry , RevisionPublished , S3SnapshotAsset , ServiceLimitExceededException , ThrottlingException , ValidationException , } from "../models/models_0" ; export const serializeAws_restJson1CancelJobCommand = 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 || "" }` + "/v1/jobs/{JobId}" ; if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateDataSetCommand = 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 || "" }` + "/v1/data-sets" ; let body ; body = JSON . stringify ( { ... ( input . AssetType !== undefined && input . AssetType !== null && { AssetType : input . AssetType } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1MapOf__string ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEventActionCommand = 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 || "" }` + "/v1/event-actions" ; let body ; body = JSON . stringify ( { ... ( input . Action !== undefined && input . Action !== null && { Action : serializeAws_restJson1Action ( input . Action , context ) } ) , ... ( input . Event !== undefined && input . Event !== null && { Event : serializeAws_restJson1Event ( input . Event , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateJobCommand = 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 || "" }` + "/v1/jobs" ; let body ; body = JSON . stringify ( { ... ( input . Details !== undefined && input . Details !== null && { Details : serializeAws_restJson1RequestDetails ( input . Details , context ) } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRevisionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/data-sets/{DataSetId}/revisions" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Comment !== undefined && input . Comment !== null && { Comment : input . Comment } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1MapOf__string ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAssetCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}" ; if ( input . AssetId !== undefined ) { const labelValue = input . AssetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AssetId." ) ; } resolvedPath = resolvedPath . replace ( "{AssetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AssetId." ) ; } if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDataSetCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEventActionCommand = 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 || "" }` + "/v1/event-actions/{EventActionId}" ; if ( input . EventActionId !== undefined ) { const labelValue = input . EventActionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EventActionId." ) ; } resolvedPath = resolvedPath . replace ( "{EventActionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EventActionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRevisionCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAssetCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}" ; if ( input . AssetId !== undefined ) { const labelValue = input . AssetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AssetId." ) ; } resolvedPath = resolvedPath . replace ( "{AssetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AssetId." ) ; } if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDataSetCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEventActionCommand = 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 || "" }` + "/v1/event-actions/{EventActionId}" ; if ( input . EventActionId !== undefined ) { const labelValue = input . EventActionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EventActionId." ) ; } resolvedPath = resolvedPath . replace ( "{EventActionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EventActionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetJobCommand = 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 || "" }` + "/v1/jobs/{JobId}" ; if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRevisionCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListDataSetRevisionsCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } 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_restJson1ListDataSetsCommand = 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 || "" }` + "/v1/data-sets" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . Origin !== undefined && { origin : input . Origin } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListEventActionsCommand = 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 || "" }` + "/v1/event-actions" ; const query = { ... ( input . EventSourceId !== undefined && { eventSourceId : input . EventSourceId } ) , ... ( 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_restJson1ListJobsCommand = 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 || "" }` + "/v1/jobs" ; const query = { ... ( input . DataSetId !== undefined && { dataSetId : input . DataSetId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . RevisionId !== undefined && { revisionId : input . RevisionId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListRevisionAssetsCommand = 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 || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } 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_restJson1SendApiAssetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "text/plain" , ... ( isSerializableHeaderValue ( input . AssetId ) && { "x-amzn-dataexchange-asset-id" : input . AssetId ! } ) , ... ( isSerializableHeaderValue ( input . DataSetId ) && { "x-amzn-dataexchange-data-set-id" : input . DataSetId ! } ) , ... ( isSerializableHeaderValue ( input . Method ) && { "x-amzn-dataexchange-http-method" : input . Method ! } ) , ... ( isSerializableHeaderValue ( input . Path ) && { "x-amzn-dataexchange-path" : input . Path ! } ) , ... ( isSerializableHeaderValue ( input . RevisionId ) && { "x-amzn-dataexchange-revision-id" : input . RevisionId ! } ) , ... ( input . RequestHeaders !== undefined && Object . keys ( input . RequestHeaders ) . reduce ( ( acc , suffix ) => ( { ... acc , [ `x-amzn-dataexchange-header-${ suffix . toLowerCase ( ) }` ] : input . RequestHeaders ! [ suffix ] , } ) , { } ) ) , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1" ; const query = { ... ( input . QueryStringParameters !== undefined && input . QueryStringParameters ) , } ; let body ; if ( input . Body !== undefined ) { body = input . Body ; } let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api-fulfill." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1StartJobCommand = 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 || "" }` + "/v1/jobs/{JobId}" ; if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , 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_restJson1MapOf__string ( input . Tags , 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_restJson1UpdateAssetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}" ; if ( input . AssetId !== undefined ) { const labelValue = input . AssetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AssetId." ) ; } resolvedPath = resolvedPath . replace ( "{AssetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AssetId." ) ; } if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateDataSetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/data-sets/{DataSetId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEventActionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/event-actions/{EventActionId}" ; if ( input . EventActionId !== undefined ) { const labelValue = input . EventActionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EventActionId." ) ; } resolvedPath = resolvedPath . replace ( "{EventActionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EventActionId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Action !== undefined && input . Action !== null && { Action : serializeAws_restJson1Action ( input . Action , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRevisionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}" ; if ( input . DataSetId !== undefined ) { const labelValue = input . DataSetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DataSetId." ) ; } resolvedPath = resolvedPath . replace ( "{DataSetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DataSetId." ) ; } if ( input . RevisionId !== undefined ) { const labelValue = input . RevisionId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RevisionId." ) ; } resolvedPath = resolvedPath . replace ( "{RevisionId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RevisionId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Comment !== undefined && input . Comment !== null && { Comment : input . Comment } ) , ... ( input . Finalized !== undefined && input . Finalized !== null && { Finalized : input . Finalized } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CancelJobCommand = async ( output , context ) : Promise < CancelJobCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1CancelJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CancelJobCommandError = async ( output , context ) : Promise < CancelJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateDataSetCommand = async ( output , context ) : Promise < CreateDataSetCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDataSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , AssetType : undefined , CreatedAt : undefined , Description : undefined , Id : undefined , Name : undefined , Origin : undefined , OriginDetails : undefined , SourceId : undefined , Tags : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . AssetType !== undefined && data . AssetType !== null ) { contents . AssetType = __expectString ( data . AssetType ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . Origin !== undefined && data . Origin !== null ) { contents . Origin = __expectString ( data . Origin ) ; } if ( data . OriginDetails !== undefined && data . OriginDetails !== null ) { contents . OriginDetails = deserializeAws_restJson1OriginDetails ( data . OriginDetails , context ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1MapOf__string ( data . Tags , context ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDataSetCommandError = async ( output , context ) : Promise < CreateDataSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceLimitExceededException" : case "com.amazonaws.dataexchange#ServiceLimitExceededException" : response = { ... ( await deserializeAws_restJson1ServiceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateEventActionCommand = async ( output , context ) : Promise < CreateEventActionCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEventActionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Action : undefined , Arn : undefined , CreatedAt : undefined , Event : undefined , Id : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Action !== undefined && data . Action !== null ) { contents . Action = deserializeAws_restJson1Action ( data . Action , context ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Event !== undefined && data . Event !== null ) { contents . Event = deserializeAws_restJson1Event ( data . Event , context ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEventActionCommandError = async ( output , context ) : Promise < CreateEventActionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceLimitExceededException" : case "com.amazonaws.dataexchange#ServiceLimitExceededException" : response = { ... ( await deserializeAws_restJson1ServiceLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateJobCommand = async ( output , context ) : Promise < CreateJobCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , CreatedAt : undefined , Details : undefined , Errors : undefined , Id : undefined , State : undefined , Type : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Details !== undefined && data . Details !== null ) { contents . Details = deserializeAws_restJson1ResponseDetails ( data . Details , context ) ; } if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1ListOfJobError ( data . Errors , context ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateJobCommandError = async ( output , context ) : Promise < CreateJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1CreateRevisionCommand = async ( output , context ) : Promise < CreateRevisionCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRevisionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Comment : undefined , CreatedAt : undefined , DataSetId : undefined , Finalized : undefined , Id : undefined , SourceId : undefined , Tags : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . Comment !== undefined && data . Comment !== null ) { contents . Comment = __expectString ( data . Comment ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . DataSetId !== undefined && data . DataSetId !== null ) { contents . DataSetId = __expectString ( data . DataSetId ) ; } if ( data . Finalized !== undefined && data . Finalized !== null ) { contents . Finalized = __expectBoolean ( data . Finalized ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1MapOf__string ( data . Tags , context ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRevisionCommandError = async ( output , context ) : Promise < CreateRevisionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteAssetCommand = async ( output , context ) : Promise < DeleteAssetCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAssetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAssetCommandError = async ( output , context ) : Promise < DeleteAssetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteDataSetCommand = async ( output , context ) : Promise < DeleteDataSetCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDataSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDataSetCommandError = async ( output , context ) : Promise < DeleteDataSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteEventActionCommand = async ( output , context ) : Promise < DeleteEventActionCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEventActionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEventActionCommandError = async ( output , context ) : Promise < DeleteEventActionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1DeleteRevisionCommand = async ( output , context ) : Promise < DeleteRevisionCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRevisionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRevisionCommandError = async ( output , context ) : Promise < DeleteRevisionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetAssetCommand = async ( output , context ) : Promise < GetAssetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAssetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , AssetDetails : undefined , AssetType : undefined , CreatedAt : undefined , DataSetId : undefined , Id : undefined , Name : undefined , RevisionId : undefined , SourceId : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . AssetDetails !== undefined && data . AssetDetails !== null ) { contents . AssetDetails = deserializeAws_restJson1AssetDetails ( data . AssetDetails , context ) ; } if ( data . AssetType !== undefined && data . AssetType !== null ) { contents . AssetType = __expectString ( data . AssetType ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . DataSetId !== undefined && data . DataSetId !== null ) { contents . DataSetId = __expectString ( data . DataSetId ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . RevisionId !== undefined && data . RevisionId !== null ) { contents . RevisionId = __expectString ( data . RevisionId ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAssetCommandError = async ( output , context ) : Promise < GetAssetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetDataSetCommand = async ( output , context ) : Promise < GetDataSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDataSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , AssetType : undefined , CreatedAt : undefined , Description : undefined , Id : undefined , Name : undefined , Origin : undefined , OriginDetails : undefined , SourceId : undefined , Tags : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . AssetType !== undefined && data . AssetType !== null ) { contents . AssetType = __expectString ( data . AssetType ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . Origin !== undefined && data . Origin !== null ) { contents . Origin = __expectString ( data . Origin ) ; } if ( data . OriginDetails !== undefined && data . OriginDetails !== null ) { contents . OriginDetails = deserializeAws_restJson1OriginDetails ( data . OriginDetails , context ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1MapOf__string ( data . Tags , context ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDataSetCommandError = async ( output , context ) : Promise < GetDataSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetEventActionCommand = async ( output , context ) : Promise < GetEventActionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEventActionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Action : undefined , Arn : undefined , CreatedAt : undefined , Event : undefined , Id : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Action !== undefined && data . Action !== null ) { contents . Action = deserializeAws_restJson1Action ( data . Action , context ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Event !== undefined && data . Event !== null ) { contents . Event = deserializeAws_restJson1Event ( data . Event , context ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEventActionCommandError = async ( output , context ) : Promise < GetEventActionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetJobCommand = async ( output , context ) : Promise < GetJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , CreatedAt : undefined , Details : undefined , Errors : undefined , Id : undefined , State : undefined , Type : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Details !== undefined && data . Details !== null ) { contents . Details = deserializeAws_restJson1ResponseDetails ( data . Details , context ) ; } if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1ListOfJobError ( data . Errors , context ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetJobCommandError = async ( output , context ) : Promise < GetJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1GetRevisionCommand = async ( output , context ) : Promise < GetRevisionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRevisionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Comment : undefined , CreatedAt : undefined , DataSetId : undefined , Finalized : undefined , Id : undefined , SourceId : undefined , Tags : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . Comment !== undefined && data . Comment !== null ) { contents . Comment = __expectString ( data . Comment ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . DataSetId !== undefined && data . DataSetId !== null ) { contents . DataSetId = __expectString ( data . DataSetId ) ; } if ( data . Finalized !== undefined && data . Finalized !== null ) { contents . Finalized = __expectBoolean ( data . Finalized ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1MapOf__string ( data . Tags , context ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRevisionCommandError = async ( output , context ) : Promise < GetRevisionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListDataSetRevisionsCommand = async ( output , context ) : Promise < ListDataSetRevisionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDataSetRevisionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Revisions : 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 . Revisions !== undefined && data . Revisions !== null ) { contents . Revisions = deserializeAws_restJson1ListOfRevisionEntry ( data . Revisions , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDataSetRevisionsCommandError = async ( output , context ) : Promise < ListDataSetRevisionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListDataSetsCommand = async ( output , context ) : Promise < ListDataSetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDataSetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DataSets : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DataSets !== undefined && data . DataSets !== null ) { contents . DataSets = deserializeAws_restJson1ListOfDataSetEntry ( data . DataSets , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDataSetsCommandError = async ( output , context ) : Promise < ListDataSetsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListEventActionsCommand = async ( output , context ) : Promise < ListEventActionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEventActionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventActions : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . EventActions !== undefined && data . EventActions !== null ) { contents . EventActions = deserializeAws_restJson1ListOfEventActionEntry ( data . EventActions , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEventActionsCommandError = async ( output , context ) : Promise < ListEventActionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListJobsCommand = async ( output , context ) : Promise < ListJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Jobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Jobs !== undefined && data . Jobs !== null ) { contents . Jobs = deserializeAws_restJson1ListOfJobEntry ( data . Jobs , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListJobsCommandError = async ( output , context ) : Promise < ListJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1ListRevisionAssetsCommand = async ( output , context ) : Promise < ListRevisionAssetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRevisionAssetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Assets : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Assets !== undefined && data . Assets !== null ) { contents . Assets = deserializeAws_restJson1ListOfAssetEntry ( data . Assets , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRevisionAssetsCommandError = async ( output , context ) : Promise < ListRevisionAssetsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1MapOf__string ( 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 ) { 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_restJson1SendApiAssetCommand = async ( output , context ) : Promise < SendApiAssetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendApiAssetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Body : undefined , ResponseHeaders : undefined , } ; Object . keys ( output . headers ) . forEach ( ( header ) => { if ( contents . ResponseHeaders === undefined ) { contents . ResponseHeaders = { } ; } if ( header . startsWith ( "" ) ) { contents . ResponseHeaders [ header . substring ( 0 ) ] = output . headers [ header ] ; } } ) ; const data = await collectBodyString ( output . body , context ) ; contents . Body = __expectString ( data ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendApiAssetCommandError = async ( output , context ) : Promise < SendApiAssetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1StartJobCommand = async ( output , context ) : Promise < StartJobCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartJobCommandError = async ( output , context ) : Promise < StartJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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 ) { 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 ) { 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_restJson1UpdateAssetCommand = async ( output , context ) : Promise < UpdateAssetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAssetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , AssetDetails : undefined , AssetType : undefined , CreatedAt : undefined , DataSetId : undefined , Id : undefined , Name : undefined , RevisionId : undefined , SourceId : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . AssetDetails !== undefined && data . AssetDetails !== null ) { contents . AssetDetails = deserializeAws_restJson1AssetDetails ( data . AssetDetails , context ) ; } if ( data . AssetType !== undefined && data . AssetType !== null ) { contents . AssetType = __expectString ( data . AssetType ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . DataSetId !== undefined && data . DataSetId !== null ) { contents . DataSetId = __expectString ( data . DataSetId ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . RevisionId !== undefined && data . RevisionId !== null ) { contents . RevisionId = __expectString ( data . RevisionId ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAssetCommandError = async ( output , context ) : Promise < UpdateAssetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1UpdateDataSetCommand = async ( output , context ) : Promise < UpdateDataSetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDataSetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , AssetType : undefined , CreatedAt : undefined , Description : undefined , Id : undefined , Name : undefined , Origin : undefined , OriginDetails : undefined , SourceId : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . AssetType !== undefined && data . AssetType !== null ) { contents . AssetType = __expectString ( data . AssetType ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . Origin !== undefined && data . Origin !== null ) { contents . Origin = __expectString ( data . Origin ) ; } if ( data . OriginDetails !== undefined && data . OriginDetails !== null ) { contents . OriginDetails = deserializeAws_restJson1OriginDetails ( data . OriginDetails , context ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDataSetCommandError = async ( output , context ) : Promise < UpdateDataSetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1UpdateEventActionCommand = async ( output , context ) : Promise < UpdateEventActionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEventActionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Action : undefined , Arn : undefined , CreatedAt : undefined , Event : undefined , Id : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Action !== undefined && data . Action !== null ) { contents . Action = deserializeAws_restJson1Action ( data . Action , context ) ; } if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . Event !== undefined && data . Event !== null ) { contents . Event = deserializeAws_restJson1Event ( data . Event , context ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEventActionCommandError = async ( output , context ) : Promise < UpdateEventActionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1UpdateRevisionCommand = async ( output , context ) : Promise < UpdateRevisionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRevisionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Comment : undefined , CreatedAt : undefined , DataSetId : undefined , Finalized : undefined , Id : undefined , SourceId : undefined , UpdatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } if ( data . Comment !== undefined && data . Comment !== null ) { contents . Comment = __expectString ( data . Comment ) ; } if ( data . CreatedAt !== undefined && data . CreatedAt !== null ) { contents . CreatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . CreatedAt ) ) ; } if ( data . DataSetId !== undefined && data . DataSetId !== null ) { contents . DataSetId = __expectString ( data . DataSetId ) ; } if ( data . Finalized !== undefined && data . Finalized !== null ) { contents . Finalized = __expectBoolean ( data . Finalized ) ; } if ( data . Id !== undefined && data . Id !== null ) { contents . Id = __expectString ( data . Id ) ; } if ( data . SourceId !== undefined && data . SourceId !== null ) { contents . SourceId = __expectString ( data . SourceId ) ; } if ( data . UpdatedAt !== undefined && data . UpdatedAt !== null ) { contents . UpdatedAt = __expectNonNull ( __parseRfc3339DateTime ( data . UpdatedAt ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRevisionCommandError = async ( output , context ) : Promise < UpdateRevisionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.dataexchange#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.dataexchange#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.dataexchange#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.dataexchange#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.dataexchange#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.dataexchange#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( 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_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , ResourceId : undefined , ResourceType : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , ResourceId : undefined , ResourceType : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } return contents ; } ; const deserializeAws_restJson1ServiceLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceLimitExceededException > => { const contents = { name : "ServiceLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , LimitName : undefined , LimitValue : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . LimitName !== undefined && data . LimitName !== null ) { contents . LimitName = __expectString ( data . LimitName ) ; } if ( data . LimitValue !== undefined && data . LimitValue !== null ) { contents . LimitValue = __limitedParseDouble ( data . LimitValue ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ExceptionCause : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ExceptionCause !== undefined && data . ExceptionCause !== null ) { contents . ExceptionCause = __expectString ( data . ExceptionCause ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const serializeAws_restJson1Action = ( input , context ) : any => { return { ... ( input . ExportRevisionToS3 !== undefined && input . ExportRevisionToS3 !== null && { ExportRevisionToS3 : serializeAws_restJson1AutoExportRevisionToS3RequestDetails ( input . ExportRevisionToS3 , context ) , } ) , } ; } ; const serializeAws_restJson1AssetDestinationEntry = ( input , context ) : any => { return { ... ( input . AssetId !== undefined && input . AssetId !== null && { AssetId : input . AssetId } ) , ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , } ; } ; const serializeAws_restJson1AssetSourceEntry = ( input , context ) : any => { return { ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , } ; } ; const serializeAws_restJson1AutoExportRevisionDestinationEntry = ( input , context ) : any => { return { ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . KeyPattern !== undefined && input . KeyPattern !== null && { KeyPattern : input . KeyPattern } ) , } ; } ; const serializeAws_restJson1AutoExportRevisionToS3RequestDetails = ( input , context ) : any => { return { ... ( input . Encryption !== undefined && input . Encryption !== null && { Encryption : serializeAws_restJson1ExportServerSideEncryption ( input . Encryption , context ) , } ) , ... ( input . RevisionDestination !== undefined && input . RevisionDestination !== null && { RevisionDestination : serializeAws_restJson1AutoExportRevisionDestinationEntry ( input . RevisionDestination , context ) , } ) , } ; } ; const serializeAws_restJson1Event = ( input , context ) : any => { return { ... ( input . RevisionPublished !== undefined && input . RevisionPublished !== null && { RevisionPublished : serializeAws_restJson1RevisionPublished ( input . RevisionPublished , context ) , } ) , } ; } ; const serializeAws_restJson1ExportAssetsToS3RequestDetails = ( input , context ) : any => { return { ... ( input . AssetDestinations !== undefined && input . AssetDestinations !== null && { AssetDestinations : serializeAws_restJson1ListOfAssetDestinationEntry ( input . AssetDestinations , context ) , } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . Encryption !== undefined && input . Encryption !== null && { Encryption : serializeAws_restJson1ExportServerSideEncryption ( input . Encryption , context ) , } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1ExportAssetToSignedUrlRequestDetails = ( input , context ) : any => { return { ... ( input . AssetId !== undefined && input . AssetId !== null && { AssetId : input . AssetId } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1ExportRevisionsToS3RequestDetails = ( input , context ) : any => { return { ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . Encryption !== undefined && input . Encryption !== null && { Encryption : serializeAws_restJson1ExportServerSideEncryption ( input . Encryption , context ) , } ) , ... ( input . RevisionDestinations !== undefined && input . RevisionDestinations !== null && { RevisionDestinations : serializeAws_restJson1ListOfRevisionDestinationEntry ( input . RevisionDestinations , context ) , } ) , } ; } ; const serializeAws_restJson1ExportServerSideEncryption = ( input , context ) : any => { return { ... ( input . KmsKeyArn !== undefined && input . KmsKeyArn !== null && { KmsKeyArn : input . KmsKeyArn } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_restJson1ImportAssetFromApiGatewayApiRequestDetails = ( input , context ) : any => { return { ... ( input . ApiDescription !== undefined && input . ApiDescription !== null && { ApiDescription : input . ApiDescription } ) , ... ( input . ApiId !== undefined && input . ApiId !== null && { ApiId : input . ApiId } ) , ... ( input . ApiKey !== undefined && input . ApiKey !== null && { ApiKey : input . ApiKey } ) , ... ( input . ApiName !== undefined && input . ApiName !== null && { ApiName : input . ApiName } ) , ... ( input . ApiSpecificationMd5Hash !== undefined && input . ApiSpecificationMd5Hash !== null && { ApiSpecificationMd5Hash : input . ApiSpecificationMd5Hash } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . ProtocolType !== undefined && input . ProtocolType !== null && { ProtocolType : input . ProtocolType } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , ... ( input . Stage !== undefined && input . Stage !== null && { Stage : input . Stage } ) , } ; } ; const serializeAws_restJson1ImportAssetFromSignedUrlRequestDetails = ( input , context ) : any => { return { ... ( input . AssetName !== undefined && input . AssetName !== null && { AssetName : input . AssetName } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . Md5Hash !== undefined && input . Md5Hash !== null && { Md5Hash : input . Md5Hash } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1ImportAssetsFromRedshiftDataSharesRequestDetails = ( input , context ) : any => { return { ... ( input . AssetSources !== undefined && input . AssetSources !== null && { AssetSources : serializeAws_restJson1ListOfRedshiftDataShareAssetSourceEntry ( input . AssetSources , context ) , } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1ImportAssetsFromS3RequestDetails = ( input , context ) : any => { return { ... ( input . AssetSources !== undefined && input . AssetSources !== null && { AssetSources : serializeAws_restJson1ListOfAssetSourceEntry ( input . AssetSources , context ) , } ) , ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1ListOfAssetDestinationEntry = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AssetDestinationEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfAssetSourceEntry = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AssetSourceEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfRedshiftDataShareAssetSourceEntry = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1RedshiftDataShareAssetSourceEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfRevisionDestinationEntry = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1RevisionDestinationEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1MapOf__string = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1RedshiftDataShareAssetSourceEntry = ( input , context ) : any => { return { ... ( input . DataShareArn !== undefined && input . DataShareArn !== null && { DataShareArn : input . DataShareArn } ) , } ; } ; const serializeAws_restJson1RequestDetails = ( input , context ) : any => { return { ... ( input . ExportAssetToSignedUrl !== undefined && input . ExportAssetToSignedUrl !== null && { ExportAssetToSignedUrl : serializeAws_restJson1ExportAssetToSignedUrlRequestDetails ( input . ExportAssetToSignedUrl , context ) , } ) , ... ( input . ExportAssetsToS3 !== undefined && input . ExportAssetsToS3 !== null && { ExportAssetsToS3 : serializeAws_restJson1ExportAssetsToS3RequestDetails ( input . ExportAssetsToS3 , context ) , } ) , ... ( input . ExportRevisionsToS3 !== undefined && input . ExportRevisionsToS3 !== null && { ExportRevisionsToS3 : serializeAws_restJson1ExportRevisionsToS3RequestDetails ( input . ExportRevisionsToS3 , context ) , } ) , ... ( input . ImportAssetFromApiGatewayApi !== undefined && input . ImportAssetFromApiGatewayApi !== null && { ImportAssetFromApiGatewayApi : serializeAws_restJson1ImportAssetFromApiGatewayApiRequestDetails ( input . ImportAssetFromApiGatewayApi , context ) , } ) , ... ( input . ImportAssetFromSignedUrl !== undefined && input . ImportAssetFromSignedUrl !== null && { ImportAssetFromSignedUrl : serializeAws_restJson1ImportAssetFromSignedUrlRequestDetails ( input . ImportAssetFromSignedUrl , context ) , } ) , ... ( input . ImportAssetsFromRedshiftDataShares !== undefined && input . ImportAssetsFromRedshiftDataShares !== null && { ImportAssetsFromRedshiftDataShares : serializeAws_restJson1ImportAssetsFromRedshiftDataSharesRequestDetails ( input . ImportAssetsFromRedshiftDataShares , context ) , } ) , ... ( input . ImportAssetsFromS3 !== undefined && input . ImportAssetsFromS3 !== null && { ImportAssetsFromS3 : serializeAws_restJson1ImportAssetsFromS3RequestDetails ( input . ImportAssetsFromS3 , context ) , } ) , } ; } ; const serializeAws_restJson1RevisionDestinationEntry = ( input , context ) : any => { return { ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . KeyPattern !== undefined && input . KeyPattern !== null && { KeyPattern : input . KeyPattern } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ; } ; const serializeAws_restJson1RevisionPublished = ( input , context ) : any => { return { ... ( input . DataSetId !== undefined && input . DataSetId !== null && { DataSetId : input . DataSetId } ) , } ; } ; const deserializeAws_restJson1Action = ( output , context ) : Action => { return { ExportRevisionToS3 : output . ExportRevisionToS3 !== undefined && output . ExportRevisionToS3 !== null ? deserializeAws_restJson1AutoExportRevisionToS3RequestDetails ( output . ExportRevisionToS3 , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ApiGatewayApiAsset = ( output , context ) : ApiGatewayApiAsset => { return { ApiDescription : __expectString ( output . ApiDescription ) , ApiEndpoint : __expectString ( output . ApiEndpoint ) , ApiId : __expectString ( output . ApiId ) , ApiKey : __expectString ( output . ApiKey ) , ApiName : __expectString ( output . ApiName ) , ApiSpecificationDownloadUrl : __expectString ( output . ApiSpecificationDownloadUrl ) , ApiSpecificationDownloadUrlExpiresAt : output . ApiSpecificationDownloadUrlExpiresAt !== undefined && output . ApiSpecificationDownloadUrlExpiresAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . ApiSpecificationDownloadUrlExpiresAt ) ) : undefined , ProtocolType : __expectString ( output . ProtocolType ) , Stage : __expectString ( output . Stage ) , } as any ; } ; const deserializeAws_restJson1AssetDestinationEntry = ( output , context ) : AssetDestinationEntry => { return { AssetId : __expectString ( output . AssetId ) , Bucket : __expectString ( output . Bucket ) , Key : __expectString ( output . Key ) , } as any ; } ; const deserializeAws_restJson1AssetDetails = ( output , context ) : AssetDetails => { return { ApiGatewayApiAsset : output . ApiGatewayApiAsset !== undefined && output . ApiGatewayApiAsset !== null ? deserializeAws_restJson1ApiGatewayApiAsset ( output . ApiGatewayApiAsset , context ) : undefined , RedshiftDataShareAsset : output . RedshiftDataShareAsset !== undefined && output . RedshiftDataShareAsset !== null ? deserializeAws_restJson1RedshiftDataShareAsset ( output . RedshiftDataShareAsset , context ) : undefined , S3SnapshotAsset : output . S3SnapshotAsset !== undefined && output . S3SnapshotAsset !== null ? deserializeAws_restJson1S3SnapshotAsset ( output . S3SnapshotAsset , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AssetEntry = ( output , context ) : AssetEntry => { return { Arn : __expectString ( output . Arn ) , AssetDetails : output . AssetDetails !== undefined && output . AssetDetails !== null ? deserializeAws_restJson1AssetDetails ( output . AssetDetails , context ) : undefined , AssetType : __expectString ( output . AssetType ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedAt ) ) : undefined , DataSetId : __expectString ( output . DataSetId ) , Id : __expectString ( output . Id ) , Name : __expectString ( output . Name ) , RevisionId : __expectString ( output . RevisionId ) , SourceId : __expectString ( output . SourceId ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdatedAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1AssetSourceEntry = ( output , context ) : AssetSourceEntry => { return { Bucket : __expectString ( output . Bucket ) , Key : __expectString ( output . Key ) , } as any ; } ; const deserializeAws_restJson1AutoExportRevisionDestinationEntry = ( output , context ) : AutoExportRevisionDestinationEntry => { return { Bucket : __expectString ( output . Bucket ) , KeyPattern : __expectString ( output . KeyPattern ) , } as any ; } ; const deserializeAws_restJson1AutoExportRevisionToS3RequestDetails = ( output , context ) : AutoExportRevisionToS3RequestDetails => { return { Encryption : output . Encryption !== undefined && output . Encryption !== null ? deserializeAws_restJson1ExportServerSideEncryption ( output . Encryption , context ) : undefined , RevisionDestination : output . RevisionDestination !== undefined && output . RevisionDestination !== null ? deserializeAws_restJson1AutoExportRevisionDestinationEntry ( output . RevisionDestination , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DataSetEntry = ( output , context ) : DataSetEntry => { return { Arn : __expectString ( output . Arn ) , AssetType : __expectString ( output . AssetType ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedAt ) ) : undefined , Description : __expectString ( output . Description ) , Id : __expectString ( output . Id ) , Name : __expectString ( output . Name ) , Origin : __expectString ( output . Origin ) , OriginDetails : output . OriginDetails !== undefined && output . OriginDetails !== null ? deserializeAws_restJson1OriginDetails ( output . OriginDetails , context ) : undefined , SourceId : __expectString ( output . SourceId ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdatedAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1Details = ( output , context ) : Details => { return { ImportAssetFromSignedUrlJobErrorDetails : output . ImportAssetFromSignedUrlJobErrorDetails !== undefined && output . ImportAssetFromSignedUrlJobErrorDetails !== null ? deserializeAws_restJson1ImportAssetFromSignedUrlJobErrorDetails ( output . ImportAssetFromSignedUrlJobErrorDetails , context ) : undefined , ImportAssetsFromS3JobErrorDetails : output . ImportAssetsFromS3JobErrorDetails !== undefined && output . ImportAssetsFromS3JobErrorDetails !== null ? deserializeAws_restJson1ListOfAssetSourceEntry ( output . ImportAssetsFromS3JobErrorDetails , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Event = ( output , context ) : Event => { return { RevisionPublished : output . RevisionPublished !== undefined && output . RevisionPublished !== null ? deserializeAws_restJson1RevisionPublished ( output . RevisionPublished , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EventActionEntry = ( output , context ) : EventActionEntry => { return { Action : output . Action !== undefined && output . Action !== null ? deserializeAws_restJson1Action ( output . Action , context ) : undefined , Arn : __expectString ( output . Arn ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedAt ) ) : undefined , Event : output . Event !== undefined && output . Event !== null ? deserializeAws_restJson1Event ( output . Event , context ) : undefined , Id : __expectString ( output . Id ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdatedAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ExportAssetsToS3ResponseDetails = ( output , context ) : ExportAssetsToS3ResponseDetails => { return { AssetDestinations : output . AssetDestinations !== undefined && output . AssetDestinations !== null ? deserializeAws_restJson1ListOfAssetDestinationEntry ( output . AssetDestinations , context ) : undefined , DataSetId : __expectString ( output . DataSetId ) , Encryption : output . Encryption !== undefined && output . Encryption !== null ? deserializeAws_restJson1ExportServerSideEncryption ( output . Encryption , context ) : undefined , RevisionId : __expectString ( output . RevisionId ) , } as any ; } ; const deserializeAws_restJson1ExportAssetToSignedUrlResponseDetails = ( output , context ) : ExportAssetToSignedUrlResponseDetails => { return { AssetId : __expectString ( output . AssetId ) , DataSetId : __expectString ( output . DataSetId ) , RevisionId : __expectString ( output . RevisionId ) , SignedUrl : __expectString ( output . SignedUrl ) , SignedUrlExpiresAt : output . SignedUrlExpiresAt !== undefined && output . SignedUrlExpiresAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SignedUrlExpiresAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ExportRevisionsToS3ResponseDetails = ( output , context ) : ExportRevisionsToS3ResponseDetails => { return { DataSetId : __expectString ( output . DataSetId ) , Encryption : output . Encryption !== undefined && output . Encryption !== null ? deserializeAws_restJson1ExportServerSideEncryption ( output . Encryption , context ) : undefined , EventActionArn : __expectString ( output . EventActionArn ) , RevisionDestinations : output . RevisionDestinations !== undefined && output . RevisionDestinations !== null ? deserializeAws_restJson1ListOfRevisionDestinationEntry ( output . RevisionDestinations , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ExportServerSideEncryption = ( output , context ) : ExportServerSideEncryption => { return { KmsKeyArn : __expectString ( output . KmsKeyArn ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1ImportAssetFromApiGatewayApiResponseDetails = ( output , context ) : ImportAssetFromApiGatewayApiResponseDetails => { return { ApiDescription : __expectString ( output . ApiDescription ) , ApiId : __expectString ( output . ApiId ) , ApiKey : __expectString ( output . ApiKey ) , ApiName : __expectString ( output . ApiName ) , ApiSpecificationMd5Hash : __expectString ( output . ApiSpecificationMd5Hash ) , ApiSpecificationUploadUrl : __expectString ( output . ApiSpecificationUploadUrl ) , ApiSpecificationUploadUrlExpiresAt : output . ApiSpecificationUploadUrlExpiresAt !== undefined && output . ApiSpecificationUploadUrlExpiresAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . ApiSpecificationUploadUrlExpiresAt ) ) : undefined , DataSetId : __expectString ( output . DataSetId ) , ProtocolType : __expectString ( output . ProtocolType ) , RevisionId : __expectString ( output . RevisionId ) , Stage : __expectString ( output . Stage ) , } as any ; } ; const deserializeAws_restJson1ImportAssetFromSignedUrlJobErrorDetails = ( output , context ) : ImportAssetFromSignedUrlJobErrorDetails => { return { AssetName : __expectString ( output . AssetName ) , } as any ; } ; const deserializeAws_restJson1ImportAssetFromSignedUrlResponseDetails = ( output , context ) : ImportAssetFromSignedUrlResponseDetails => { return { AssetName : __expectString ( output . AssetName ) , DataSetId : __expectString ( output . DataSetId ) , Md5Hash : __expectString ( output . Md5Hash ) , RevisionId : __expectString ( output . RevisionId ) , SignedUrl : __expectString ( output . SignedUrl ) , SignedUrlExpiresAt : output . SignedUrlExpiresAt !== undefined && output . SignedUrlExpiresAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SignedUrlExpiresAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ImportAssetsFromRedshiftDataSharesResponseDetails = ( output , context ) : ImportAssetsFromRedshiftDataSharesResponseDetails => { return { AssetSources : output . AssetSources !== undefined && output . AssetSources !== null ? deserializeAws_restJson1ListOfRedshiftDataShareAssetSourceEntry ( output . AssetSources , context ) : undefined , DataSetId : __expectString ( output . DataSetId ) , RevisionId : __expectString ( output . RevisionId ) , } as any ; } ; const deserializeAws_restJson1ImportAssetsFromS3ResponseDetails = ( output , context ) : ImportAssetsFromS3ResponseDetails => { return { AssetSources : output . AssetSources !== undefined && output . AssetSources !== null ? deserializeAws_restJson1ListOfAssetSourceEntry ( output . AssetSources , context ) : undefined , DataSetId : __expectString ( output . DataSetId ) , RevisionId : __expectString ( output . RevisionId ) , } as any ; } ; const deserializeAws_restJson1JobEntry = ( output , context ) : JobEntry => { return { Arn : __expectString ( output . Arn ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedAt ) ) : undefined , Details : output . Details !== undefined && output . Details !== null ? deserializeAws_restJson1ResponseDetails ( output . Details , context ) : undefined , Errors : output . Errors !== undefined && output . Errors !== null ? deserializeAws_restJson1ListOfJobError ( output . Errors , context ) : undefined , Id : __expectString ( output . Id ) , State : __expectString ( output . State ) , Type : __expectString ( output . Type ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdatedAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1JobError = ( output , context ) : JobError => { return { Code : __expectString ( output . Code ) , Details : output . Details !== undefined && output . Details !== null ? deserializeAws_restJson1Details ( output . Details , context ) : undefined , LimitName : __expectString ( output . LimitName ) , LimitValue : __limitedParseDouble ( output . LimitValue ) , Message : __expectString ( output . Message ) , ResourceId : __expectString ( output . ResourceId ) , ResourceType : __expectString ( output . ResourceType ) , } as any ; } ; const deserializeAws_restJson1ListOfAssetDestinationEntry = ( output , context ) : AssetDestinationEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssetDestinationEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfAssetEntry = ( output , context ) : AssetEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssetEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfAssetSourceEntry = ( output , context ) : AssetSourceEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssetSourceEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfDataSetEntry = ( output , context ) : DataSetEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DataSetEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfEventActionEntry = ( output , context ) : EventActionEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EventActionEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfJobEntry = ( output , context ) : JobEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1JobEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfJobError = ( output , context ) : JobError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1JobError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRedshiftDataShareAssetSourceEntry = ( output , context ) : RedshiftDataShareAssetSourceEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RedshiftDataShareAssetSourceEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRevisionDestinationEntry = ( output , context ) : RevisionDestinationEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RevisionDestinationEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRevisionEntry = ( output , context ) : RevisionEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RevisionEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1MapOf__string = ( 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_restJson1OriginDetails = ( output , context ) : OriginDetails => { return { ProductId : __expectString ( output . ProductId ) , } as any ; } ; const deserializeAws_restJson1RedshiftDataShareAsset = ( output , context ) : RedshiftDataShareAsset => { return { Arn : __expectString ( output . Arn ) , } as any ; } ; const deserializeAws_restJson1RedshiftDataShareAssetSourceEntry = ( output , context ) : RedshiftDataShareAssetSourceEntry => { return { DataShareArn : __expectString ( output . DataShareArn ) , } as any ; } ; const deserializeAws_restJson1ResponseDetails = ( output , context ) : ResponseDetails => { return { ExportAssetToSignedUrl : output . ExportAssetToSignedUrl !== undefined && output . ExportAssetToSignedUrl !== null ? deserializeAws_restJson1ExportAssetToSignedUrlResponseDetails ( output . ExportAssetToSignedUrl , context ) : undefined , ExportAssetsToS3 : output . ExportAssetsToS3 !== undefined && output . ExportAssetsToS3 !== null ? deserializeAws_restJson1ExportAssetsToS3ResponseDetails ( output . ExportAssetsToS3 , context ) : undefined , ExportRevisionsToS3 : output . ExportRevisionsToS3 !== undefined && output . ExportRevisionsToS3 !== null ? deserializeAws_restJson1ExportRevisionsToS3ResponseDetails ( output . ExportRevisionsToS3 , context ) : undefined , ImportAssetFromApiGatewayApi : output . ImportAssetFromApiGatewayApi !== undefined && output . ImportAssetFromApiGatewayApi !== null ? deserializeAws_restJson1ImportAssetFromApiGatewayApiResponseDetails ( output . ImportAssetFromApiGatewayApi , context ) : undefined , ImportAssetFromSignedUrl : output . ImportAssetFromSignedUrl !== undefined && output . ImportAssetFromSignedUrl !== null ? deserializeAws_restJson1ImportAssetFromSignedUrlResponseDetails ( output . ImportAssetFromSignedUrl , context ) : undefined , ImportAssetsFromRedshiftDataShares : output . ImportAssetsFromRedshiftDataShares !== undefined && output . ImportAssetsFromRedshiftDataShares !== null ? deserializeAws_restJson1ImportAssetsFromRedshiftDataSharesResponseDetails ( output . ImportAssetsFromRedshiftDataShares , context ) : undefined , ImportAssetsFromS3 : output . ImportAssetsFromS3 !== undefined && output . ImportAssetsFromS3 !== null ? deserializeAws_restJson1ImportAssetsFromS3ResponseDetails ( output . ImportAssetsFromS3 , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RevisionDestinationEntry = ( output , context ) : RevisionDestinationEntry => { return { Bucket : __expectString ( output . Bucket ) , KeyPattern : __expectString ( output . KeyPattern ) , RevisionId : __expectString ( output . RevisionId ) , } as any ; } ; const deserializeAws_restJson1RevisionEntry = ( output , context ) : RevisionEntry => { return { Arn : __expectString ( output . Arn ) , Comment : __expectString ( output . Comment ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedAt ) ) : undefined , DataSetId : __expectString ( output . DataSetId ) , Finalized : __expectBoolean ( output . Finalized ) , Id : __expectString ( output . Id ) , SourceId : __expectString ( output . SourceId ) , UpdatedAt : output . UpdatedAt !== undefined && output . UpdatedAt !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdatedAt ) ) : undefined , } as any ; } ; const deserializeAws_restJson1RevisionPublished = ( output , context ) : RevisionPublished => { return { DataSetId : __expectString ( output . DataSetId ) , } as any ; } ; const deserializeAws_restJson1S3SnapshotAsset = ( output , context ) : S3SnapshotAsset => { return { Size : __limitedParseDouble ( output . Size ) , } 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 "" ; } ;