import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse , isValidHostname as __isValidHostname , } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseEpochTimestamp as __parseEpochTimestamp , serializeFloat as __serializeFloat , } 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 { BatchPutPropertyValuesCommandInput , BatchPutPropertyValuesCommandOutput , } from "../commands/BatchPutPropertyValuesCommand" ; import { CreateComponentTypeCommandInput , CreateComponentTypeCommandOutput , } from "../commands/CreateComponentTypeCommand" ; import { CreateEntityCommandInput , CreateEntityCommandOutput } from "../commands/CreateEntityCommand" ; import { CreateSceneCommandInput , CreateSceneCommandOutput } from "../commands/CreateSceneCommand" ; import { CreateWorkspaceCommandInput , CreateWorkspaceCommandOutput } from "../commands/CreateWorkspaceCommand" ; import { DeleteComponentTypeCommandInput , DeleteComponentTypeCommandOutput , } from "../commands/DeleteComponentTypeCommand" ; import { DeleteEntityCommandInput , DeleteEntityCommandOutput } from "../commands/DeleteEntityCommand" ; import { DeleteSceneCommandInput , DeleteSceneCommandOutput } from "../commands/DeleteSceneCommand" ; import { DeleteWorkspaceCommandInput , DeleteWorkspaceCommandOutput } from "../commands/DeleteWorkspaceCommand" ; import { GetComponentTypeCommandInput , GetComponentTypeCommandOutput } from "../commands/GetComponentTypeCommand" ; import { GetEntityCommandInput , GetEntityCommandOutput } from "../commands/GetEntityCommand" ; import { GetPropertyValueCommandInput , GetPropertyValueCommandOutput } from "../commands/GetPropertyValueCommand" ; import { GetPropertyValueHistoryCommandInput , GetPropertyValueHistoryCommandOutput , } from "../commands/GetPropertyValueHistoryCommand" ; import { GetSceneCommandInput , GetSceneCommandOutput } from "../commands/GetSceneCommand" ; import { GetWorkspaceCommandInput , GetWorkspaceCommandOutput } from "../commands/GetWorkspaceCommand" ; import { ListComponentTypesCommandInput , ListComponentTypesCommandOutput } from "../commands/ListComponentTypesCommand" ; import { ListEntitiesCommandInput , ListEntitiesCommandOutput } from "../commands/ListEntitiesCommand" ; import { ListScenesCommandInput , ListScenesCommandOutput } from "../commands/ListScenesCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListWorkspacesCommandInput , ListWorkspacesCommandOutput } from "../commands/ListWorkspacesCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateComponentTypeCommandInput , UpdateComponentTypeCommandOutput , } from "../commands/UpdateComponentTypeCommand" ; import { UpdateEntityCommandInput , UpdateEntityCommandOutput } from "../commands/UpdateEntityCommand" ; import { UpdateSceneCommandInput , UpdateSceneCommandOutput } from "../commands/UpdateSceneCommand" ; import { UpdateWorkspaceCommandInput , UpdateWorkspaceCommandOutput } from "../commands/UpdateWorkspaceCommand" ; import { AccessDeniedException , BatchPutPropertyError , BatchPutPropertyErrorEntry , ComponentRequest , ComponentResponse , ComponentTypeSummary , ComponentUpdateRequest , ConflictException , ConnectorFailureException , ConnectorTimeoutException , DataConnector , DataType , DataValue , EntityPropertyReference , EntitySummary , ErrorDetails , FunctionRequest , FunctionResponse , InternalServerException , InterpolationParameters , LambdaFunction , ListComponentTypesFilter , ListEntitiesFilter , ParentEntityUpdateRequest , PropertyDefinitionRequest , PropertyDefinitionResponse , PropertyFilter , PropertyLatestValue , PropertyRequest , PropertyResponse , PropertyValue , PropertyValueEntry , PropertyValueHistory , Relationship , RelationshipValue , ResourceNotFoundException , SceneSummary , ServiceQuotaExceededException , Status , ThrottlingException , TooManyTagsException , ValidationException , WorkspaceSummary , } from "../models/models_0" ; export const serializeAws_restJson1BatchPutPropertyValuesCommand = 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 || "" }` + "/workspaces/{workspaceId}/entity-properties" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . entries !== undefined && input . entries !== null && { entries : serializeAws_restJson1Entries ( input . entries , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "data." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateComponentTypeCommand = 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 || "" }` + "/workspaces/{workspaceId}/component-types/{componentTypeId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . componentTypeId !== undefined ) { const labelValue = input . componentTypeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: componentTypeId." ) ; } resolvedPath = resolvedPath . replace ( "{componentTypeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: componentTypeId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . extendsFrom !== undefined && input . extendsFrom !== null && { extendsFrom : serializeAws_restJson1ExtendsFrom ( input . extendsFrom , context ) } ) , ... ( input . functions !== undefined && input . functions !== null && { functions : serializeAws_restJson1FunctionsRequest ( input . functions , context ) } ) , ... ( input . isSingleton !== undefined && input . isSingleton !== null && { isSingleton : input . isSingleton } ) , ... ( input . propertyDefinitions !== undefined && input . propertyDefinitions !== null && { propertyDefinitions : serializeAws_restJson1PropertyDefinitionsRequest ( input . propertyDefinitions , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEntityCommand = 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 || "" }` + "/workspaces/{workspaceId}/entities" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . components !== undefined && input . components !== null && { components : serializeAws_restJson1ComponentsMapRequest ( input . components , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . entityId !== undefined && input . entityId !== null && { entityId : input . entityId } ) , ... ( input . entityName !== undefined && input . entityName !== null && { entityName : input . entityName } ) , ... ( input . parentEntityId !== undefined && input . parentEntityId !== null && { parentEntityId : input . parentEntityId } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSceneCommand = 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 || "" }` + "/workspaces/{workspaceId}/scenes" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . capabilities !== undefined && input . capabilities !== null && { capabilities : serializeAws_restJson1SceneCapabilities ( input . capabilities , context ) , } ) , ... ( input . contentLocation !== undefined && input . contentLocation !== null && { contentLocation : input . contentLocation } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . sceneId !== undefined && input . sceneId !== null && { sceneId : input . sceneId } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateWorkspaceCommand = 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 || "" }` + "/workspaces/{workspaceId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . role !== undefined && input . role !== null && { role : input . role } ) , ... ( input . s3Location !== undefined && input . s3Location !== null && { s3Location : input . s3Location } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteComponentTypeCommand = 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 || "" }` + "/workspaces/{workspaceId}/component-types/{componentTypeId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . componentTypeId !== undefined ) { const labelValue = input . componentTypeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: componentTypeId." ) ; } resolvedPath = resolvedPath . replace ( "{componentTypeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: componentTypeId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEntityCommand = 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 || "" }` + "/workspaces/{workspaceId}/entities/{entityId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . entityId !== undefined ) { const labelValue = input . entityId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: entityId." ) ; } resolvedPath = resolvedPath . replace ( "{entityId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: entityId." ) ; } const query = { ... ( input . isRecursive !== undefined && { isRecursive : input . isRecursive . toString ( ) } ) , } ; let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteSceneCommand = 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 || "" }` + "/workspaces/{workspaceId}/scenes/{sceneId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . sceneId !== undefined ) { const labelValue = input . sceneId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: sceneId." ) ; } resolvedPath = resolvedPath . replace ( "{sceneId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: sceneId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteWorkspaceCommand = 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 || "" }` + "/workspaces/{workspaceId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetComponentTypeCommand = 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 || "" }` + "/workspaces/{workspaceId}/component-types/{componentTypeId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . componentTypeId !== undefined ) { const labelValue = input . componentTypeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: componentTypeId." ) ; } resolvedPath = resolvedPath . replace ( "{componentTypeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: componentTypeId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEntityCommand = 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 || "" }` + "/workspaces/{workspaceId}/entities/{entityId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . entityId !== undefined ) { const labelValue = input . entityId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: entityId." ) ; } resolvedPath = resolvedPath . replace ( "{entityId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: entityId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetPropertyValueCommand = 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 || "" }` + "/workspaces/{workspaceId}/entity-properties/value" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . componentName !== undefined && input . componentName !== null && { componentName : input . componentName } ) , ... ( input . componentTypeId !== undefined && input . componentTypeId !== null && { componentTypeId : input . componentTypeId } ) , ... ( input . entityId !== undefined && input . entityId !== null && { entityId : input . entityId } ) , ... ( input . selectedProperties !== undefined && input . selectedProperties !== null && { selectedProperties : serializeAws_restJson1SelectedPropertyList ( input . selectedProperties , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "data." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetPropertyValueHistoryCommand = 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 || "" }` + "/workspaces/{workspaceId}/entity-properties/history" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . componentName !== undefined && input . componentName !== null && { componentName : input . componentName } ) , ... ( input . componentTypeId !== undefined && input . componentTypeId !== null && { componentTypeId : input . componentTypeId } ) , ... ( input . endDateTime !== undefined && input . endDateTime !== null && { endDateTime : Math . round ( input . endDateTime . getTime ( ) / 1000 ) } ) , ... ( input . entityId !== undefined && input . entityId !== null && { entityId : input . entityId } ) , ... ( input . interpolation !== undefined && input . interpolation !== null && { interpolation : serializeAws_restJson1InterpolationParameters ( input . interpolation , context ) , } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . orderByTime !== undefined && input . orderByTime !== null && { orderByTime : input . orderByTime } ) , ... ( input . propertyFilters !== undefined && input . propertyFilters !== null && { propertyFilters : serializeAws_restJson1PropertyFilters ( input . propertyFilters , context ) , } ) , ... ( input . selectedProperties !== undefined && input . selectedProperties !== null && { selectedProperties : serializeAws_restJson1SelectedPropertyList ( input . selectedProperties , context ) , } ) , ... ( input . startDateTime !== undefined && input . startDateTime !== null && { startDateTime : Math . round ( input . startDateTime . getTime ( ) / 1000 ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "data." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSceneCommand = 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 || "" }` + "/workspaces/{workspaceId}/scenes/{sceneId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . sceneId !== undefined ) { const labelValue = input . sceneId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: sceneId." ) ; } resolvedPath = resolvedPath . replace ( "{sceneId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: sceneId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetWorkspaceCommand = 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 || "" }` + "/workspaces/{workspaceId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListComponentTypesCommand = 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 || "" }` + "/workspaces/{workspaceId}/component-types-list" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . filters !== undefined && input . filters !== null && { filters : serializeAws_restJson1ListComponentTypesFilters ( input . filters , context ) } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListEntitiesCommand = 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 || "" }` + "/workspaces/{workspaceId}/entities-list" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . filters !== undefined && input . filters !== null && { filters : serializeAws_restJson1ListEntitiesFilters ( input . filters , context ) } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListScenesCommand = 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 || "" }` + "/workspaces/{workspaceId}/scenes-list" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = 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 || "" }` + "/tags-list" ; let body ; body = JSON . stringify ( { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . resourceARN !== undefined && input . resourceARN !== null && { resourceARN : input . resourceARN } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListWorkspacesCommand = 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 || "" }` + "/workspaces-list" ; let body ; body = JSON . stringify ( { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , 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" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags" ; let body ; body = JSON . stringify ( { ... ( input . resourceARN !== undefined && input . resourceARN !== null && { resourceARN : input . resourceARN } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = 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 || "" }` + "/tags" ; const query = { ... ( input . resourceARN !== undefined && { resourceARN : input . resourceARN } ) , ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateComponentTypeCommand = 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 || "" }` + "/workspaces/{workspaceId}/component-types/{componentTypeId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . componentTypeId !== undefined ) { const labelValue = input . componentTypeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: componentTypeId." ) ; } resolvedPath = resolvedPath . replace ( "{componentTypeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: componentTypeId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . extendsFrom !== undefined && input . extendsFrom !== null && { extendsFrom : serializeAws_restJson1ExtendsFrom ( input . extendsFrom , context ) } ) , ... ( input . functions !== undefined && input . functions !== null && { functions : serializeAws_restJson1FunctionsRequest ( input . functions , context ) } ) , ... ( input . isSingleton !== undefined && input . isSingleton !== null && { isSingleton : input . isSingleton } ) , ... ( input . propertyDefinitions !== undefined && input . propertyDefinitions !== null && { propertyDefinitions : serializeAws_restJson1PropertyDefinitionsRequest ( input . propertyDefinitions , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEntityCommand = 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 || "" }` + "/workspaces/{workspaceId}/entities/{entityId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . entityId !== undefined ) { const labelValue = input . entityId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: entityId." ) ; } resolvedPath = resolvedPath . replace ( "{entityId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: entityId." ) ; } let body ; body = JSON . stringify ( { ... ( input . componentUpdates !== undefined && input . componentUpdates !== null && { componentUpdates : serializeAws_restJson1ComponentUpdatesMapRequest ( input . componentUpdates , context ) , } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . entityName !== undefined && input . entityName !== null && { entityName : input . entityName } ) , ... ( input . parentEntityUpdate !== undefined && input . parentEntityUpdate !== null && { parentEntityUpdate : serializeAws_restJson1ParentEntityUpdateRequest ( input . parentEntityUpdate , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSceneCommand = 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 || "" }` + "/workspaces/{workspaceId}/scenes/{sceneId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } if ( input . sceneId !== undefined ) { const labelValue = input . sceneId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: sceneId." ) ; } resolvedPath = resolvedPath . replace ( "{sceneId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: sceneId." ) ; } let body ; body = JSON . stringify ( { ... ( input . capabilities !== undefined && input . capabilities !== null && { capabilities : serializeAws_restJson1SceneCapabilities ( input . capabilities , context ) , } ) , ... ( input . contentLocation !== undefined && input . contentLocation !== null && { contentLocation : input . contentLocation } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateWorkspaceCommand = 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 || "" }` + "/workspaces/{workspaceId}" ; if ( input . workspaceId !== undefined ) { const labelValue = input . workspaceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: workspaceId." ) ; } resolvedPath = resolvedPath . replace ( "{workspaceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: workspaceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . role !== undefined && input . role !== null && { role : input . role } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1BatchPutPropertyValuesCommand = async ( output , context ) : Promise < BatchPutPropertyValuesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchPutPropertyValuesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , errorEntries : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . errorEntries !== undefined && data . errorEntries !== null ) { contents . errorEntries = deserializeAws_restJson1ErrorEntries ( data . errorEntries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchPutPropertyValuesCommandError = async ( output , context ) : Promise < BatchPutPropertyValuesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateComponentTypeCommand = async ( output , context ) : Promise < CreateComponentTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateComponentTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , creationDateTime : undefined , state : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateComponentTypeCommandError = async ( output , context ) : Promise < CreateComponentTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.iottwinmaker#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateEntityCommand = async ( output , context ) : Promise < CreateEntityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEntityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , creationDateTime : undefined , entityId : undefined , state : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . entityId !== undefined && data . entityId !== null ) { contents . entityId = __expectString ( data . entityId ) ; } if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEntityCommandError = async ( output , context ) : Promise < CreateEntityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.iottwinmaker#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateSceneCommand = async ( output , context ) : Promise < CreateSceneCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSceneCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , creationDateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSceneCommandError = async ( output , context ) : Promise < CreateSceneCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.iottwinmaker#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateWorkspaceCommand = async ( output , context ) : Promise < CreateWorkspaceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateWorkspaceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , creationDateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateWorkspaceCommandError = async ( output , context ) : Promise < CreateWorkspaceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.iottwinmaker#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteComponentTypeCommand = async ( output , context ) : Promise < DeleteComponentTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteComponentTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , state : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteComponentTypeCommandError = async ( output , context ) : Promise < DeleteComponentTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteEntityCommand = async ( output , context ) : Promise < DeleteEntityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEntityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , state : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEntityCommandError = async ( output , context ) : Promise < DeleteEntityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteSceneCommand = async ( output , context ) : Promise < DeleteSceneCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSceneCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSceneCommandError = async ( output , context ) : Promise < DeleteSceneCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteWorkspaceCommand = async ( output , context ) : Promise < DeleteWorkspaceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteWorkspaceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteWorkspaceCommandError = async ( output , context ) : Promise < DeleteWorkspaceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetComponentTypeCommand = async ( output , context ) : Promise < GetComponentTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetComponentTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , componentTypeId : undefined , creationDateTime : undefined , description : undefined , extendsFrom : undefined , functions : undefined , isAbstract : undefined , isSchemaInitialized : undefined , isSingleton : undefined , propertyDefinitions : undefined , status : undefined , updateDateTime : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . componentTypeId !== undefined && data . componentTypeId !== null ) { contents . componentTypeId = __expectString ( data . componentTypeId ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . extendsFrom !== undefined && data . extendsFrom !== null ) { contents . extendsFrom = deserializeAws_restJson1ExtendsFrom ( data . extendsFrom , context ) ; } if ( data . functions !== undefined && data . functions !== null ) { contents . functions = deserializeAws_restJson1FunctionsResponse ( data . functions , context ) ; } if ( data . isAbstract !== undefined && data . isAbstract !== null ) { contents . isAbstract = __expectBoolean ( data . isAbstract ) ; } if ( data . isSchemaInitialized !== undefined && data . isSchemaInitialized !== null ) { contents . isSchemaInitialized = __expectBoolean ( data . isSchemaInitialized ) ; } if ( data . isSingleton !== undefined && data . isSingleton !== null ) { contents . isSingleton = __expectBoolean ( data . isSingleton ) ; } if ( data . propertyDefinitions !== undefined && data . propertyDefinitions !== null ) { contents . propertyDefinitions = deserializeAws_restJson1PropertyDefinitionsResponse ( data . propertyDefinitions , context ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = deserializeAws_restJson1Status ( data . status , context ) ; } if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetComponentTypeCommandError = async ( output , context ) : Promise < GetComponentTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( 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_restJson1GetEntityCommand = async ( output , context ) : Promise < GetEntityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEntityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , components : undefined , creationDateTime : undefined , description : undefined , entityId : undefined , entityName : undefined , hasChildEntities : undefined , parentEntityId : undefined , status : undefined , updateDateTime : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . components !== undefined && data . components !== null ) { contents . components = deserializeAws_restJson1ComponentsMap ( data . components , context ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . entityId !== undefined && data . entityId !== null ) { contents . entityId = __expectString ( data . entityId ) ; } if ( data . entityName !== undefined && data . entityName !== null ) { contents . entityName = __expectString ( data . entityName ) ; } if ( data . hasChildEntities !== undefined && data . hasChildEntities !== null ) { contents . hasChildEntities = __expectBoolean ( data . hasChildEntities ) ; } if ( data . parentEntityId !== undefined && data . parentEntityId !== null ) { contents . parentEntityId = __expectString ( data . parentEntityId ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = deserializeAws_restJson1Status ( data . status , context ) ; } if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEntityCommandError = async ( output , context ) : Promise < GetEntityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetPropertyValueCommand = async ( output , context ) : Promise < GetPropertyValueCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetPropertyValueCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , propertyValues : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . propertyValues !== undefined && data . propertyValues !== null ) { contents . propertyValues = deserializeAws_restJson1PropertyLatestValueMap ( data . propertyValues , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetPropertyValueCommandError = async ( output , context ) : Promise < GetPropertyValueCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConnectorFailureException" : case "com.amazonaws.iottwinmaker#ConnectorFailureException" : response = { ... ( await deserializeAws_restJson1ConnectorFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConnectorTimeoutException" : case "com.amazonaws.iottwinmaker#ConnectorTimeoutException" : response = { ... ( await deserializeAws_restJson1ConnectorTimeoutExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetPropertyValueHistoryCommand = async ( output , context ) : Promise < GetPropertyValueHistoryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetPropertyValueHistoryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , propertyValues : 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 . propertyValues !== undefined && data . propertyValues !== null ) { contents . propertyValues = deserializeAws_restJson1PropertyValueList ( data . propertyValues , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetPropertyValueHistoryCommandError = async ( output , context ) : Promise < GetPropertyValueHistoryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConnectorFailureException" : case "com.amazonaws.iottwinmaker#ConnectorFailureException" : response = { ... ( await deserializeAws_restJson1ConnectorFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConnectorTimeoutException" : case "com.amazonaws.iottwinmaker#ConnectorTimeoutException" : response = { ... ( await deserializeAws_restJson1ConnectorTimeoutExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetSceneCommand = async ( output , context ) : Promise < GetSceneCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSceneCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , capabilities : undefined , contentLocation : undefined , creationDateTime : undefined , description : undefined , sceneId : undefined , updateDateTime : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . capabilities !== undefined && data . capabilities !== null ) { contents . capabilities = deserializeAws_restJson1SceneCapabilities ( data . capabilities , context ) ; } if ( data . contentLocation !== undefined && data . contentLocation !== null ) { contents . contentLocation = __expectString ( data . contentLocation ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . sceneId !== undefined && data . sceneId !== null ) { contents . sceneId = __expectString ( data . sceneId ) ; } if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSceneCommandError = async ( output , context ) : Promise < GetSceneCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetWorkspaceCommand = async ( output , context ) : Promise < GetWorkspaceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetWorkspaceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , creationDateTime : undefined , description : undefined , role : undefined , s3Location : undefined , updateDateTime : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . creationDateTime !== undefined && data . creationDateTime !== null ) { contents . creationDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationDateTime ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . role !== undefined && data . role !== null ) { contents . role = __expectString ( data . role ) ; } if ( data . s3Location !== undefined && data . s3Location !== null ) { contents . s3Location = __expectString ( data . s3Location ) ; } if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetWorkspaceCommandError = async ( output , context ) : Promise < GetWorkspaceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListComponentTypesCommand = async ( output , context ) : Promise < ListComponentTypesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListComponentTypesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , componentTypeSummaries : undefined , maxResults : undefined , nextToken : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . componentTypeSummaries !== undefined && data . componentTypeSummaries !== null ) { contents . componentTypeSummaries = deserializeAws_restJson1ComponentTypeSummaries ( data . componentTypeSummaries , context ) ; } if ( data . maxResults !== undefined && data . maxResults !== null ) { contents . maxResults = __expectInt32 ( data . maxResults ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListComponentTypesCommandError = async ( output , context ) : Promise < ListComponentTypesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListEntitiesCommand = async ( output , context ) : Promise < ListEntitiesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEntitiesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , entitySummaries : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . entitySummaries !== undefined && data . entitySummaries !== null ) { contents . entitySummaries = deserializeAws_restJson1EntitySummaries ( data . entitySummaries , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEntitiesCommandError = async ( output , context ) : Promise < ListEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListScenesCommand = async ( output , context ) : Promise < ListScenesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListScenesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , sceneSummaries : 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 . sceneSummaries !== undefined && data . sceneSummaries !== null ) { contents . sceneSummaries = deserializeAws_restJson1SceneSummaries ( data . sceneSummaries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListScenesCommandError = async ( output , context ) : Promise < ListScenesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , tags : 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 . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( 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_restJson1ListWorkspacesCommand = async ( output , context ) : Promise < ListWorkspacesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListWorkspacesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , workspaceSummaries : 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 . workspaceSummaries !== undefined && data . workspaceSummaries !== null ) { contents . workspaceSummaries = deserializeAws_restJson1WorkspaceSummaries ( data . workspaceSummaries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListWorkspacesCommandError = async ( output , context ) : Promise < ListWorkspacesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.iottwinmaker#TooManyTagsException" : response = { ... ( await deserializeAws_restJson1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( 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_restJson1UpdateComponentTypeCommand = async ( output , context ) : Promise < UpdateComponentTypeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateComponentTypeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , componentTypeId : undefined , state : undefined , workspaceId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . arn = __expectString ( data . arn ) ; } if ( data . componentTypeId !== undefined && data . componentTypeId !== null ) { contents . componentTypeId = __expectString ( data . componentTypeId ) ; } if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } if ( data . workspaceId !== undefined && data . workspaceId !== null ) { contents . workspaceId = __expectString ( data . workspaceId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateComponentTypeCommandError = async ( output , context ) : Promise < UpdateComponentTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateEntityCommand = async ( output , context ) : Promise < UpdateEntityCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEntityCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , state : undefined , updateDateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . state !== undefined && data . state !== null ) { contents . state = __expectString ( data . state ) ; } if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEntityCommandError = async ( output , context ) : Promise < UpdateEntityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.iottwinmaker#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateSceneCommand = async ( output , context ) : Promise < UpdateSceneCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSceneCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , updateDateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSceneCommandError = async ( output , context ) : Promise < UpdateSceneCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateWorkspaceCommand = async ( output , context ) : Promise < UpdateWorkspaceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateWorkspaceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , updateDateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . updateDateTime !== undefined && data . updateDateTime !== null ) { contents . updateDateTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . updateDateTime ) ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateWorkspaceCommandError = async ( output , context ) : Promise < UpdateWorkspaceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.iottwinmaker#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.iottwinmaker#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iottwinmaker#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.iottwinmaker#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.iottwinmaker#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.iottwinmaker#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConnectorFailureExceptionResponse = async ( parsedOutput , context ) : Promise < ConnectorFailureException > => { const contents = { name : "ConnectorFailureException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConnectorTimeoutExceptionResponse = async ( parsedOutput , context ) : Promise < ConnectorTimeoutException > => { const contents = { name : "ConnectorTimeoutException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyTagsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyTagsException > => { const contents = { name : "TooManyTagsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1ComponentRequest = ( input , context ) : any => { return { ... ( input . componentTypeId !== undefined && input . componentTypeId !== null && { componentTypeId : input . componentTypeId } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . properties !== undefined && input . properties !== null && { properties : serializeAws_restJson1PropertyRequests ( input . properties , context ) } ) , } ; } ; const serializeAws_restJson1ComponentsMapRequest = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ComponentRequest ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1ComponentUpdateRequest = ( input , context ) : any => { return { ... ( input . componentTypeId !== undefined && input . componentTypeId !== null && { componentTypeId : input . componentTypeId } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . propertyUpdates !== undefined && input . propertyUpdates !== null && { propertyUpdates : serializeAws_restJson1PropertyRequests ( input . propertyUpdates , context ) , } ) , ... ( input . updateType !== undefined && input . updateType !== null && { updateType : input . updateType } ) , } ; } ; const serializeAws_restJson1ComponentUpdatesMapRequest = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ComponentUpdateRequest ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1Configuration = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1DataConnector = ( input , context ) : any => { return { ... ( input . isNative !== undefined && input . isNative !== null && { isNative : input . isNative } ) , ... ( input . lambda !== undefined && input . lambda !== null && { lambda : serializeAws_restJson1LambdaFunction ( input . lambda , context ) } ) , } ; } ; const serializeAws_restJson1DataType = ( input , context ) : any => { return { ... ( input . allowedValues !== undefined && input . allowedValues !== null && { allowedValues : serializeAws_restJson1DataValueList ( input . allowedValues , context ) , } ) , ... ( input . nestedType !== undefined && input . nestedType !== null && { nestedType : serializeAws_restJson1DataType ( input . nestedType , context ) } ) , ... ( input . relationship !== undefined && input . relationship !== null && { relationship : serializeAws_restJson1Relationship ( input . relationship , context ) } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , ... ( input . unitOfMeasure !== undefined && input . unitOfMeasure !== null && { unitOfMeasure : input . unitOfMeasure } ) , } ; } ; const serializeAws_restJson1DataValue = ( input , context ) : any => { return { ... ( input . booleanValue !== undefined && input . booleanValue !== null && { booleanValue : input . booleanValue } ) , ... ( input . doubleValue !== undefined && input . doubleValue !== null && { doubleValue : __serializeFloat ( input . doubleValue ) } ) , ... ( input . expression !== undefined && input . expression !== null && { expression : input . expression } ) , ... ( input . integerValue !== undefined && input . integerValue !== null && { integerValue : input . integerValue } ) , ... ( input . listValue !== undefined && input . listValue !== null && { listValue : serializeAws_restJson1DataValueList ( input . listValue , context ) } ) , ... ( input . longValue !== undefined && input . longValue !== null && { longValue : input . longValue } ) , ... ( input . mapValue !== undefined && input . mapValue !== null && { mapValue : serializeAws_restJson1DataValueMap ( input . mapValue , context ) } ) , ... ( input . relationshipValue !== undefined && input . relationshipValue !== null && { relationshipValue : serializeAws_restJson1RelationshipValue ( input . relationshipValue , context ) , } ) , ... ( input . stringValue !== undefined && input . stringValue !== null && { stringValue : input . stringValue } ) , } ; } ; const serializeAws_restJson1DataValueList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1DataValue ( entry , context ) ; } ) ; } ; const serializeAws_restJson1DataValueMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1DataValue ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1EntityPropertyReference = ( input , context ) : any => { return { ... ( input . componentName !== undefined && input . componentName !== null && { componentName : input . componentName } ) , ... ( input . entityId !== undefined && input . entityId !== null && { entityId : input . entityId } ) , ... ( input . externalIdProperty !== undefined && input . externalIdProperty !== null && { externalIdProperty : serializeAws_restJson1ExternalIdProperty ( input . externalIdProperty , context ) , } ) , ... ( input . propertyName !== undefined && input . propertyName !== null && { propertyName : input . propertyName } ) , } ; } ; const serializeAws_restJson1Entries = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1PropertyValueEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ExtendsFrom = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ExternalIdProperty = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1FunctionRequest = ( input , context ) : any => { return { ... ( input . implementedBy !== undefined && input . implementedBy !== null && { implementedBy : serializeAws_restJson1DataConnector ( input . implementedBy , context ) , } ) , ... ( input . requiredProperties !== undefined && input . requiredProperties !== null && { requiredProperties : serializeAws_restJson1RequiredProperties ( input . requiredProperties , context ) , } ) , ... ( input . scope !== undefined && input . scope !== null && { scope : input . scope } ) , } ; } ; const serializeAws_restJson1FunctionsRequest = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1FunctionRequest ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1InterpolationParameters = ( input , context ) : any => { return { ... ( input . interpolationType !== undefined && input . interpolationType !== null && { interpolationType : input . interpolationType } ) , ... ( input . intervalInSeconds !== undefined && input . intervalInSeconds !== null && { intervalInSeconds : input . intervalInSeconds } ) , } ; } ; const serializeAws_restJson1LambdaFunction = ( input , context ) : any => { return { ... ( input . arn !== undefined && input . arn !== null && { arn : input . arn } ) , } ; } ; const serializeAws_restJson1ListComponentTypesFilter = ( input , context ) : any => { return ListComponentTypesFilter . visit ( input , { extendsFrom : ( value ) => ( { extendsFrom : value } ) , isAbstract : ( value ) => ( { isAbstract : value } ) , namespace : ( value ) => ( { namespace : value } ) , _ : ( name , value ) => ( { name : value } as any ) , } ) ; } ; const serializeAws_restJson1ListComponentTypesFilters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ListComponentTypesFilter ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListEntitiesFilter = ( input , context ) : any => { return ListEntitiesFilter . visit ( input , { componentTypeId : ( value ) => ( { componentTypeId : value } ) , parentEntityId : ( value ) => ( { parentEntityId : value } ) , _ : ( name , value ) => ( { name : value } as any ) , } ) ; } ; const serializeAws_restJson1ListEntitiesFilters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ListEntitiesFilter ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ParentEntityUpdateRequest = ( input , context ) : any => { return { ... ( input . parentEntityId !== undefined && input . parentEntityId !== null && { parentEntityId : input . parentEntityId } ) , ... ( input . updateType !== undefined && input . updateType !== null && { updateType : input . updateType } ) , } ; } ; const serializeAws_restJson1PropertyDefinitionRequest = ( input , context ) : any => { return { ... ( input . configuration !== undefined && input . configuration !== null && { configuration : serializeAws_restJson1Configuration ( input . configuration , context ) , } ) , ... ( input . dataType !== undefined && input . dataType !== null && { dataType : serializeAws_restJson1DataType ( input . dataType , context ) } ) , ... ( input . defaultValue !== undefined && input . defaultValue !== null && { defaultValue : serializeAws_restJson1DataValue ( input . defaultValue , context ) } ) , ... ( input . isExternalId !== undefined && input . isExternalId !== null && { isExternalId : input . isExternalId } ) , ... ( input . isRequiredInEntity !== undefined && input . isRequiredInEntity !== null && { isRequiredInEntity : input . isRequiredInEntity } ) , ... ( input . isStoredExternally !== undefined && input . isStoredExternally !== null && { isStoredExternally : input . isStoredExternally } ) , ... ( input . isTimeSeries !== undefined && input . isTimeSeries !== null && { isTimeSeries : input . isTimeSeries } ) , } ; } ; const serializeAws_restJson1PropertyDefinitionsRequest = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1PropertyDefinitionRequest ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1PropertyFilter = ( input , context ) : any => { return { ... ( input . operator !== undefined && input . operator !== null && { operator : input . operator } ) , ... ( input . propertyName !== undefined && input . propertyName !== null && { propertyName : input . propertyName } ) , ... ( input . value !== undefined && input . value !== null && { value : serializeAws_restJson1DataValue ( input . value , context ) } ) , } ; } ; const serializeAws_restJson1PropertyFilters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1PropertyFilter ( entry , context ) ; } ) ; } ; const serializeAws_restJson1PropertyRequest = ( input , context ) : any => { return { ... ( input . definition !== undefined && input . definition !== null && { definition : serializeAws_restJson1PropertyDefinitionRequest ( input . definition , context ) , } ) , ... ( input . updateType !== undefined && input . updateType !== null && { updateType : input . updateType } ) , ... ( input . value !== undefined && input . value !== null && { value : serializeAws_restJson1DataValue ( input . value , context ) } ) , } ; } ; const serializeAws_restJson1PropertyRequests = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1PropertyRequest ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1PropertyValue = ( input , context ) : any => { return { ... ( input . timestamp !== undefined && input . timestamp !== null && { timestamp : Math . round ( input . timestamp . getTime ( ) / 1000 ) } ) , ... ( input . value !== undefined && input . value !== null && { value : serializeAws_restJson1DataValue ( input . value , context ) } ) , } ; } ; const serializeAws_restJson1PropertyValueEntry = ( input , context ) : any => { return { ... ( input . entityPropertyReference !== undefined && input . entityPropertyReference !== null && { entityPropertyReference : serializeAws_restJson1EntityPropertyReference ( input . entityPropertyReference , context ) , } ) , ... ( input . propertyValues !== undefined && input . propertyValues !== null && { propertyValues : serializeAws_restJson1PropertyValues ( input . propertyValues , context ) , } ) , } ; } ; const serializeAws_restJson1PropertyValues = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1PropertyValue ( entry , context ) ; } ) ; } ; const serializeAws_restJson1Relationship = ( input , context ) : any => { return { ... ( input . relationshipType !== undefined && input . relationshipType !== null && { relationshipType : input . relationshipType } ) , ... ( input . targetComponentTypeId !== undefined && input . targetComponentTypeId !== null && { targetComponentTypeId : input . targetComponentTypeId } ) , } ; } ; const serializeAws_restJson1RelationshipValue = ( input , context ) : any => { return { ... ( input . targetComponentName !== undefined && input . targetComponentName !== null && { targetComponentName : input . targetComponentName } ) , ... ( input . targetEntityId !== undefined && input . targetEntityId !== null && { targetEntityId : input . targetEntityId } ) , } ; } ; const serializeAws_restJson1RequiredProperties = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SceneCapabilities = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SelectedPropertyList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const deserializeAws_restJson1BatchPutPropertyError = ( output , context ) : BatchPutPropertyError => { return { entry : output . entry !== undefined && output . entry !== null ? deserializeAws_restJson1PropertyValueEntry ( output . entry , context ) : undefined , errorCode : __expectString ( output . errorCode ) , errorMessage : __expectString ( output . errorMessage ) , } as any ; } ; const deserializeAws_restJson1BatchPutPropertyErrorEntry = ( output , context ) : BatchPutPropertyErrorEntry => { return { errors : output . errors !== undefined && output . errors !== null ? deserializeAws_restJson1Errors ( output . errors , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ComponentResponse = ( output , context ) : ComponentResponse => { return { componentName : __expectString ( output . componentName ) , componentTypeId : __expectString ( output . componentTypeId ) , definedIn : __expectString ( output . definedIn ) , description : __expectString ( output . description ) , properties : output . properties !== undefined && output . properties !== null ? deserializeAws_restJson1PropertyResponses ( output . properties , context ) : undefined , status : output . status !== undefined && output . status !== null ? deserializeAws_restJson1Status ( output . status , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ComponentsMap = ( output , context ) : { [ key ] : ComponentResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ComponentResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1ComponentTypeSummaries = ( output , context ) : ComponentTypeSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ComponentTypeSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ComponentTypeSummary = ( output , context ) : ComponentTypeSummary => { return { arn : __expectString ( output . arn ) , componentTypeId : __expectString ( output . componentTypeId ) , creationDateTime : output . creationDateTime !== undefined && output . creationDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDateTime ) ) ) : undefined , description : __expectString ( output . description ) , status : output . status !== undefined && output . status !== null ? deserializeAws_restJson1Status ( output . status , context ) : undefined , updateDateTime : output . updateDateTime !== undefined && output . updateDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updateDateTime ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1Configuration = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1DataConnector = ( output , context ) : DataConnector => { return { isNative : __expectBoolean ( output . isNative ) , lambda : output . lambda !== undefined && output . lambda !== null ? deserializeAws_restJson1LambdaFunction ( output . lambda , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DataType = ( output , context ) : DataType => { return { allowedValues : output . allowedValues !== undefined && output . allowedValues !== null ? deserializeAws_restJson1DataValueList ( output . allowedValues , context ) : undefined , nestedType : output . nestedType !== undefined && output . nestedType !== null ? deserializeAws_restJson1DataType ( output . nestedType , context ) : undefined , relationship : output . relationship !== undefined && output . relationship !== null ? deserializeAws_restJson1Relationship ( output . relationship , context ) : undefined , type : __expectString ( output . type ) , unitOfMeasure : __expectString ( output . unitOfMeasure ) , } as any ; } ; const deserializeAws_restJson1DataValue = ( output , context ) : DataValue => { return { booleanValue : __expectBoolean ( output . booleanValue ) , doubleValue : __limitedParseDouble ( output . doubleValue ) , expression : __expectString ( output . expression ) , integerValue : __expectInt32 ( output . integerValue ) , listValue : output . listValue !== undefined && output . listValue !== null ? deserializeAws_restJson1DataValueList ( output . listValue , context ) : undefined , longValue : __expectLong ( output . longValue ) , mapValue : output . mapValue !== undefined && output . mapValue !== null ? deserializeAws_restJson1DataValueMap ( output . mapValue , context ) : undefined , relationshipValue : output . relationshipValue !== undefined && output . relationshipValue !== null ? deserializeAws_restJson1RelationshipValue ( output . relationshipValue , context ) : undefined , stringValue : __expectString ( output . stringValue ) , } as any ; } ; const deserializeAws_restJson1DataValueList = ( output , context ) : DataValue [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DataValue ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DataValueMap = ( output , context ) : { [ key ] : DataValue ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1DataValue ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1EntityPropertyReference = ( output , context ) : EntityPropertyReference => { return { componentName : __expectString ( output . componentName ) , entityId : __expectString ( output . entityId ) , externalIdProperty : output . externalIdProperty !== undefined && output . externalIdProperty !== null ? deserializeAws_restJson1ExternalIdProperty ( output . externalIdProperty , context ) : undefined , propertyName : __expectString ( output . propertyName ) , } as any ; } ; const deserializeAws_restJson1EntitySummaries = ( output , context ) : EntitySummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EntitySummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EntitySummary = ( output , context ) : EntitySummary => { return { arn : __expectString ( output . arn ) , creationDateTime : output . creationDateTime !== undefined && output . creationDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDateTime ) ) ) : undefined , description : __expectString ( output . description ) , entityId : __expectString ( output . entityId ) , entityName : __expectString ( output . entityName ) , hasChildEntities : __expectBoolean ( output . hasChildEntities ) , parentEntityId : __expectString ( output . parentEntityId ) , status : output . status !== undefined && output . status !== null ? deserializeAws_restJson1Status ( output . status , context ) : undefined , updateDateTime : output . updateDateTime !== undefined && output . updateDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updateDateTime ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ErrorDetails = ( output , context ) : ErrorDetails => { return { code : __expectString ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_restJson1ErrorEntries = ( output , context ) : BatchPutPropertyErrorEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchPutPropertyErrorEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Errors = ( output , context ) : BatchPutPropertyError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchPutPropertyError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ExtendsFrom = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ExternalIdProperty = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1FunctionResponse = ( output , context ) : FunctionResponse => { return { implementedBy : output . implementedBy !== undefined && output . implementedBy !== null ? deserializeAws_restJson1DataConnector ( output . implementedBy , context ) : undefined , isInherited : __expectBoolean ( output . isInherited ) , requiredProperties : output . requiredProperties !== undefined && output . requiredProperties !== null ? deserializeAws_restJson1RequiredProperties ( output . requiredProperties , context ) : undefined , scope : __expectString ( output . scope ) , } as any ; } ; const deserializeAws_restJson1FunctionsResponse = ( output , context ) : { [ key ] : FunctionResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1FunctionResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1LambdaFunction = ( output , context ) : LambdaFunction => { return { arn : __expectString ( output . arn ) , } as any ; } ; const deserializeAws_restJson1PropertyDefinitionResponse = ( output , context ) : PropertyDefinitionResponse => { return { configuration : output . configuration !== undefined && output . configuration !== null ? deserializeAws_restJson1Configuration ( output . configuration , context ) : undefined , dataType : output . dataType !== undefined && output . dataType !== null ? deserializeAws_restJson1DataType ( output . dataType , context ) : undefined , defaultValue : output . defaultValue !== undefined && output . defaultValue !== null ? deserializeAws_restJson1DataValue ( output . defaultValue , context ) : undefined , isExternalId : __expectBoolean ( output . isExternalId ) , isFinal : __expectBoolean ( output . isFinal ) , isImported : __expectBoolean ( output . isImported ) , isInherited : __expectBoolean ( output . isInherited ) , isRequiredInEntity : __expectBoolean ( output . isRequiredInEntity ) , isStoredExternally : __expectBoolean ( output . isStoredExternally ) , isTimeSeries : __expectBoolean ( output . isTimeSeries ) , } as any ; } ; const deserializeAws_restJson1PropertyDefinitionsResponse = ( output , context ) : { [ key ] : PropertyDefinitionResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1PropertyDefinitionResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1PropertyLatestValue = ( output , context ) : PropertyLatestValue => { return { propertyReference : output . propertyReference !== undefined && output . propertyReference !== null ? deserializeAws_restJson1EntityPropertyReference ( output . propertyReference , context ) : undefined , propertyValue : output . propertyValue !== undefined && output . propertyValue !== null ? deserializeAws_restJson1DataValue ( output . propertyValue , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PropertyLatestValueMap = ( output , context ) : { [ key ] : PropertyLatestValue ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1PropertyLatestValue ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1PropertyResponse = ( output , context ) : PropertyResponse => { return { definition : output . definition !== undefined && output . definition !== null ? deserializeAws_restJson1PropertyDefinitionResponse ( output . definition , context ) : undefined , value : output . value !== undefined && output . value !== null ? deserializeAws_restJson1DataValue ( output . value , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PropertyResponses = ( output , context ) : { [ key ] : PropertyResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1PropertyResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1PropertyValue = ( output , context ) : PropertyValue => { return { timestamp : output . timestamp !== undefined && output . timestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . timestamp ) ) ) : undefined , value : output . value !== undefined && output . value !== null ? deserializeAws_restJson1DataValue ( output . value , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PropertyValueEntry = ( output , context ) : PropertyValueEntry => { return { entityPropertyReference : output . entityPropertyReference !== undefined && output . entityPropertyReference !== null ? deserializeAws_restJson1EntityPropertyReference ( output . entityPropertyReference , context ) : undefined , propertyValues : output . propertyValues !== undefined && output . propertyValues !== null ? deserializeAws_restJson1PropertyValues ( output . propertyValues , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PropertyValueHistory = ( output , context ) : PropertyValueHistory => { return { entityPropertyReference : output . entityPropertyReference !== undefined && output . entityPropertyReference !== null ? deserializeAws_restJson1EntityPropertyReference ( output . entityPropertyReference , context ) : undefined , values : output . values !== undefined && output . values !== null ? deserializeAws_restJson1Values ( output . values , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PropertyValueList = ( output , context ) : PropertyValueHistory [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PropertyValueHistory ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PropertyValues = ( output , context ) : PropertyValue [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PropertyValue ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Relationship = ( output , context ) : Relationship => { return { relationshipType : __expectString ( output . relationshipType ) , targetComponentTypeId : __expectString ( output . targetComponentTypeId ) , } as any ; } ; const deserializeAws_restJson1RelationshipValue = ( output , context ) : RelationshipValue => { return { targetComponentName : __expectString ( output . targetComponentName ) , targetEntityId : __expectString ( output . targetEntityId ) , } as any ; } ; const deserializeAws_restJson1RequiredProperties = ( output , context ) : string [ ] => { const uniqueValues = new Set < any > ( ) ; return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } const parsedEntry = __expectString ( entry ) as any ; if ( uniqueValues . has ( parsedEntry ) ) { throw new TypeError ( 'All elements of the set "com.amazonaws.iottwinmaker#RequiredProperties" must be unique.' ) ; } else { uniqueValues . add ( parsedEntry ) ; return parsedEntry ; } } ) ; } ; const deserializeAws_restJson1SceneCapabilities = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1SceneSummaries = ( output , context ) : SceneSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SceneSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SceneSummary = ( output , context ) : SceneSummary => { return { arn : __expectString ( output . arn ) , contentLocation : __expectString ( output . contentLocation ) , creationDateTime : output . creationDateTime !== undefined && output . creationDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDateTime ) ) ) : undefined , description : __expectString ( output . description ) , sceneId : __expectString ( output . sceneId ) , updateDateTime : output . updateDateTime !== undefined && output . updateDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updateDateTime ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1Status = ( output , context ) : Status => { return { error : output . error !== undefined && output . error !== null ? deserializeAws_restJson1ErrorDetails ( output . error , context ) : undefined , state : __expectString ( output . state ) , } as any ; } ; const deserializeAws_restJson1TagMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1Values = ( output , context ) : PropertyValue [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PropertyValue ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1WorkspaceSummaries = ( output , context ) : WorkspaceSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1WorkspaceSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1WorkspaceSummary = ( output , context ) : WorkspaceSummary => { return { arn : __expectString ( output . arn ) , creationDateTime : output . creationDateTime !== undefined && output . creationDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDateTime ) ) ) : undefined , description : __expectString ( output . description ) , updateDateTime : output . updateDateTime !== undefined && output . updateDateTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updateDateTime ) ) ) : undefined , workspaceId : __expectString ( output . workspaceId ) , } 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 "" ; } ;