import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseFloat32 as __limitedParseFloat32 , parseEpochTimestamp as __parseEpochTimestamp , strictParseInt32 as __strictParseInt32 , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { CreateDatasetCommandInput , CreateDatasetCommandOutput } from "../commands/CreateDatasetCommand" ; import { CreateModelCommandInput , CreateModelCommandOutput } from "../commands/CreateModelCommand" ; import { CreateProjectCommandInput , CreateProjectCommandOutput } from "../commands/CreateProjectCommand" ; import { DeleteDatasetCommandInput , DeleteDatasetCommandOutput } from "../commands/DeleteDatasetCommand" ; import { DeleteModelCommandInput , DeleteModelCommandOutput } from "../commands/DeleteModelCommand" ; import { DeleteProjectCommandInput , DeleteProjectCommandOutput } from "../commands/DeleteProjectCommand" ; import { DescribeDatasetCommandInput , DescribeDatasetCommandOutput } from "../commands/DescribeDatasetCommand" ; import { DescribeModelCommandInput , DescribeModelCommandOutput } from "../commands/DescribeModelCommand" ; import { DescribeModelPackagingJobCommandInput , DescribeModelPackagingJobCommandOutput , } from "../commands/DescribeModelPackagingJobCommand" ; import { DescribeProjectCommandInput , DescribeProjectCommandOutput } from "../commands/DescribeProjectCommand" ; import { DetectAnomaliesCommandInput , DetectAnomaliesCommandOutput } from "../commands/DetectAnomaliesCommand" ; import { ListDatasetEntriesCommandInput , ListDatasetEntriesCommandOutput } from "../commands/ListDatasetEntriesCommand" ; import { ListModelPackagingJobsCommandInput , ListModelPackagingJobsCommandOutput , } from "../commands/ListModelPackagingJobsCommand" ; import { ListModelsCommandInput , ListModelsCommandOutput } from "../commands/ListModelsCommand" ; import { ListProjectsCommandInput , ListProjectsCommandOutput } from "../commands/ListProjectsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { StartModelCommandInput , StartModelCommandOutput } from "../commands/StartModelCommand" ; import { StartModelPackagingJobCommandInput , StartModelPackagingJobCommandOutput , } from "../commands/StartModelPackagingJobCommand" ; import { StopModelCommandInput , StopModelCommandOutput } from "../commands/StopModelCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateDatasetEntriesCommandInput , UpdateDatasetEntriesCommandOutput , } from "../commands/UpdateDatasetEntriesCommand" ; import { AccessDeniedException , ConflictException , DatasetDescription , DatasetGroundTruthManifest , DatasetImageStats , DatasetMetadata , DatasetSource , DetectAnomalyResult , GreengrassConfiguration , GreengrassOutputDetails , ImageSource , InputS3Object , InternalServerException , ModelDescription , ModelMetadata , ModelPackagingConfiguration , ModelPackagingDescription , ModelPackagingJobMetadata , ModelPackagingOutputDetails , ModelPerformance , OutputConfig , OutputS3Object , ProjectDescription , ProjectMetadata , ResourceNotFoundException , S3Location , ServiceQuotaExceededException , Tag , TargetPlatform , ThrottlingException , ValidationException , } from "../models/models_0" ; 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" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/datasets" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . DatasetSource !== undefined && input . DatasetSource !== null && { DatasetSource : serializeAws_restJson1DatasetSource ( input . DatasetSource , context ) , } ) , ... ( input . DatasetType !== undefined && input . DatasetType !== null && { DatasetType : input . DatasetType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/models" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . OutputConfig !== undefined && input . OutputConfig !== null && { OutputConfig : serializeAws_restJson1OutputConfig ( input . OutputConfig , context ) } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateProjectCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects" ; let body ; body = JSON . stringify ( { ... ( input . ProjectName !== undefined && input . ProjectName !== null && { ProjectName : input . ProjectName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , 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 = { ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . DatasetType !== undefined ) { const labelValue = input . DatasetType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DatasetType." ) ; } resolvedPath = resolvedPath . replace ( "{DatasetType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DatasetType." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . ModelVersion !== undefined ) { const labelValue = input . ModelVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ModelVersion." ) ; } resolvedPath = resolvedPath . replace ( "{ModelVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ModelVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteProjectCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeDatasetCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . DatasetType !== undefined ) { const labelValue = input . DatasetType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DatasetType." ) ; } resolvedPath = resolvedPath . replace ( "{DatasetType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DatasetType." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeModelCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . ModelVersion !== undefined ) { const labelValue = input . ModelVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ModelVersion." ) ; } resolvedPath = resolvedPath . replace ( "{ModelVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ModelVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeModelPackagingJobCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/modelpackagingjobs/{JobName}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . JobName !== undefined ) { const labelValue = input . JobName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobName." ) ; } resolvedPath = resolvedPath . replace ( "{JobName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeProjectCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DetectAnomaliesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/octet-stream" , ... ( isSerializableHeaderValue ( input . ContentType ) && { "content-type" : input . ContentType ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/detect" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . ModelVersion !== undefined ) { const labelValue = input . ModelVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ModelVersion." ) ; } resolvedPath = resolvedPath . replace ( "{ModelVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ModelVersion." ) ; } let body ; if ( input . Body !== undefined ) { body = input . Body ; } return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListDatasetEntriesCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . DatasetType !== undefined ) { const labelValue = input . DatasetType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DatasetType." ) ; } resolvedPath = resolvedPath . replace ( "{DatasetType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DatasetType." ) ; } const query = { ... ( input . Labeled !== undefined && { labeled : input . Labeled . toString ( ) } ) , ... ( input . AnomalyClass !== undefined && { anomalyClass : input . AnomalyClass } ) , ... ( input . BeforeCreationDate !== undefined && { createdBefore : ( input . BeforeCreationDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . AfterCreationDate !== undefined && { createdAfter : ( input . AfterCreationDate . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . SourceRefContains !== undefined && { sourceRefContains : input . SourceRefContains } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListModelPackagingJobsCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/modelpackagingjobs" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListModelsCommand = 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 || "" }` + "/2020-11-20/projects/{ProjectName}/models" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListProjectsCommand = 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 || "" }` + "/2020-11-20/projects" ; const query = { ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/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_restJson1StartModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/start" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . ModelVersion !== undefined ) { const labelValue = input . ModelVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ModelVersion." ) ; } resolvedPath = resolvedPath . replace ( "{ModelVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ModelVersion." ) ; } let body ; body = JSON . stringify ( { ... ( input . MinInferenceUnits !== undefined && input . MinInferenceUnits !== null && { MinInferenceUnits : input . MinInferenceUnits } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StartModelPackagingJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/modelpackagingjobs" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Configuration !== undefined && input . Configuration !== null && { Configuration : serializeAws_restJson1ModelPackagingConfiguration ( input . Configuration , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . ModelVersion !== undefined && input . ModelVersion !== null && { ModelVersion : input . ModelVersion } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StopModelCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/stop" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . ModelVersion !== undefined ) { const labelValue = input . ModelVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ModelVersion." ) ; } resolvedPath = resolvedPath . replace ( "{ModelVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ModelVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/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_restJson1TagList ( 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 || "" }` + "/2020-11-20/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_restJson1UpdateDatasetEntriesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , ... ( isSerializableHeaderValue ( input . ClientToken ) && { "x-amzn-client-token" : input . ClientToken ! } ) , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries" ; if ( input . ProjectName !== undefined ) { const labelValue = input . ProjectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ProjectName." ) ; } resolvedPath = resolvedPath . replace ( "{ProjectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ProjectName." ) ; } if ( input . DatasetType !== undefined ) { const labelValue = input . DatasetType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DatasetType." ) ; } resolvedPath = resolvedPath . replace ( "{DatasetType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DatasetType." ) ; } let body ; body = JSON . stringify ( { ... ( input . Changes !== undefined && input . Changes !== null && { Changes : context . base64Encoder ( input . Changes ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateDatasetCommand = async ( output , context ) : Promise < CreateDatasetCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDatasetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DatasetMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DatasetMetadata !== undefined && data . DatasetMetadata !== null ) { contents . DatasetMetadata = deserializeAws_restJson1DatasetMetadata ( data . DatasetMetadata , context ) ; } 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1CreateModelCommand = async ( output , context ) : Promise < CreateModelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ModelMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ModelMetadata !== undefined && data . ModelMetadata !== null ) { contents . ModelMetadata = deserializeAws_restJson1ModelMetadata ( data . ModelMetadata , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateModelCommandError = async ( output , context ) : Promise < CreateModelCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1CreateProjectCommand = async ( output , context ) : Promise < CreateProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ProjectMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ProjectMetadata !== undefined && data . ProjectMetadata !== null ) { contents . ProjectMetadata = deserializeAws_restJson1ProjectMetadata ( data . ProjectMetadata , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateProjectCommandError = async ( output , context ) : Promise < CreateProjectCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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 !== 202 && 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DeleteModelCommand = async ( output , context ) : Promise < DeleteModelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ModelArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ModelArn !== undefined && data . ModelArn !== null ) { contents . ModelArn = __expectString ( data . ModelArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteModelCommandError = async ( output , context ) : Promise < DeleteModelCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DeleteProjectCommand = async ( output , context ) : Promise < DeleteProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ProjectArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ProjectArn !== undefined && data . ProjectArn !== null ) { contents . ProjectArn = __expectString ( data . ProjectArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteProjectCommandError = async ( output , context ) : Promise < DeleteProjectCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DescribeDatasetCommand = async ( output , context ) : Promise < DescribeDatasetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeDatasetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DatasetDescription : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DatasetDescription !== undefined && data . DatasetDescription !== null ) { contents . DatasetDescription = deserializeAws_restJson1DatasetDescription ( data . DatasetDescription , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeDatasetCommandError = async ( output , context ) : Promise < DescribeDatasetCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DescribeModelCommand = async ( output , context ) : Promise < DescribeModelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ModelDescription : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ModelDescription !== undefined && data . ModelDescription !== null ) { contents . ModelDescription = deserializeAws_restJson1ModelDescription ( data . ModelDescription , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeModelCommandError = async ( output , context ) : Promise < DescribeModelCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DescribeModelPackagingJobCommand = async ( output , context ) : Promise < DescribeModelPackagingJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeModelPackagingJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ModelPackagingDescription : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ModelPackagingDescription !== undefined && data . ModelPackagingDescription !== null ) { contents . ModelPackagingDescription = deserializeAws_restJson1ModelPackagingDescription ( data . ModelPackagingDescription , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeModelPackagingJobCommandError = async ( output , context ) : Promise < DescribeModelPackagingJobCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DescribeProjectCommand = async ( output , context ) : Promise < DescribeProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ProjectDescription : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ProjectDescription !== undefined && data . ProjectDescription !== null ) { contents . ProjectDescription = deserializeAws_restJson1ProjectDescription ( data . ProjectDescription , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeProjectCommandError = async ( output , context ) : Promise < DescribeProjectCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1DetectAnomaliesCommand = async ( output , context ) : Promise < DetectAnomaliesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DetectAnomaliesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DetectAnomalyResult : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DetectAnomalyResult !== undefined && data . DetectAnomalyResult !== null ) { contents . DetectAnomalyResult = deserializeAws_restJson1DetectAnomalyResult ( data . DetectAnomalyResult , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DetectAnomaliesCommandError = async ( output , context ) : Promise < DetectAnomaliesCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1ListDatasetEntriesCommand = async ( output , context ) : Promise < ListDatasetEntriesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDatasetEntriesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DatasetEntries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DatasetEntries !== undefined && data . DatasetEntries !== null ) { contents . DatasetEntries = deserializeAws_restJson1DatasetEntryList ( data . DatasetEntries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDatasetEntriesCommandError = async ( output , context ) : Promise < ListDatasetEntriesCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1ListModelPackagingJobsCommand = async ( output , context ) : Promise < ListModelPackagingJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListModelPackagingJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ModelPackagingJobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ModelPackagingJobs !== undefined && data . ModelPackagingJobs !== null ) { contents . ModelPackagingJobs = deserializeAws_restJson1ModelPackagingJobsList ( data . ModelPackagingJobs , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListModelPackagingJobsCommandError = async ( output , context ) : Promise < ListModelPackagingJobsCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1ListModelsCommand = async ( output , context ) : Promise < ListModelsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListModelsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Models : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Models !== undefined && data . Models !== null ) { contents . Models = deserializeAws_restJson1ModelMetadataList ( data . Models , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListModelsCommandError = async ( output , context ) : Promise < ListModelsCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1ListProjectsCommand = async ( output , context ) : Promise < ListProjectsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListProjectsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Projects : 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 . Projects !== undefined && data . Projects !== null ) { contents . Projects = deserializeAws_restJson1ProjectMetadataList ( data . Projects , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListProjectsCommandError = async ( output , context ) : Promise < ListProjectsCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1TagList ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1StartModelCommand = async ( output , context ) : Promise < StartModelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartModelCommandError = async ( output , context ) : Promise < StartModelCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1StartModelPackagingJobCommand = async ( output , context ) : Promise < StartModelPackagingJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartModelPackagingJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JobName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . JobName !== undefined && data . JobName !== null ) { contents . JobName = __expectString ( data . JobName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartModelPackagingJobCommandError = async ( output , context ) : Promise < StartModelPackagingJobCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1StopModelCommand = async ( output , context ) : Promise < StopModelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1StopModelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StopModelCommandError = async ( output , context ) : Promise < StopModelCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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 !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.lookoutvision#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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_restJson1UpdateDatasetEntriesCommand = async ( output , context ) : Promise < UpdateDatasetEntriesCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDatasetEntriesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDatasetEntriesCommandError = async ( output , context ) : Promise < UpdateDatasetEntriesCommandOutput > => { 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.lookoutvision#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.lookoutvision#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.lookoutvision#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.lookoutvision#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.lookoutvision#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.lookoutvision#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 , RetryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . RetryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } 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_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , QuotaCode : undefined , ResourceId : undefined , ResourceType : undefined , ServiceCode : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . QuotaCode !== undefined && data . QuotaCode !== null ) { contents . QuotaCode = __expectString ( data . QuotaCode ) ; } if ( data . ResourceId !== undefined && data . ResourceId !== null ) { contents . ResourceId = __expectString ( data . ResourceId ) ; } if ( data . ResourceType !== undefined && data . ResourceType !== null ) { contents . ResourceType = __expectString ( data . ResourceType ) ; } if ( data . ServiceCode !== undefined && data . ServiceCode !== null ) { contents . ServiceCode = __expectString ( data . ServiceCode ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , QuotaCode : undefined , RetryAfterSeconds : undefined , ServiceCode : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . RetryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . QuotaCode !== undefined && data . QuotaCode !== null ) { contents . QuotaCode = __expectString ( data . QuotaCode ) ; } if ( data . ServiceCode !== undefined && data . ServiceCode !== null ) { contents . ServiceCode = __expectString ( data . ServiceCode ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const serializeAws_restJson1DatasetGroundTruthManifest = ( input , context ) : any => { return { ... ( input . S3Object !== undefined && input . S3Object !== null && { S3Object : serializeAws_restJson1InputS3Object ( input . S3Object , context ) } ) , } ; } ; const serializeAws_restJson1DatasetSource = ( input , context ) : any => { return { ... ( input . GroundTruthManifest !== undefined && input . GroundTruthManifest !== null && { GroundTruthManifest : serializeAws_restJson1DatasetGroundTruthManifest ( input . GroundTruthManifest , context ) , } ) , } ; } ; const serializeAws_restJson1GreengrassConfiguration = ( input , context ) : any => { return { ... ( input . CompilerOptions !== undefined && input . CompilerOptions !== null && { CompilerOptions : input . CompilerOptions } ) , ... ( input . ComponentDescription !== undefined && input . ComponentDescription !== null && { ComponentDescription : input . ComponentDescription } ) , ... ( input . ComponentName !== undefined && input . ComponentName !== null && { ComponentName : input . ComponentName } ) , ... ( input . ComponentVersion !== undefined && input . ComponentVersion !== null && { ComponentVersion : input . ComponentVersion } ) , ... ( input . S3OutputLocation !== undefined && input . S3OutputLocation !== null && { S3OutputLocation : serializeAws_restJson1S3Location ( input . S3OutputLocation , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagList ( input . Tags , context ) } ) , ... ( input . TargetDevice !== undefined && input . TargetDevice !== null && { TargetDevice : input . TargetDevice } ) , ... ( input . TargetPlatform !== undefined && input . TargetPlatform !== null && { TargetPlatform : serializeAws_restJson1TargetPlatform ( input . TargetPlatform , context ) , } ) , } ; } ; const serializeAws_restJson1InputS3Object = ( input , context ) : any => { return { ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . VersionId !== undefined && input . VersionId !== null && { VersionId : input . VersionId } ) , } ; } ; const serializeAws_restJson1ModelPackagingConfiguration = ( input , context ) : any => { return { ... ( input . Greengrass !== undefined && input . Greengrass !== null && { Greengrass : serializeAws_restJson1GreengrassConfiguration ( input . Greengrass , context ) , } ) , } ; } ; const serializeAws_restJson1OutputConfig = ( input , context ) : any => { return { ... ( input . S3Location !== undefined && input . S3Location !== null && { S3Location : serializeAws_restJson1S3Location ( input . S3Location , context ) } ) , } ; } ; const serializeAws_restJson1S3Location = ( input , context ) : any => { return { ... ( input . Bucket !== undefined && input . Bucket !== null && { Bucket : input . Bucket } ) , ... ( input . Prefix !== undefined && input . Prefix !== null && { Prefix : input . Prefix } ) , } ; } ; const serializeAws_restJson1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1TagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const serializeAws_restJson1TargetPlatform = ( input , context ) : any => { return { ... ( input . Accelerator !== undefined && input . Accelerator !== null && { Accelerator : input . Accelerator } ) , ... ( input . Arch !== undefined && input . Arch !== null && { Arch : input . Arch } ) , ... ( input . Os !== undefined && input . Os !== null && { Os : input . Os } ) , } ; } ; const deserializeAws_restJson1DatasetDescription = ( output , context ) : DatasetDescription => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , DatasetType : __expectString ( output . DatasetType ) , ImageStats : output . ImageStats !== undefined && output . ImageStats !== null ? deserializeAws_restJson1DatasetImageStats ( output . ImageStats , context ) : undefined , LastUpdatedTimestamp : output . LastUpdatedTimestamp !== undefined && output . LastUpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTimestamp ) ) ) : undefined , ProjectName : __expectString ( output . ProjectName ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1DatasetEntryList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1DatasetImageStats = ( output , context ) : DatasetImageStats => { return { Anomaly : __expectInt32 ( output . Anomaly ) , Labeled : __expectInt32 ( output . Labeled ) , Normal : __expectInt32 ( output . Normal ) , Total : __expectInt32 ( output . Total ) , } as any ; } ; const deserializeAws_restJson1DatasetMetadata = ( output , context ) : DatasetMetadata => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , DatasetType : __expectString ( output . DatasetType ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1DatasetMetadataList = ( output , context ) : DatasetMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DatasetMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DetectAnomalyResult = ( output , context ) : DetectAnomalyResult => { return { Confidence : __limitedParseFloat32 ( output . Confidence ) , IsAnomalous : __expectBoolean ( output . IsAnomalous ) , Source : output . Source !== undefined && output . Source !== null ? deserializeAws_restJson1ImageSource ( output . Source , context ) : undefined , } as any ; } ; const deserializeAws_restJson1GreengrassConfiguration = ( output , context ) : GreengrassConfiguration => { return { CompilerOptions : __expectString ( output . CompilerOptions ) , ComponentDescription : __expectString ( output . ComponentDescription ) , ComponentName : __expectString ( output . ComponentName ) , ComponentVersion : __expectString ( output . ComponentVersion ) , S3OutputLocation : output . S3OutputLocation !== undefined && output . S3OutputLocation !== null ? deserializeAws_restJson1S3Location ( output . S3OutputLocation , context ) : undefined , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagList ( output . Tags , context ) : undefined , TargetDevice : __expectString ( output . TargetDevice ) , TargetPlatform : output . TargetPlatform !== undefined && output . TargetPlatform !== null ? deserializeAws_restJson1TargetPlatform ( output . TargetPlatform , context ) : undefined , } as any ; } ; const deserializeAws_restJson1GreengrassOutputDetails = ( output , context ) : GreengrassOutputDetails => { return { ComponentName : __expectString ( output . ComponentName ) , ComponentVersion : __expectString ( output . ComponentVersion ) , ComponentVersionArn : __expectString ( output . ComponentVersionArn ) , } as any ; } ; const deserializeAws_restJson1ImageSource = ( output , context ) : ImageSource => { return { Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1ModelDescription = ( output , context ) : ModelDescription => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , Description : __expectString ( output . Description ) , EvaluationEndTimestamp : output . EvaluationEndTimestamp !== undefined && output . EvaluationEndTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EvaluationEndTimestamp ) ) ) : undefined , EvaluationManifest : output . EvaluationManifest !== undefined && output . EvaluationManifest !== null ? deserializeAws_restJson1OutputS3Object ( output . EvaluationManifest , context ) : undefined , EvaluationResult : output . EvaluationResult !== undefined && output . EvaluationResult !== null ? deserializeAws_restJson1OutputS3Object ( output . EvaluationResult , context ) : undefined , KmsKeyId : __expectString ( output . KmsKeyId ) , ModelArn : __expectString ( output . ModelArn ) , ModelVersion : __expectString ( output . ModelVersion ) , OutputConfig : output . OutputConfig !== undefined && output . OutputConfig !== null ? deserializeAws_restJson1OutputConfig ( output . OutputConfig , context ) : undefined , Performance : output . Performance !== undefined && output . Performance !== null ? deserializeAws_restJson1ModelPerformance ( output . Performance , context ) : undefined , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1ModelMetadata = ( output , context ) : ModelMetadata => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , Description : __expectString ( output . Description ) , ModelArn : __expectString ( output . ModelArn ) , ModelVersion : __expectString ( output . ModelVersion ) , Performance : output . Performance !== undefined && output . Performance !== null ? deserializeAws_restJson1ModelPerformance ( output . Performance , context ) : undefined , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1ModelMetadataList = ( output , context ) : ModelMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ModelMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ModelPackagingConfiguration = ( output , context ) : ModelPackagingConfiguration => { return { Greengrass : output . Greengrass !== undefined && output . Greengrass !== null ? deserializeAws_restJson1GreengrassConfiguration ( output . Greengrass , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ModelPackagingDescription = ( output , context ) : ModelPackagingDescription => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , JobName : __expectString ( output . JobName ) , LastUpdatedTimestamp : output . LastUpdatedTimestamp !== undefined && output . LastUpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTimestamp ) ) ) : undefined , ModelPackagingConfiguration : output . ModelPackagingConfiguration !== undefined && output . ModelPackagingConfiguration !== null ? deserializeAws_restJson1ModelPackagingConfiguration ( output . ModelPackagingConfiguration , context ) : undefined , ModelPackagingJobDescription : __expectString ( output . ModelPackagingJobDescription ) , ModelPackagingMethod : __expectString ( output . ModelPackagingMethod ) , ModelPackagingOutputDetails : output . ModelPackagingOutputDetails !== undefined && output . ModelPackagingOutputDetails !== null ? deserializeAws_restJson1ModelPackagingOutputDetails ( output . ModelPackagingOutputDetails , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , ProjectName : __expectString ( output . ProjectName ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1ModelPackagingJobMetadata = ( output , context ) : ModelPackagingJobMetadata => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , JobName : __expectString ( output . JobName ) , LastUpdatedTimestamp : output . LastUpdatedTimestamp !== undefined && output . LastUpdatedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastUpdatedTimestamp ) ) ) : undefined , ModelPackagingJobDescription : __expectString ( output . ModelPackagingJobDescription ) , ModelPackagingMethod : __expectString ( output . ModelPackagingMethod ) , ModelVersion : __expectString ( output . ModelVersion ) , ProjectName : __expectString ( output . ProjectName ) , Status : __expectString ( output . Status ) , StatusMessage : __expectString ( output . StatusMessage ) , } as any ; } ; const deserializeAws_restJson1ModelPackagingJobsList = ( output , context ) : ModelPackagingJobMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ModelPackagingJobMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ModelPackagingOutputDetails = ( output , context ) : ModelPackagingOutputDetails => { return { Greengrass : output . Greengrass !== undefined && output . Greengrass !== null ? deserializeAws_restJson1GreengrassOutputDetails ( output . Greengrass , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ModelPerformance = ( output , context ) : ModelPerformance => { return { F1Score : __limitedParseFloat32 ( output . F1Score ) , Precision : __limitedParseFloat32 ( output . Precision ) , Recall : __limitedParseFloat32 ( output . Recall ) , } as any ; } ; const deserializeAws_restJson1OutputConfig = ( output , context ) : OutputConfig => { return { S3Location : output . S3Location !== undefined && output . S3Location !== null ? deserializeAws_restJson1S3Location ( output . S3Location , context ) : undefined , } as any ; } ; const deserializeAws_restJson1OutputS3Object = ( output , context ) : OutputS3Object => { return { Bucket : __expectString ( output . Bucket ) , Key : __expectString ( output . Key ) , } as any ; } ; const deserializeAws_restJson1ProjectDescription = ( output , context ) : ProjectDescription => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , Datasets : output . Datasets !== undefined && output . Datasets !== null ? deserializeAws_restJson1DatasetMetadataList ( output . Datasets , context ) : undefined , ProjectArn : __expectString ( output . ProjectArn ) , ProjectName : __expectString ( output . ProjectName ) , } as any ; } ; const deserializeAws_restJson1ProjectMetadata = ( output , context ) : ProjectMetadata => { return { CreationTimestamp : output . CreationTimestamp !== undefined && output . CreationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTimestamp ) ) ) : undefined , ProjectArn : __expectString ( output . ProjectArn ) , ProjectName : __expectString ( output . ProjectName ) , } as any ; } ; const deserializeAws_restJson1ProjectMetadataList = ( output , context ) : ProjectMetadata [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ProjectMetadata ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1S3Location = ( output , context ) : S3Location => { return { Bucket : __expectString ( output . Bucket ) , Prefix : __expectString ( output . Prefix ) , } as any ; } ; const deserializeAws_restJson1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_restJson1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TargetPlatform = ( output , context ) : TargetPlatform => { return { Accelerator : __expectString ( output . Accelerator ) , Arch : __expectString ( output . Arch ) , Os : __expectString ( output . Os ) , } 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 "" ; } ;