import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectLong as __expectLong , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , LazyJsonString as __LazyJsonString , parseRfc3339DateTime as __parseRfc3339DateTime , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { CreateDiscovererCommandInput , CreateDiscovererCommandOutput } from "../commands/CreateDiscovererCommand" ; import { CreateRegistryCommandInput , CreateRegistryCommandOutput } from "../commands/CreateRegistryCommand" ; import { CreateSchemaCommandInput , CreateSchemaCommandOutput } from "../commands/CreateSchemaCommand" ; import { DeleteDiscovererCommandInput , DeleteDiscovererCommandOutput } from "../commands/DeleteDiscovererCommand" ; import { DeleteRegistryCommandInput , DeleteRegistryCommandOutput } from "../commands/DeleteRegistryCommand" ; import { DeleteResourcePolicyCommandInput , DeleteResourcePolicyCommandOutput , } from "../commands/DeleteResourcePolicyCommand" ; import { DeleteSchemaCommandInput , DeleteSchemaCommandOutput } from "../commands/DeleteSchemaCommand" ; import { DeleteSchemaVersionCommandInput , DeleteSchemaVersionCommandOutput , } from "../commands/DeleteSchemaVersionCommand" ; import { DescribeCodeBindingCommandInput , DescribeCodeBindingCommandOutput , } from "../commands/DescribeCodeBindingCommand" ; import { DescribeDiscovererCommandInput , DescribeDiscovererCommandOutput } from "../commands/DescribeDiscovererCommand" ; import { DescribeRegistryCommandInput , DescribeRegistryCommandOutput } from "../commands/DescribeRegistryCommand" ; import { DescribeSchemaCommandInput , DescribeSchemaCommandOutput } from "../commands/DescribeSchemaCommand" ; import { ExportSchemaCommandInput , ExportSchemaCommandOutput } from "../commands/ExportSchemaCommand" ; import { GetCodeBindingSourceCommandInput , GetCodeBindingSourceCommandOutput , } from "../commands/GetCodeBindingSourceCommand" ; import { GetDiscoveredSchemaCommandInput , GetDiscoveredSchemaCommandOutput , } from "../commands/GetDiscoveredSchemaCommand" ; import { GetResourcePolicyCommandInput , GetResourcePolicyCommandOutput } from "../commands/GetResourcePolicyCommand" ; import { ListDiscoverersCommandInput , ListDiscoverersCommandOutput } from "../commands/ListDiscoverersCommand" ; import { ListRegistriesCommandInput , ListRegistriesCommandOutput } from "../commands/ListRegistriesCommand" ; import { ListSchemasCommandInput , ListSchemasCommandOutput } from "../commands/ListSchemasCommand" ; import { ListSchemaVersionsCommandInput , ListSchemaVersionsCommandOutput } from "../commands/ListSchemaVersionsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PutCodeBindingCommandInput , PutCodeBindingCommandOutput } from "../commands/PutCodeBindingCommand" ; import { PutResourcePolicyCommandInput , PutResourcePolicyCommandOutput } from "../commands/PutResourcePolicyCommand" ; import { SearchSchemasCommandInput , SearchSchemasCommandOutput } from "../commands/SearchSchemasCommand" ; import { StartDiscovererCommandInput , StartDiscovererCommandOutput } from "../commands/StartDiscovererCommand" ; import { StopDiscovererCommandInput , StopDiscovererCommandOutput } from "../commands/StopDiscovererCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateDiscovererCommandInput , UpdateDiscovererCommandOutput } from "../commands/UpdateDiscovererCommand" ; import { UpdateRegistryCommandInput , UpdateRegistryCommandOutput } from "../commands/UpdateRegistryCommand" ; import { UpdateSchemaCommandInput , UpdateSchemaCommandOutput } from "../commands/UpdateSchemaCommand" ; import { BadRequestException , ConflictException , DiscovererSummary , ForbiddenException , GoneException , InternalServerErrorException , NotFoundException , PreconditionFailedException , RegistrySummary , SchemaSummary , SchemaVersionSummary , SearchSchemaSummary , SearchSchemaVersionSummary , ServiceUnavailableException , TooManyRequestsException , UnauthorizedException , } from "../models/models_0" ; export const serializeAws_restJson1CreateDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers" ; let body ; body = JSON . stringify ( { ... ( input . CrossAccount !== undefined && input . CrossAccount !== null && { CrossAccount : input . CrossAccount } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . SourceArn !== undefined && input . SourceArn !== null && { SourceArn : input . SourceArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRegistryCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Content !== undefined && input . Content !== null && { Content : input . Content } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers/id/{DiscovererId}" ; if ( input . DiscovererId !== undefined ) { const labelValue = input . DiscovererId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DiscovererId." ) ; } resolvedPath = resolvedPath . replace ( "{DiscovererId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DiscovererId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRegistryCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteResourcePolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/policy" ; const query = { ... ( input . RegistryName !== undefined && { registryName : input . RegistryName } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSchemaVersionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/version/{SchemaVersion}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } if ( input . SchemaVersion !== undefined ) { const labelValue = input . SchemaVersion ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaVersion." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaVersion}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaVersion." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeCodeBindingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}" ; if ( input . Language !== undefined ) { const labelValue = input . Language ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Language." ) ; } resolvedPath = resolvedPath . replace ( "{Language}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Language." ) ; } if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . SchemaVersion !== undefined && { schemaVersion : input . SchemaVersion } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DescribeDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers/id/{DiscovererId}" ; if ( input . DiscovererId !== undefined ) { const labelValue = input . DiscovererId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DiscovererId." ) ; } resolvedPath = resolvedPath . replace ( "{DiscovererId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DiscovererId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeRegistryCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . SchemaVersion !== undefined && { schemaVersion : input . SchemaVersion } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ExportSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/export" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . SchemaVersion !== undefined && { schemaVersion : input . SchemaVersion } ) , ... ( input . Type !== undefined && { type : input . Type } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCodeBindingSourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}/source" ; if ( input . Language !== undefined ) { const labelValue = input . Language ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Language." ) ; } resolvedPath = resolvedPath . replace ( "{Language}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Language." ) ; } if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . SchemaVersion !== undefined && { schemaVersion : input . SchemaVersion } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetDiscoveredSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discover" ; let body ; body = JSON . stringify ( { ... ( input . Events !== undefined && input . Events !== null && { Events : serializeAws_restJson1__listOfGetDiscoveredSchemaVersionItemInput ( input . Events , context ) , } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetResourcePolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/policy" ; const query = { ... ( input . RegistryName !== undefined && { registryName : input . RegistryName } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDiscoverersCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers" ; const query = { ... ( input . DiscovererIdPrefix !== undefined && { discovererIdPrefix : input . DiscovererIdPrefix } ) , ... ( input . Limit !== undefined && { limit : input . Limit . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . SourceArnPrefix !== undefined && { sourceArnPrefix : input . SourceArnPrefix } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListRegistriesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries" ; const query = { ... ( input . Limit !== undefined && { limit : input . Limit . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . RegistryNamePrefix !== undefined && { registryNamePrefix : input . RegistryNamePrefix } ) , ... ( input . Scope !== undefined && { scope : input . Scope } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListSchemasCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } const query = { ... ( input . Limit !== undefined && { limit : input . Limit . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , ... ( input . SchemaNamePrefix !== undefined && { schemaNamePrefix : input . SchemaNamePrefix } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListSchemaVersionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/versions" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . Limit !== undefined && { limit : input . Limit . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutCodeBindingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}" ; if ( input . Language !== undefined ) { const labelValue = input . Language ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Language." ) ; } resolvedPath = resolvedPath . replace ( "{Language}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Language." ) ; } if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } const query = { ... ( input . SchemaVersion !== undefined && { schemaVersion : input . SchemaVersion } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1PutResourcePolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/policy" ; const query = { ... ( input . RegistryName !== undefined && { registryName : input . RegistryName } ) , } ; let body ; body = JSON . stringify ( { ... ( input . Policy !== undefined && input . Policy !== null && { Policy : __LazyJsonString . fromObject ( input . Policy ) } ) , ... ( input . RevisionId !== undefined && input . RevisionId !== null && { RevisionId : input . RevisionId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1SearchSchemasCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/search" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } const query = { ... ( input . Keywords !== undefined && { keywords : input . Keywords } ) , ... ( input . Limit !== undefined && { limit : input . Limit . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1StartDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers/id/{DiscovererId}/start" ; if ( input . DiscovererId !== undefined ) { const labelValue = input . DiscovererId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DiscovererId." ) ; } resolvedPath = resolvedPath . replace ( "{DiscovererId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DiscovererId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1StopDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers/id/{DiscovererId}/stop" ; if ( input . DiscovererId !== undefined ) { const labelValue = input . DiscovererId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DiscovererId." ) ; } resolvedPath = resolvedPath . replace ( "{DiscovererId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DiscovererId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateDiscovererCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/discoverers/id/{DiscovererId}" ; if ( input . DiscovererId !== undefined ) { const labelValue = input . DiscovererId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DiscovererId." ) ; } resolvedPath = resolvedPath . replace ( "{DiscovererId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DiscovererId." ) ; } let body ; body = JSON . stringify ( { ... ( input . CrossAccount !== undefined && input . CrossAccount !== null && { CrossAccount : input . CrossAccount } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRegistryCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSchemaCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}" ; if ( input . RegistryName !== undefined ) { const labelValue = input . RegistryName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RegistryName." ) ; } resolvedPath = resolvedPath . replace ( "{RegistryName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RegistryName." ) ; } if ( input . SchemaName !== undefined ) { const labelValue = input . SchemaName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SchemaName." ) ; } resolvedPath = resolvedPath . replace ( "{SchemaName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SchemaName." ) ; } let body ; body = JSON . stringify ( { ClientTokenId : input . ClientTokenId ?? generateIdempotencyToken ( ) , ... ( input . Content !== undefined && input . Content !== null && { Content : input . Content } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateDiscovererCommand = async ( output , context ) : Promise < CreateDiscovererCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CrossAccount : undefined , Description : undefined , DiscovererArn : undefined , DiscovererId : undefined , SourceArn : undefined , State : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CrossAccount !== undefined && data . CrossAccount !== null ) { contents . CrossAccount = __expectBoolean ( data . CrossAccount ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . DiscovererArn !== undefined && data . DiscovererArn !== null ) { contents . DiscovererArn = __expectString ( data . DiscovererArn ) ; } if ( data . DiscovererId !== undefined && data . DiscovererId !== null ) { contents . DiscovererId = __expectString ( data . DiscovererId ) ; } if ( data . SourceArn !== undefined && data . SourceArn !== null ) { contents . SourceArn = __expectString ( data . SourceArn ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDiscovererCommandError = async ( output , context ) : Promise < CreateDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.schemas#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1CreateRegistryCommand = async ( output , context ) : Promise < CreateRegistryCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRegistryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Description : undefined , RegistryArn : undefined , RegistryName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . RegistryArn !== undefined && data . RegistryArn !== null ) { contents . RegistryArn = __expectString ( data . RegistryArn ) ; } if ( data . RegistryName !== undefined && data . RegistryName !== null ) { contents . RegistryName = __expectString ( data . RegistryName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRegistryCommandError = async ( output , context ) : Promise < CreateRegistryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.schemas#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1CreateSchemaCommand = async ( output , context ) : Promise < CreateSchemaCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Description : undefined , LastModified : undefined , SchemaArn : undefined , SchemaName : undefined , SchemaVersion : undefined , Tags : undefined , Type : undefined , VersionCreatedDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . LastModified !== undefined && data . LastModified !== null ) { contents . LastModified = __expectNonNull ( __parseRfc3339DateTime ( data . LastModified ) ) ; } if ( data . SchemaArn !== undefined && data . SchemaArn !== null ) { contents . SchemaArn = __expectString ( data . SchemaArn ) ; } if ( data . SchemaName !== undefined && data . SchemaName !== null ) { contents . SchemaName = __expectString ( data . SchemaName ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } if ( data . VersionCreatedDate !== undefined && data . VersionCreatedDate !== null ) { contents . VersionCreatedDate = __expectNonNull ( __parseRfc3339DateTime ( data . VersionCreatedDate ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSchemaCommandError = async ( output , context ) : Promise < CreateSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( 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_restJson1DeleteDiscovererCommand = async ( output , context ) : Promise < DeleteDiscovererCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteDiscovererCommandError = async ( output , context ) : Promise < DeleteDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DeleteRegistryCommand = async ( output , context ) : Promise < DeleteRegistryCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRegistryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRegistryCommandError = async ( output , context ) : Promise < DeleteRegistryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DeleteResourcePolicyCommand = async ( output , context ) : Promise < DeleteResourcePolicyCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteResourcePolicyCommandError = async ( output , context ) : Promise < DeleteResourcePolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DeleteSchemaCommand = async ( output , context ) : Promise < DeleteSchemaCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSchemaCommandError = async ( output , context ) : Promise < DeleteSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DeleteSchemaVersionCommand = async ( output , context ) : Promise < DeleteSchemaVersionCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSchemaVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSchemaVersionCommandError = async ( output , context ) : Promise < DeleteSchemaVersionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DescribeCodeBindingCommand = async ( output , context ) : Promise < DescribeCodeBindingCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeCodeBindingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationDate : undefined , LastModified : undefined , SchemaVersion : undefined , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseRfc3339DateTime ( data . CreationDate ) ) ; } if ( data . LastModified !== undefined && data . LastModified !== null ) { contents . LastModified = __expectNonNull ( __parseRfc3339DateTime ( data . LastModified ) ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeCodeBindingCommandError = async ( output , context ) : Promise < DescribeCodeBindingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.schemas#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DescribeDiscovererCommand = async ( output , context ) : Promise < DescribeDiscovererCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CrossAccount : undefined , Description : undefined , DiscovererArn : undefined , DiscovererId : undefined , SourceArn : undefined , State : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CrossAccount !== undefined && data . CrossAccount !== null ) { contents . CrossAccount = __expectBoolean ( data . CrossAccount ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . DiscovererArn !== undefined && data . DiscovererArn !== null ) { contents . DiscovererArn = __expectString ( data . DiscovererArn ) ; } if ( data . DiscovererId !== undefined && data . DiscovererId !== null ) { contents . DiscovererId = __expectString ( data . DiscovererId ) ; } if ( data . SourceArn !== undefined && data . SourceArn !== null ) { contents . SourceArn = __expectString ( data . SourceArn ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeDiscovererCommandError = async ( output , context ) : Promise < DescribeDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DescribeRegistryCommand = async ( output , context ) : Promise < DescribeRegistryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeRegistryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Description : undefined , RegistryArn : undefined , RegistryName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . RegistryArn !== undefined && data . RegistryArn !== null ) { contents . RegistryArn = __expectString ( data . RegistryArn ) ; } if ( data . RegistryName !== undefined && data . RegistryName !== null ) { contents . RegistryName = __expectString ( data . RegistryName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeRegistryCommandError = async ( output , context ) : Promise < DescribeRegistryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1DescribeSchemaCommand = async ( output , context ) : Promise < DescribeSchemaCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Content : undefined , Description : undefined , LastModified : undefined , SchemaArn : undefined , SchemaName : undefined , SchemaVersion : undefined , Tags : undefined , Type : undefined , VersionCreatedDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Content !== undefined && data . Content !== null ) { contents . Content = __expectString ( data . Content ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . LastModified !== undefined && data . LastModified !== null ) { contents . LastModified = __expectNonNull ( __parseRfc3339DateTime ( data . LastModified ) ) ; } if ( data . SchemaArn !== undefined && data . SchemaArn !== null ) { contents . SchemaArn = __expectString ( data . SchemaArn ) ; } if ( data . SchemaName !== undefined && data . SchemaName !== null ) { contents . SchemaName = __expectString ( data . SchemaName ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } if ( data . VersionCreatedDate !== undefined && data . VersionCreatedDate !== null ) { contents . VersionCreatedDate = __expectNonNull ( __parseRfc3339DateTime ( data . VersionCreatedDate ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeSchemaCommandError = async ( output , context ) : Promise < DescribeSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1ExportSchemaCommand = async ( output , context ) : Promise < ExportSchemaCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ExportSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Content : undefined , SchemaArn : undefined , SchemaName : undefined , SchemaVersion : undefined , Type : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Content !== undefined && data . Content !== null ) { contents . Content = __expectString ( data . Content ) ; } if ( data . SchemaArn !== undefined && data . SchemaArn !== null ) { contents . SchemaArn = __expectString ( data . SchemaArn ) ; } if ( data . SchemaName !== undefined && data . SchemaName !== null ) { contents . SchemaName = __expectString ( data . SchemaName ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ExportSchemaCommandError = async ( output , context ) : Promise < ExportSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.schemas#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1GetCodeBindingSourceCommand = async ( output , context ) : Promise < GetCodeBindingSourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCodeBindingSourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Body : undefined , } ; const data = await collectBody ( output . body , context ) ; contents . Body = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCodeBindingSourceCommandError = async ( output , context ) : Promise < GetCodeBindingSourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.schemas#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1GetDiscoveredSchemaCommand = async ( output , context ) : Promise < GetDiscoveredSchemaCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDiscoveredSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Content : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Content !== undefined && data . Content !== null ) { contents . Content = __expectString ( data . Content ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDiscoveredSchemaCommandError = async ( output , context ) : Promise < GetDiscoveredSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1GetResourcePolicyCommand = async ( output , context ) : Promise < GetResourcePolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Policy : undefined , RevisionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = new __LazyJsonString ( data . Policy ) ; } if ( data . RevisionId !== undefined && data . RevisionId !== null ) { contents . RevisionId = __expectString ( data . RevisionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetResourcePolicyCommandError = async ( output , context ) : Promise < GetResourcePolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1ListDiscoverersCommand = async ( output , context ) : Promise < ListDiscoverersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDiscoverersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Discoverers : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Discoverers !== undefined && data . Discoverers !== null ) { contents . Discoverers = deserializeAws_restJson1__listOfDiscovererSummary ( data . Discoverers , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDiscoverersCommandError = async ( output , context ) : Promise < ListDiscoverersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1ListRegistriesCommand = async ( output , context ) : Promise < ListRegistriesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRegistriesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Registries : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Registries !== undefined && data . Registries !== null ) { contents . Registries = deserializeAws_restJson1__listOfRegistrySummary ( data . Registries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRegistriesCommandError = async ( output , context ) : Promise < ListRegistriesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1ListSchemasCommand = async ( output , context ) : Promise < ListSchemasCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListSchemasCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Schemas : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Schemas !== undefined && data . Schemas !== null ) { contents . Schemas = deserializeAws_restJson1__listOfSchemaSummary ( data . Schemas , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListSchemasCommandError = async ( output , context ) : Promise < ListSchemasCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1ListSchemaVersionsCommand = async ( output , context ) : Promise < ListSchemaVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListSchemaVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , SchemaVersions : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . SchemaVersions !== undefined && data . SchemaVersions !== null ) { contents . SchemaVersions = deserializeAws_restJson1__listOfSchemaVersionSummary ( data . SchemaVersions , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListSchemaVersionsCommandError = async ( output , context ) : Promise < ListSchemaVersionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1PutCodeBindingCommand = async ( output , context ) : Promise < PutCodeBindingCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutCodeBindingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreationDate : undefined , LastModified : undefined , SchemaVersion : undefined , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreationDate !== undefined && data . CreationDate !== null ) { contents . CreationDate = __expectNonNull ( __parseRfc3339DateTime ( data . CreationDate ) ) ; } if ( data . LastModified !== undefined && data . LastModified !== null ) { contents . LastModified = __expectNonNull ( __parseRfc3339DateTime ( data . LastModified ) ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutCodeBindingCommandError = async ( output , context ) : Promise < PutCodeBindingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "GoneException" : case "com.amazonaws.schemas#GoneException" : response = { ... ( await deserializeAws_restJson1GoneExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.schemas#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1PutResourcePolicyCommand = async ( output , context ) : Promise < PutResourcePolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutResourcePolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Policy : undefined , RevisionId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = new __LazyJsonString ( data . Policy ) ; } if ( data . RevisionId !== undefined && data . RevisionId !== null ) { contents . RevisionId = __expectString ( data . RevisionId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutResourcePolicyCommandError = async ( output , context ) : Promise < PutResourcePolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PreconditionFailedException" : case "com.amazonaws.schemas#PreconditionFailedException" : response = { ... ( await deserializeAws_restJson1PreconditionFailedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1SearchSchemasCommand = async ( output , context ) : Promise < SearchSchemasCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SearchSchemasCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Schemas : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Schemas !== undefined && data . Schemas !== null ) { contents . Schemas = deserializeAws_restJson1__listOfSearchSchemaSummary ( data . Schemas , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SearchSchemasCommandError = async ( output , context ) : Promise < SearchSchemasCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1StartDiscovererCommand = async ( output , context ) : Promise < StartDiscovererCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DiscovererId : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DiscovererId !== undefined && data . DiscovererId !== null ) { contents . DiscovererId = __expectString ( data . DiscovererId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartDiscovererCommandError = async ( output , context ) : Promise < StartDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1StopDiscovererCommand = async ( output , context ) : Promise < StopDiscovererCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StopDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DiscovererId : undefined , State : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DiscovererId !== undefined && data . DiscovererId !== null ) { contents . DiscovererId = __expectString ( data . DiscovererId ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StopDiscovererCommandError = async ( output , context ) : Promise < StopDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( 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_restJson1UpdateDiscovererCommand = async ( output , context ) : Promise < UpdateDiscovererCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateDiscovererCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CrossAccount : undefined , Description : undefined , DiscovererArn : undefined , DiscovererId : undefined , SourceArn : undefined , State : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CrossAccount !== undefined && data . CrossAccount !== null ) { contents . CrossAccount = __expectBoolean ( data . CrossAccount ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . DiscovererArn !== undefined && data . DiscovererArn !== null ) { contents . DiscovererArn = __expectString ( data . DiscovererArn ) ; } if ( data . DiscovererId !== undefined && data . DiscovererId !== null ) { contents . DiscovererId = __expectString ( data . DiscovererId ) ; } if ( data . SourceArn !== undefined && data . SourceArn !== null ) { contents . SourceArn = __expectString ( data . SourceArn ) ; } if ( data . State !== undefined && data . State !== null ) { contents . State = __expectString ( data . State ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateDiscovererCommandError = async ( output , context ) : Promise < UpdateDiscovererCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1UpdateRegistryCommand = async ( output , context ) : Promise < UpdateRegistryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRegistryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Description : undefined , RegistryArn : undefined , RegistryName : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . RegistryArn !== undefined && data . RegistryArn !== null ) { contents . RegistryArn = __expectString ( data . RegistryArn ) ; } if ( data . RegistryName !== undefined && data . RegistryName !== null ) { contents . RegistryName = __expectString ( data . RegistryName ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRegistryCommandError = async ( output , context ) : Promise < UpdateRegistryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.schemas#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( 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_restJson1UpdateSchemaCommand = async ( output , context ) : Promise < UpdateSchemaCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSchemaCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Description : undefined , LastModified : undefined , SchemaArn : undefined , SchemaName : undefined , SchemaVersion : undefined , Tags : undefined , Type : undefined , VersionCreatedDate : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . LastModified !== undefined && data . LastModified !== null ) { contents . LastModified = __expectNonNull ( __parseRfc3339DateTime ( data . LastModified ) ) ; } if ( data . SchemaArn !== undefined && data . SchemaArn !== null ) { contents . SchemaArn = __expectString ( data . SchemaArn ) ; } if ( data . SchemaName !== undefined && data . SchemaName !== null ) { contents . SchemaName = __expectString ( data . SchemaName ) ; } if ( data . SchemaVersion !== undefined && data . SchemaVersion !== null ) { contents . SchemaVersion = __expectString ( data . SchemaVersion ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . Type !== undefined && data . Type !== null ) { contents . Type = __expectString ( data . Type ) ; } if ( data . VersionCreatedDate !== undefined && data . VersionCreatedDate !== null ) { contents . VersionCreatedDate = __expectNonNull ( __parseRfc3339DateTime ( data . VersionCreatedDate ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSchemaCommandError = async ( output , context ) : Promise < UpdateSchemaCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.schemas#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.schemas#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.schemas#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.schemas#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.schemas#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ForbiddenExceptionResponse = async ( parsedOutput , context ) : Promise < ForbiddenException > => { const contents = { name : "ForbiddenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1GoneExceptionResponse = async ( parsedOutput , context ) : Promise < GoneException > => { const contents = { name : "GoneException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerErrorException > => { const contents = { name : "InternalServerErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const contents = { name : "NotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1PreconditionFailedExceptionResponse = async ( parsedOutput , context ) : Promise < PreconditionFailedException > => { const contents = { name : "PreconditionFailedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1UnauthorizedExceptionResponse = async ( parsedOutput , context ) : Promise < UnauthorizedException > => { const contents = { name : "UnauthorizedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const serializeAws_restJson1__listOfGetDiscoveredSchemaVersionItemInput = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Tags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const deserializeAws_restJson1__listOfDiscovererSummary = ( output , context ) : DiscovererSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DiscovererSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfRegistrySummary = ( output , context ) : RegistrySummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RegistrySummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfSchemaSummary = ( output , context ) : SchemaSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SchemaSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfSchemaVersionSummary = ( output , context ) : SchemaVersionSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SchemaVersionSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfSearchSchemaSummary = ( output , context ) : SearchSchemaSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SearchSchemaSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfSearchSchemaVersionSummary = ( output , context ) : SearchSchemaVersionSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SearchSchemaVersionSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DiscovererSummary = ( output , context ) : DiscovererSummary => { return { CrossAccount : __expectBoolean ( output . CrossAccount ) , DiscovererArn : __expectString ( output . DiscovererArn ) , DiscovererId : __expectString ( output . DiscovererId ) , SourceArn : __expectString ( output . SourceArn ) , State : __expectString ( output . State ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RegistrySummary = ( output , context ) : RegistrySummary => { return { RegistryArn : __expectString ( output . RegistryArn ) , RegistryName : __expectString ( output . RegistryName ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SchemaSummary = ( output , context ) : SchemaSummary => { return { LastModified : output . LastModified !== undefined && output . LastModified !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . LastModified ) ) : undefined , SchemaArn : __expectString ( output . SchemaArn ) , SchemaName : __expectString ( output . SchemaName ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , VersionCount : __expectLong ( output . VersionCount ) , } as any ; } ; const deserializeAws_restJson1SchemaVersionSummary = ( output , context ) : SchemaVersionSummary => { return { SchemaArn : __expectString ( output . SchemaArn ) , SchemaName : __expectString ( output . SchemaName ) , SchemaVersion : __expectString ( output . SchemaVersion ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1SearchSchemaSummary = ( output , context ) : SearchSchemaSummary => { return { RegistryName : __expectString ( output . RegistryName ) , SchemaArn : __expectString ( output . SchemaArn ) , SchemaName : __expectString ( output . SchemaName ) , SchemaVersions : output . SchemaVersions !== undefined && output . SchemaVersions !== null ? deserializeAws_restJson1__listOfSearchSchemaVersionSummary ( output . SchemaVersions , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SearchSchemaVersionSummary = ( output , context ) : SearchSchemaVersionSummary => { return { CreatedDate : output . CreatedDate !== undefined && output . CreatedDate !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreatedDate ) ) : undefined , SchemaVersion : __expectString ( output . SchemaVersion ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1Tags = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;