import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { BatchCheckLayerAvailabilityCommandInput , BatchCheckLayerAvailabilityCommandOutput , } from "../commands/BatchCheckLayerAvailabilityCommand" ; import { BatchDeleteImageCommandInput , BatchDeleteImageCommandOutput } from "../commands/BatchDeleteImageCommand" ; import { CompleteLayerUploadCommandInput , CompleteLayerUploadCommandOutput , } from "../commands/CompleteLayerUploadCommand" ; import { CreateRepositoryCommandInput , CreateRepositoryCommandOutput } from "../commands/CreateRepositoryCommand" ; import { DeleteRepositoryCommandInput , DeleteRepositoryCommandOutput } from "../commands/DeleteRepositoryCommand" ; import { DeleteRepositoryPolicyCommandInput , DeleteRepositoryPolicyCommandOutput , } from "../commands/DeleteRepositoryPolicyCommand" ; import { DescribeImagesCommandInput , DescribeImagesCommandOutput } from "../commands/DescribeImagesCommand" ; import { DescribeImageTagsCommandInput , DescribeImageTagsCommandOutput } from "../commands/DescribeImageTagsCommand" ; import { DescribeRegistriesCommandInput , DescribeRegistriesCommandOutput } from "../commands/DescribeRegistriesCommand" ; import { DescribeRepositoriesCommandInput , DescribeRepositoriesCommandOutput , } from "../commands/DescribeRepositoriesCommand" ; import { GetAuthorizationTokenCommandInput , GetAuthorizationTokenCommandOutput , } from "../commands/GetAuthorizationTokenCommand" ; import { GetRegistryCatalogDataCommandInput , GetRegistryCatalogDataCommandOutput , } from "../commands/GetRegistryCatalogDataCommand" ; import { GetRepositoryCatalogDataCommandInput , GetRepositoryCatalogDataCommandOutput , } from "../commands/GetRepositoryCatalogDataCommand" ; import { GetRepositoryPolicyCommandInput , GetRepositoryPolicyCommandOutput , } from "../commands/GetRepositoryPolicyCommand" ; import { InitiateLayerUploadCommandInput , InitiateLayerUploadCommandOutput , } from "../commands/InitiateLayerUploadCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PutImageCommandInput , PutImageCommandOutput } from "../commands/PutImageCommand" ; import { PutRegistryCatalogDataCommandInput , PutRegistryCatalogDataCommandOutput , } from "../commands/PutRegistryCatalogDataCommand" ; import { PutRepositoryCatalogDataCommandInput , PutRepositoryCatalogDataCommandOutput , } from "../commands/PutRepositoryCatalogDataCommand" ; import { SetRepositoryPolicyCommandInput , SetRepositoryPolicyCommandOutput , } from "../commands/SetRepositoryPolicyCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UploadLayerPartCommandInput , UploadLayerPartCommandOutput } from "../commands/UploadLayerPartCommand" ; import { AuthorizationData , BatchCheckLayerAvailabilityRequest , BatchCheckLayerAvailabilityResponse , BatchDeleteImageRequest , BatchDeleteImageResponse , CompleteLayerUploadRequest , CompleteLayerUploadResponse , CreateRepositoryRequest , CreateRepositoryResponse , DeleteRepositoryPolicyRequest , DeleteRepositoryPolicyResponse , DeleteRepositoryRequest , DeleteRepositoryResponse , DescribeImagesRequest , DescribeImagesResponse , DescribeImageTagsRequest , DescribeImageTagsResponse , DescribeRegistriesRequest , DescribeRegistriesResponse , DescribeRepositoriesRequest , DescribeRepositoriesResponse , EmptyUploadException , GetAuthorizationTokenRequest , GetAuthorizationTokenResponse , GetRegistryCatalogDataRequest , GetRegistryCatalogDataResponse , GetRepositoryCatalogDataRequest , GetRepositoryCatalogDataResponse , GetRepositoryPolicyRequest , GetRepositoryPolicyResponse , Image , ImageAlreadyExistsException , ImageDetail , ImageDigestDoesNotMatchException , ImageFailure , ImageIdentifier , ImageNotFoundException , ImageTagAlreadyExistsException , ImageTagDetail , InitiateLayerUploadRequest , InitiateLayerUploadResponse , InvalidLayerException , InvalidLayerPartException , InvalidParameterException , InvalidTagParameterException , Layer , LayerAlreadyExistsException , LayerFailure , LayerPartTooSmallException , LayersNotFoundException , LimitExceededException , ListTagsForResourceRequest , ListTagsForResourceResponse , PutImageRequest , PutImageResponse , PutRegistryCatalogDataRequest , PutRegistryCatalogDataResponse , PutRepositoryCatalogDataRequest , PutRepositoryCatalogDataResponse , ReferencedImageDetail , ReferencedImagesNotFoundException , Registry , RegistryAlias , RegistryCatalogData , RegistryNotFoundException , Repository , RepositoryAlreadyExistsException , RepositoryCatalogData , RepositoryCatalogDataInput , RepositoryNotEmptyException , RepositoryNotFoundException , RepositoryPolicyNotFoundException , ServerException , SetRepositoryPolicyRequest , SetRepositoryPolicyResponse , Tag , TagResourceRequest , TagResourceResponse , TooManyTagsException , UnsupportedCommandException , UntagResourceRequest , UntagResourceResponse , UploadLayerPartRequest , UploadLayerPartResponse , UploadNotFoundException , } from "../models/models_0" ; export const serializeAws_json1_1BatchCheckLayerAvailabilityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.BatchCheckLayerAvailability" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchCheckLayerAvailabilityRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1BatchDeleteImageCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.BatchDeleteImage" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1BatchDeleteImageRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CompleteLayerUploadCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.CompleteLayerUpload" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CompleteLayerUploadRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateRepositoryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.CreateRepository" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateRepositoryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteRepositoryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DeleteRepository" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteRepositoryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteRepositoryPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DeleteRepositoryPolicy" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteRepositoryPolicyRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeImagesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DescribeImages" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeImagesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeImageTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DescribeImageTags" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeImageTagsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeRegistriesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DescribeRegistries" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeRegistriesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeRepositoriesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.DescribeRepositories" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeRepositoriesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetAuthorizationTokenCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.GetAuthorizationToken" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetAuthorizationTokenRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetRegistryCatalogDataCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.GetRegistryCatalogData" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetRegistryCatalogDataRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetRepositoryCatalogDataCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.GetRepositoryCatalogData" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetRepositoryCatalogDataRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetRepositoryPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.GetRepositoryPolicy" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetRepositoryPolicyRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1InitiateLayerUploadCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.InitiateLayerUpload" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1InitiateLayerUploadRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.ListTagsForResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsForResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutImageCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.PutImage" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutImageRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutRegistryCatalogDataCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.PutRegistryCatalogData" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutRegistryCatalogDataRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1PutRepositoryCatalogDataCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.PutRepositoryCatalogData" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1PutRepositoryCatalogDataRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetRepositoryPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.SetRepositoryPolicy" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetRepositoryPolicyRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.TagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1TagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.UntagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UntagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UploadLayerPartCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "SpencerFrontendService.UploadLayerPart" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UploadLayerPartRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1BatchCheckLayerAvailabilityCommand = async ( output , context ) : Promise < BatchCheckLayerAvailabilityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchCheckLayerAvailabilityCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchCheckLayerAvailabilityResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchCheckLayerAvailabilityCommandError = async ( output , context ) : Promise < BatchCheckLayerAvailabilityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RegistryNotFoundException" : case "com.amazonaws.ecrpublic#RegistryNotFoundException" : response = { ... ( await deserializeAws_json1_1RegistryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1BatchDeleteImageCommand = async ( output , context ) : Promise < BatchDeleteImageCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1BatchDeleteImageCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1BatchDeleteImageResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1BatchDeleteImageCommandError = async ( output , context ) : Promise < BatchDeleteImageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CompleteLayerUploadCommand = async ( output , context ) : Promise < CompleteLayerUploadCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CompleteLayerUploadCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CompleteLayerUploadResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CompleteLayerUploadCommandError = async ( output , context ) : Promise < CompleteLayerUploadCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "EmptyUploadException" : case "com.amazonaws.ecrpublic#EmptyUploadException" : response = { ... ( await deserializeAws_json1_1EmptyUploadExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidLayerException" : case "com.amazonaws.ecrpublic#InvalidLayerException" : response = { ... ( await deserializeAws_json1_1InvalidLayerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LayerAlreadyExistsException" : case "com.amazonaws.ecrpublic#LayerAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1LayerAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LayerPartTooSmallException" : case "com.amazonaws.ecrpublic#LayerPartTooSmallException" : response = { ... ( await deserializeAws_json1_1LayerPartTooSmallExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RegistryNotFoundException" : case "com.amazonaws.ecrpublic#RegistryNotFoundException" : response = { ... ( await deserializeAws_json1_1RegistryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UploadNotFoundException" : case "com.amazonaws.ecrpublic#UploadNotFoundException" : response = { ... ( await deserializeAws_json1_1UploadNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateRepositoryCommand = async ( output , context ) : Promise < CreateRepositoryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateRepositoryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateRepositoryResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateRepositoryCommandError = async ( output , context ) : Promise < CreateRepositoryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.ecrpublic#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.ecrpublic#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryAlreadyExistsException" : case "com.amazonaws.ecrpublic#RepositoryAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1RepositoryAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.ecrpublic#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteRepositoryCommand = async ( output , context ) : Promise < DeleteRepositoryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteRepositoryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteRepositoryResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteRepositoryCommandError = async ( output , context ) : Promise < DeleteRepositoryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotEmptyException" : case "com.amazonaws.ecrpublic#RepositoryNotEmptyException" : response = { ... ( await deserializeAws_json1_1RepositoryNotEmptyExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteRepositoryPolicyCommand = async ( output , context ) : Promise < DeleteRepositoryPolicyCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteRepositoryPolicyCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteRepositoryPolicyResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteRepositoryPolicyCommandError = async ( output , context ) : Promise < DeleteRepositoryPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryPolicyNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryPolicyNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeImagesCommand = async ( output , context ) : Promise < DescribeImagesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeImagesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeImagesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeImagesCommandError = async ( output , context ) : Promise < DescribeImagesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ImageNotFoundException" : case "com.amazonaws.ecrpublic#ImageNotFoundException" : response = { ... ( await deserializeAws_json1_1ImageNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeImageTagsCommand = async ( output , context ) : Promise < DescribeImageTagsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeImageTagsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeImageTagsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeImageTagsCommandError = async ( output , context ) : Promise < DescribeImageTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeRegistriesCommand = async ( output , context ) : Promise < DescribeRegistriesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeRegistriesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeRegistriesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeRegistriesCommandError = async ( output , context ) : Promise < DescribeRegistriesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeRepositoriesCommand = async ( output , context ) : Promise < DescribeRepositoriesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeRepositoriesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeRepositoriesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeRepositoriesCommandError = async ( output , context ) : Promise < DescribeRepositoriesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetAuthorizationTokenCommand = async ( output , context ) : Promise < GetAuthorizationTokenCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetAuthorizationTokenCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetAuthorizationTokenResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetAuthorizationTokenCommandError = async ( output , context ) : Promise < GetAuthorizationTokenCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetRegistryCatalogDataCommand = async ( output , context ) : Promise < GetRegistryCatalogDataCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetRegistryCatalogDataCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetRegistryCatalogDataResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetRegistryCatalogDataCommandError = async ( output , context ) : Promise < GetRegistryCatalogDataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetRepositoryCatalogDataCommand = async ( output , context ) : Promise < GetRepositoryCatalogDataCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetRepositoryCatalogDataCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetRepositoryCatalogDataResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetRepositoryCatalogDataCommandError = async ( output , context ) : Promise < GetRepositoryCatalogDataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetRepositoryPolicyCommand = async ( output , context ) : Promise < GetRepositoryPolicyCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetRepositoryPolicyCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetRepositoryPolicyResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetRepositoryPolicyCommandError = async ( output , context ) : Promise < GetRepositoryPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryPolicyNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryPolicyNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1InitiateLayerUploadCommand = async ( output , context ) : Promise < InitiateLayerUploadCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1InitiateLayerUploadCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1InitiateLayerUploadResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1InitiateLayerUploadCommandError = async ( output , context ) : Promise < InitiateLayerUploadCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RegistryNotFoundException" : case "com.amazonaws.ecrpublic#RegistryNotFoundException" : response = { ... ( await deserializeAws_json1_1RegistryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsForResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsForResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsForResourceCommandError = 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 "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1PutImageCommand = async ( output , context ) : Promise < PutImageCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutImageCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1PutImageResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutImageCommandError = async ( output , context ) : Promise < PutImageCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ImageAlreadyExistsException" : case "com.amazonaws.ecrpublic#ImageAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1ImageAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ImageDigestDoesNotMatchException" : case "com.amazonaws.ecrpublic#ImageDigestDoesNotMatchException" : response = { ... ( await deserializeAws_json1_1ImageDigestDoesNotMatchExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ImageTagAlreadyExistsException" : case "com.amazonaws.ecrpublic#ImageTagAlreadyExistsException" : response = { ... ( await deserializeAws_json1_1ImageTagAlreadyExistsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LayersNotFoundException" : case "com.amazonaws.ecrpublic#LayersNotFoundException" : response = { ... ( await deserializeAws_json1_1LayersNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.ecrpublic#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ReferencedImagesNotFoundException" : case "com.amazonaws.ecrpublic#ReferencedImagesNotFoundException" : response = { ... ( await deserializeAws_json1_1ReferencedImagesNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RegistryNotFoundException" : case "com.amazonaws.ecrpublic#RegistryNotFoundException" : response = { ... ( await deserializeAws_json1_1RegistryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1PutRegistryCatalogDataCommand = async ( output , context ) : Promise < PutRegistryCatalogDataCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutRegistryCatalogDataCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1PutRegistryCatalogDataResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutRegistryCatalogDataCommandError = async ( output , context ) : Promise < PutRegistryCatalogDataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1PutRepositoryCatalogDataCommand = async ( output , context ) : Promise < PutRepositoryCatalogDataCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1PutRepositoryCatalogDataCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1PutRepositoryCatalogDataResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1PutRepositoryCatalogDataCommandError = async ( output , context ) : Promise < PutRepositoryCatalogDataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1SetRepositoryPolicyCommand = async ( output , context ) : Promise < SetRepositoryPolicyCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetRepositoryPolicyCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1SetRepositoryPolicyResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetRepositoryPolicyCommandError = async ( output , context ) : Promise < SetRepositoryPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1TagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1TagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1TagResourceCommandError = 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 "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.ecrpublic#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.ecrpublic#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UntagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UntagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UntagResourceCommandError = 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 "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidTagParameterException" : case "com.amazonaws.ecrpublic#InvalidTagParameterException" : response = { ... ( await deserializeAws_json1_1InvalidTagParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.ecrpublic#TooManyTagsException" : response = { ... ( await deserializeAws_json1_1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UploadLayerPartCommand = async ( output , context ) : Promise < UploadLayerPartCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UploadLayerPartCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UploadLayerPartResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UploadLayerPartCommandError = async ( output , context ) : Promise < UploadLayerPartCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InvalidLayerPartException" : case "com.amazonaws.ecrpublic#InvalidLayerPartException" : response = { ... ( await deserializeAws_json1_1InvalidLayerPartExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.ecrpublic#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.ecrpublic#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RegistryNotFoundException" : case "com.amazonaws.ecrpublic#RegistryNotFoundException" : response = { ... ( await deserializeAws_json1_1RegistryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RepositoryNotFoundException" : case "com.amazonaws.ecrpublic#RepositoryNotFoundException" : response = { ... ( await deserializeAws_json1_1RepositoryNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServerException" : case "com.amazonaws.ecrpublic#ServerException" : response = { ... ( await deserializeAws_json1_1ServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedCommandException" : case "com.amazonaws.ecrpublic#UnsupportedCommandException" : response = { ... ( await deserializeAws_json1_1UnsupportedCommandExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UploadNotFoundException" : case "com.amazonaws.ecrpublic#UploadNotFoundException" : response = { ... ( await deserializeAws_json1_1UploadNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_json1_1EmptyUploadExceptionResponse = async ( parsedOutput , context ) : Promise < EmptyUploadException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1EmptyUploadException ( body , context ) ; const contents = { name : "EmptyUploadException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ImageAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < ImageAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ImageAlreadyExistsException ( body , context ) ; const contents = { name : "ImageAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ImageDigestDoesNotMatchExceptionResponse = async ( parsedOutput , context ) : Promise < ImageDigestDoesNotMatchException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ImageDigestDoesNotMatchException ( body , context ) ; const contents = { name : "ImageDigestDoesNotMatchException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ImageNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ImageNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ImageNotFoundException ( body , context ) ; const contents = { name : "ImageNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ImageTagAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < ImageTagAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ImageTagAlreadyExistsException ( body , context ) ; const contents = { name : "ImageTagAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidLayerExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidLayerException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidLayerException ( body , context ) ; const contents = { name : "InvalidLayerException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidLayerPartExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidLayerPartException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidLayerPartException ( body , context ) ; const contents = { name : "InvalidLayerPartException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidParameterException ( body , context ) ; const contents = { name : "InvalidParameterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidTagParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidTagParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidTagParameterException ( body , context ) ; const contents = { name : "InvalidTagParameterException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LayerAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < LayerAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LayerAlreadyExistsException ( body , context ) ; const contents = { name : "LayerAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LayerPartTooSmallExceptionResponse = async ( parsedOutput , context ) : Promise < LayerPartTooSmallException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LayerPartTooSmallException ( body , context ) ; const contents = { name : "LayerPartTooSmallException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LayersNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < LayersNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LayersNotFoundException ( body , context ) ; const contents = { name : "LayersNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LimitExceededException ( body , context ) ; const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ReferencedImagesNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ReferencedImagesNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ReferencedImagesNotFoundException ( body , context ) ; const contents = { name : "ReferencedImagesNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RegistryNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < RegistryNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RegistryNotFoundException ( body , context ) ; const contents = { name : "RegistryNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RepositoryAlreadyExistsExceptionResponse = async ( parsedOutput , context ) : Promise < RepositoryAlreadyExistsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RepositoryAlreadyExistsException ( body , context ) ; const contents = { name : "RepositoryAlreadyExistsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RepositoryNotEmptyExceptionResponse = async ( parsedOutput , context ) : Promise < RepositoryNotEmptyException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RepositoryNotEmptyException ( body , context ) ; const contents = { name : "RepositoryNotEmptyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RepositoryNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < RepositoryNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RepositoryNotFoundException ( body , context ) ; const contents = { name : "RepositoryNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < RepositoryPolicyNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RepositoryPolicyNotFoundException ( body , context ) ; const contents = { name : "RepositoryPolicyNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ServerExceptionResponse = async ( parsedOutput , context ) : Promise < ServerException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ServerException ( body , context ) ; const contents = { name : "ServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyTagsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyTagsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyTagsException ( body , context ) ; const contents = { name : "TooManyTagsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1UnsupportedCommandExceptionResponse = async ( parsedOutput , context ) : Promise < UnsupportedCommandException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1UnsupportedCommandException ( body , context ) ; const contents = { name : "UnsupportedCommandException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1UploadNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < UploadNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1UploadNotFoundException ( body , context ) ; const contents = { name : "UploadNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1ArchitectureList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1BatchCheckLayerAvailabilityRequest = ( input , context ) : any => { return { ... ( input . layerDigests !== undefined && input . layerDigests !== null && { layerDigests : serializeAws_json1_1BatchedOperationLayerDigestList ( input . layerDigests , context ) , } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1BatchDeleteImageRequest = ( input , context ) : any => { return { ... ( input . imageIds !== undefined && input . imageIds !== null && { imageIds : serializeAws_json1_1ImageIdentifierList ( input . imageIds , context ) } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1BatchedOperationLayerDigestList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1CompleteLayerUploadRequest = ( input , context ) : any => { return { ... ( input . layerDigests !== undefined && input . layerDigests !== null && { layerDigests : serializeAws_json1_1LayerDigestList ( input . layerDigests , context ) , } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , ... ( input . uploadId !== undefined && input . uploadId !== null && { uploadId : input . uploadId } ) , } ; } ; const serializeAws_json1_1CreateRepositoryRequest = ( input , context ) : any => { return { ... ( input . catalogData !== undefined && input . catalogData !== null && { catalogData : serializeAws_json1_1RepositoryCatalogDataInput ( input . catalogData , context ) , } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_json1_1TagList ( input . tags , context ) } ) , } ; } ; const serializeAws_json1_1DeleteRepositoryPolicyRequest = ( input , context ) : any => { return { ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1DeleteRepositoryRequest = ( input , context ) : any => { return { ... ( input . force !== undefined && input . force !== null && { force : input . force } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1DescribeImagesRequest = ( input , context ) : any => { return { ... ( input . imageIds !== undefined && input . imageIds !== null && { imageIds : serializeAws_json1_1ImageIdentifierList ( input . imageIds , context ) } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1DescribeImageTagsRequest = ( input , context ) : any => { return { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1DescribeRegistriesRequest = ( input , context ) : any => { return { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ; } ; const serializeAws_json1_1DescribeRepositoriesRequest = ( input , context ) : any => { return { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryNames !== undefined && input . repositoryNames !== null && { repositoryNames : serializeAws_json1_1RepositoryNameList ( input . repositoryNames , context ) , } ) , } ; } ; const serializeAws_json1_1GetAuthorizationTokenRequest = ( input , context ) : any => { return { } ; } ; const serializeAws_json1_1GetRegistryCatalogDataRequest = ( input , context ) : any => { return { } ; } ; const serializeAws_json1_1GetRepositoryCatalogDataRequest = ( input , context ) : any => { return { ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1GetRepositoryPolicyRequest = ( input , context ) : any => { return { ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1ImageIdentifier = ( input , context ) : any => { return { ... ( input . imageDigest !== undefined && input . imageDigest !== null && { imageDigest : input . imageDigest } ) , ... ( input . imageTag !== undefined && input . imageTag !== null && { imageTag : input . imageTag } ) , } ; } ; const serializeAws_json1_1ImageIdentifierList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1ImageIdentifier ( entry , context ) ; } ) ; } ; const serializeAws_json1_1InitiateLayerUploadRequest = ( input , context ) : any => { return { ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1LayerDigestList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1ListTagsForResourceRequest = ( input , context ) : any => { return { ... ( input . resourceArn !== undefined && input . resourceArn !== null && { resourceArn : input . resourceArn } ) , } ; } ; const serializeAws_json1_1OperatingSystemList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1PutImageRequest = ( input , context ) : any => { return { ... ( input . imageDigest !== undefined && input . imageDigest !== null && { imageDigest : input . imageDigest } ) , ... ( input . imageManifest !== undefined && input . imageManifest !== null && { imageManifest : input . imageManifest } ) , ... ( input . imageManifestMediaType !== undefined && input . imageManifestMediaType !== null && { imageManifestMediaType : input . imageManifestMediaType } ) , ... ( input . imageTag !== undefined && input . imageTag !== null && { imageTag : input . imageTag } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1PutRegistryCatalogDataRequest = ( input , context ) : any => { return { ... ( input . displayName !== undefined && input . displayName !== null && { displayName : input . displayName } ) , } ; } ; const serializeAws_json1_1PutRepositoryCatalogDataRequest = ( input , context ) : any => { return { ... ( input . catalogData !== undefined && input . catalogData !== null && { catalogData : serializeAws_json1_1RepositoryCatalogDataInput ( input . catalogData , context ) , } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1RepositoryCatalogDataInput = ( input , context ) : any => { return { ... ( input . aboutText !== undefined && input . aboutText !== null && { aboutText : input . aboutText } ) , ... ( input . architectures !== undefined && input . architectures !== null && { architectures : serializeAws_json1_1ArchitectureList ( input . architectures , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . logoImageBlob !== undefined && input . logoImageBlob !== null && { logoImageBlob : context . base64Encoder ( input . logoImageBlob ) } ) , ... ( input . operatingSystems !== undefined && input . operatingSystems !== null && { operatingSystems : serializeAws_json1_1OperatingSystemList ( input . operatingSystems , context ) , } ) , ... ( input . usageText !== undefined && input . usageText !== null && { usageText : input . usageText } ) , } ; } ; const serializeAws_json1_1RepositoryNameList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1SetRepositoryPolicyRequest = ( input , context ) : any => { return { ... ( input . force !== undefined && input . force !== null && { force : input . force } ) , ... ( input . policyText !== undefined && input . policyText !== null && { policyText : input . policyText } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , } ; } ; const serializeAws_json1_1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1TagKeyList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const serializeAws_json1_1TagResourceRequest = ( input , context ) : any => { return { ... ( input . resourceArn !== undefined && input . resourceArn !== null && { resourceArn : input . resourceArn } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_json1_1TagList ( input . tags , context ) } ) , } ; } ; const serializeAws_json1_1UntagResourceRequest = ( input , context ) : any => { return { ... ( input . resourceArn !== undefined && input . resourceArn !== null && { resourceArn : input . resourceArn } ) , ... ( input . tagKeys !== undefined && input . tagKeys !== null && { tagKeys : serializeAws_json1_1TagKeyList ( input . tagKeys , context ) } ) , } ; } ; const serializeAws_json1_1UploadLayerPartRequest = ( input , context ) : any => { return { ... ( input . layerPartBlob !== undefined && input . layerPartBlob !== null && { layerPartBlob : context . base64Encoder ( input . layerPartBlob ) } ) , ... ( input . partFirstByte !== undefined && input . partFirstByte !== null && { partFirstByte : input . partFirstByte } ) , ... ( input . partLastByte !== undefined && input . partLastByte !== null && { partLastByte : input . partLastByte } ) , ... ( input . registryId !== undefined && input . registryId !== null && { registryId : input . registryId } ) , ... ( input . repositoryName !== undefined && input . repositoryName !== null && { repositoryName : input . repositoryName } ) , ... ( input . uploadId !== undefined && input . uploadId !== null && { uploadId : input . uploadId } ) , } ; } ; const deserializeAws_json1_1ArchitectureList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1AuthorizationData = ( output , context ) : AuthorizationData => { return { authorizationToken : __expectString ( output . authorizationToken ) , expiresAt : output . expiresAt !== undefined && output . expiresAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . expiresAt ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchCheckLayerAvailabilityResponse = ( output , context ) : BatchCheckLayerAvailabilityResponse => { return { failures : output . failures !== undefined && output . failures !== null ? deserializeAws_json1_1LayerFailureList ( output . failures , context ) : undefined , layers : output . layers !== undefined && output . layers !== null ? deserializeAws_json1_1LayerList ( output . layers , context ) : undefined , } as any ; } ; const deserializeAws_json1_1BatchDeleteImageResponse = ( output , context ) : BatchDeleteImageResponse => { return { failures : output . failures !== undefined && output . failures !== null ? deserializeAws_json1_1ImageFailureList ( output . failures , context ) : undefined , imageIds : output . imageIds !== undefined && output . imageIds !== null ? deserializeAws_json1_1ImageIdentifierList ( output . imageIds , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CompleteLayerUploadResponse = ( output , context ) : CompleteLayerUploadResponse => { return { layerDigest : __expectString ( output . layerDigest ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , uploadId : __expectString ( output . uploadId ) , } as any ; } ; const deserializeAws_json1_1CreateRepositoryResponse = ( output , context ) : CreateRepositoryResponse => { return { catalogData : output . catalogData !== undefined && output . catalogData !== null ? deserializeAws_json1_1RepositoryCatalogData ( output . catalogData , context ) : undefined , repository : output . repository !== undefined && output . repository !== null ? deserializeAws_json1_1Repository ( output . repository , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DeleteRepositoryPolicyResponse = ( output , context ) : DeleteRepositoryPolicyResponse => { return { policyText : __expectString ( output . policyText ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , } as any ; } ; const deserializeAws_json1_1DeleteRepositoryResponse = ( output , context ) : DeleteRepositoryResponse => { return { repository : output . repository !== undefined && output . repository !== null ? deserializeAws_json1_1Repository ( output . repository , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeImagesResponse = ( output , context ) : DescribeImagesResponse => { return { imageDetails : output . imageDetails !== undefined && output . imageDetails !== null ? deserializeAws_json1_1ImageDetailList ( output . imageDetails , context ) : undefined , nextToken : __expectString ( output . nextToken ) , } as any ; } ; const deserializeAws_json1_1DescribeImageTagsResponse = ( output , context ) : DescribeImageTagsResponse => { return { imageTagDetails : output . imageTagDetails !== undefined && output . imageTagDetails !== null ? deserializeAws_json1_1ImageTagDetailList ( output . imageTagDetails , context ) : undefined , nextToken : __expectString ( output . nextToken ) , } as any ; } ; const deserializeAws_json1_1DescribeRegistriesResponse = ( output , context ) : DescribeRegistriesResponse => { return { nextToken : __expectString ( output . nextToken ) , registries : output . registries !== undefined && output . registries !== null ? deserializeAws_json1_1RegistryList ( output . registries , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeRepositoriesResponse = ( output , context ) : DescribeRepositoriesResponse => { return { nextToken : __expectString ( output . nextToken ) , repositories : output . repositories !== undefined && output . repositories !== null ? deserializeAws_json1_1RepositoryList ( output . repositories , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EmptyUploadException = ( output , context ) : EmptyUploadException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1GetAuthorizationTokenResponse = ( output , context ) : GetAuthorizationTokenResponse => { return { authorizationData : output . authorizationData !== undefined && output . authorizationData !== null ? deserializeAws_json1_1AuthorizationData ( output . authorizationData , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetRegistryCatalogDataResponse = ( output , context ) : GetRegistryCatalogDataResponse => { return { registryCatalogData : output . registryCatalogData !== undefined && output . registryCatalogData !== null ? deserializeAws_json1_1RegistryCatalogData ( output . registryCatalogData , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetRepositoryCatalogDataResponse = ( output , context ) : GetRepositoryCatalogDataResponse => { return { catalogData : output . catalogData !== undefined && output . catalogData !== null ? deserializeAws_json1_1RepositoryCatalogData ( output . catalogData , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetRepositoryPolicyResponse = ( output , context ) : GetRepositoryPolicyResponse => { return { policyText : __expectString ( output . policyText ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , } as any ; } ; const deserializeAws_json1_1Image = ( output , context ) : Image => { return { imageId : output . imageId !== undefined && output . imageId !== null ? deserializeAws_json1_1ImageIdentifier ( output . imageId , context ) : undefined , imageManifest : __expectString ( output . imageManifest ) , imageManifestMediaType : __expectString ( output . imageManifestMediaType ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , } as any ; } ; const deserializeAws_json1_1ImageAlreadyExistsException = ( output , context ) : ImageAlreadyExistsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ImageDetail = ( output , context ) : ImageDetail => { return { artifactMediaType : __expectString ( output . artifactMediaType ) , imageDigest : __expectString ( output . imageDigest ) , imageManifestMediaType : __expectString ( output . imageManifestMediaType ) , imagePushedAt : output . imagePushedAt !== undefined && output . imagePushedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . imagePushedAt ) ) ) : undefined , imageSizeInBytes : __expectLong ( output . imageSizeInBytes ) , imageTags : output . imageTags !== undefined && output . imageTags !== null ? deserializeAws_json1_1ImageTagList ( output . imageTags , context ) : undefined , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , } as any ; } ; const deserializeAws_json1_1ImageDetailList = ( output , context ) : ImageDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ImageDetail ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ImageDigestDoesNotMatchException = ( output , context ) : ImageDigestDoesNotMatchException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ImageFailure = ( output , context ) : ImageFailure => { return { failureCode : __expectString ( output . failureCode ) , failureReason : __expectString ( output . failureReason ) , imageId : output . imageId !== undefined && output . imageId !== null ? deserializeAws_json1_1ImageIdentifier ( output . imageId , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ImageFailureList = ( output , context ) : ImageFailure [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ImageFailure ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ImageIdentifier = ( output , context ) : ImageIdentifier => { return { imageDigest : __expectString ( output . imageDigest ) , imageTag : __expectString ( output . imageTag ) , } as any ; } ; const deserializeAws_json1_1ImageIdentifierList = ( output , context ) : ImageIdentifier [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ImageIdentifier ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ImageNotFoundException = ( output , context ) : ImageNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ImageTagAlreadyExistsException = ( output , context ) : ImageTagAlreadyExistsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ImageTagDetail = ( output , context ) : ImageTagDetail => { return { createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , imageDetail : output . imageDetail !== undefined && output . imageDetail !== null ? deserializeAws_json1_1ReferencedImageDetail ( output . imageDetail , context ) : undefined , imageTag : __expectString ( output . imageTag ) , } as any ; } ; const deserializeAws_json1_1ImageTagDetailList = ( output , context ) : ImageTagDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ImageTagDetail ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ImageTagList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1InitiateLayerUploadResponse = ( output , context ) : InitiateLayerUploadResponse => { return { partSize : __expectLong ( output . partSize ) , uploadId : __expectString ( output . uploadId ) , } as any ; } ; const deserializeAws_json1_1InvalidLayerException = ( output , context ) : InvalidLayerException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidLayerPartException = ( output , context ) : InvalidLayerPartException => { return { lastValidByteReceived : __expectLong ( output . lastValidByteReceived ) , message : __expectString ( output . message ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , uploadId : __expectString ( output . uploadId ) , } as any ; } ; const deserializeAws_json1_1InvalidParameterException = ( output , context ) : InvalidParameterException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidTagParameterException = ( output , context ) : InvalidTagParameterException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Layer = ( output , context ) : Layer => { return { layerAvailability : __expectString ( output . layerAvailability ) , layerDigest : __expectString ( output . layerDigest ) , layerSize : __expectLong ( output . layerSize ) , mediaType : __expectString ( output . mediaType ) , } as any ; } ; const deserializeAws_json1_1LayerAlreadyExistsException = ( output , context ) : LayerAlreadyExistsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1LayerFailure = ( output , context ) : LayerFailure => { return { failureCode : __expectString ( output . failureCode ) , failureReason : __expectString ( output . failureReason ) , layerDigest : __expectString ( output . layerDigest ) , } as any ; } ; const deserializeAws_json1_1LayerFailureList = ( output , context ) : LayerFailure [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1LayerFailure ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1LayerList = ( output , context ) : Layer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Layer ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1LayerPartTooSmallException = ( output , context ) : LayerPartTooSmallException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1LayersNotFoundException = ( output , context ) : LayersNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1LimitExceededException = ( output , context ) : LimitExceededException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ListTagsForResourceResponse = ( output , context ) : ListTagsForResourceResponse => { return { tags : output . tags !== undefined && output . tags !== null ? deserializeAws_json1_1TagList ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1OperatingSystemList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1PutImageResponse = ( output , context ) : PutImageResponse => { return { image : output . image !== undefined && output . image !== null ? deserializeAws_json1_1Image ( output . image , context ) : undefined , } as any ; } ; const deserializeAws_json1_1PutRegistryCatalogDataResponse = ( output , context ) : PutRegistryCatalogDataResponse => { return { registryCatalogData : output . registryCatalogData !== undefined && output . registryCatalogData !== null ? deserializeAws_json1_1RegistryCatalogData ( output . registryCatalogData , context ) : undefined , } as any ; } ; const deserializeAws_json1_1PutRepositoryCatalogDataResponse = ( output , context ) : PutRepositoryCatalogDataResponse => { return { catalogData : output . catalogData !== undefined && output . catalogData !== null ? deserializeAws_json1_1RepositoryCatalogData ( output . catalogData , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ReferencedImageDetail = ( output , context ) : ReferencedImageDetail => { return { artifactMediaType : __expectString ( output . artifactMediaType ) , imageDigest : __expectString ( output . imageDigest ) , imageManifestMediaType : __expectString ( output . imageManifestMediaType ) , imagePushedAt : output . imagePushedAt !== undefined && output . imagePushedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . imagePushedAt ) ) ) : undefined , imageSizeInBytes : __expectLong ( output . imageSizeInBytes ) , } as any ; } ; const deserializeAws_json1_1ReferencedImagesNotFoundException = ( output , context ) : ReferencedImagesNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Registry = ( output , context ) : Registry => { return { aliases : output . aliases !== undefined && output . aliases !== null ? deserializeAws_json1_1RegistryAliasList ( output . aliases , context ) : undefined , registryArn : __expectString ( output . registryArn ) , registryId : __expectString ( output . registryId ) , registryUri : __expectString ( output . registryUri ) , verified : __expectBoolean ( output . verified ) , } as any ; } ; const deserializeAws_json1_1RegistryAlias = ( output , context ) : RegistryAlias => { return { defaultRegistryAlias : __expectBoolean ( output . defaultRegistryAlias ) , name : __expectString ( output . name ) , primaryRegistryAlias : __expectBoolean ( output . primaryRegistryAlias ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_json1_1RegistryAliasList = ( output , context ) : RegistryAlias [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RegistryAlias ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RegistryCatalogData = ( output , context ) : RegistryCatalogData => { return { displayName : __expectString ( output . displayName ) , } as any ; } ; const deserializeAws_json1_1RegistryList = ( output , context ) : Registry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Registry ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RegistryNotFoundException = ( output , context ) : RegistryNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Repository = ( output , context ) : Repository => { return { createdAt : output . createdAt !== undefined && output . createdAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdAt ) ) ) : undefined , registryId : __expectString ( output . registryId ) , repositoryArn : __expectString ( output . repositoryArn ) , repositoryName : __expectString ( output . repositoryName ) , repositoryUri : __expectString ( output . repositoryUri ) , } as any ; } ; const deserializeAws_json1_1RepositoryAlreadyExistsException = ( output , context ) : RepositoryAlreadyExistsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1RepositoryCatalogData = ( output , context ) : RepositoryCatalogData => { return { aboutText : __expectString ( output . aboutText ) , architectures : output . architectures !== undefined && output . architectures !== null ? deserializeAws_json1_1ArchitectureList ( output . architectures , context ) : undefined , description : __expectString ( output . description ) , logoUrl : __expectString ( output . logoUrl ) , marketplaceCertified : __expectBoolean ( output . marketplaceCertified ) , operatingSystems : output . operatingSystems !== undefined && output . operatingSystems !== null ? deserializeAws_json1_1OperatingSystemList ( output . operatingSystems , context ) : undefined , usageText : __expectString ( output . usageText ) , } as any ; } ; const deserializeAws_json1_1RepositoryList = ( output , context ) : Repository [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Repository ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RepositoryNotEmptyException = ( output , context ) : RepositoryNotEmptyException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1RepositoryNotFoundException = ( output , context ) : RepositoryNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1RepositoryPolicyNotFoundException = ( output , context ) : RepositoryPolicyNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ServerException = ( output , context ) : ServerException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1SetRepositoryPolicyResponse = ( output , context ) : SetRepositoryPolicyResponse => { return { policyText : __expectString ( output . policyText ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , } as any ; } ; const deserializeAws_json1_1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1TagResourceResponse = ( output , context ) : TagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1TooManyTagsException = ( output , context ) : TooManyTagsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1UnsupportedCommandException = ( output , context ) : UnsupportedCommandException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1UntagResourceResponse = ( output , context ) : UntagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1UploadLayerPartResponse = ( output , context ) : UploadLayerPartResponse => { return { lastByteReceived : __expectLong ( output . lastByteReceived ) , registryId : __expectString ( output . registryId ) , repositoryName : __expectString ( output . repositoryName ) , uploadId : __expectString ( output . uploadId ) , } as any ; } ; const deserializeAws_json1_1UploadNotFoundException = ( output , context ) : UploadNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const contents = { protocol , hostname , port , method : "POST" , path : basePath . endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) + path : basePath + path , headers , } ; if ( resolvedHostname !== undefined ) { contents . hostname = resolvedHostname ; } if ( body !== undefined ) { contents . body = body ; } return new __HttpRequest ( contents ) ; } ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;